# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import("//build/buildflag_header.gni") import("//build/config/ios/rules.gni") import("//build/config/mac/symbols.gni") import("//build/mac/tweak_info_plist.gni") import("//build/util/process_version.gni") import("//build/util/version.gni") import("//components/grpc_support/include/headers.gni") import("//testing/test.gni") import("//url/features.gni") assert(!is_component_build, "Cronet requires static library build.") group("cronet_consumer_group") { deps = [ "//components/cronet/ios/cronet_consumer", ] } process_version("cronet_version_header") { template_file = "//components/cronet/version.h.in" sources = [ "//chrome/VERSION", ] output = "$target_gen_dir/version.h" extra_args = [ "-e", "VERSION_FULL=\"%s.%s.%s.%s\" % (MAJOR,MINOR,BUILD,PATCH)", ] } source_set("cronet_sources") { deps = [ ":cronet_version_header", ":generate_accept_languages", "//base:base", "//components/grpc_support", "//components/metrics:metrics", "//components/metrics/proto:proto", "//components/prefs:prefs", "//ios/net:net", "//ios/web:user_agent", "//net", "//url", ] sources = [ "../histogram_manager.cc", "../histogram_manager.h", "../stale_host_resolver.cc", "../stale_host_resolver.h", "../url_request_context_config.cc", "../url_request_context_config.h", "Cronet.h", "Cronet.mm", "cronet_c_for_grpc.h", "cronet_environment.h", "cronet_environment.mm", ] include_dirs = [ "//components/grpc_support/include" ] if (!use_platform_icu_alternatives) { deps += [ "//base:i18n" ] } } # Tweak |info_plist| with current version and revision. tweak_info_plist("tweak_cronet_plist") { info_plist = "Info.plist" } ios_framework_bundle("cronet_framework") { output_name = "Cronet" info_plist_target = ":tweak_cronet_plist" deps = [ ":cronet_sources", "//base", "//net:net", ] libs = [ "UIKit.Framework" ] include_dirs = [ "//components/grpc_support/include" ] public_deps = [ "//components/grpc_support", ] public_headers = [ "Cronet.h", "cronet_c_for_grpc.h", ] public_headers += grpc_public_headers sources = [ "Cronet.h", ] configs -= [ "//build/config/compiler:default_symbols" ] configs += [ "//build/config/compiler:symbols" ] } test("cronet_unittests") { testonly = true sources = [ "//components/cronet/histogram_manager_unittest.cc", "//components/cronet/run_all_unittests.cc", "//components/cronet/stale_host_resolver_unittest.cc", "//components/cronet/url_request_context_config_unittest.cc", ] deps = [ ":cronet_sources", "//base", "//base/test:test_support", "//components/cronet/ios/test:cronet_test", "//components/metrics", "//net", "//testing/gtest", ] } action("generate_accept_languages") { script = "//components/cronet/tools/generate_accept_languages.py" args = [ rebase_path("$target_gen_dir"), rebase_path("//"), ] outputs = [ "$target_gen_dir/accept_languages_table.h", ] } if (additional_toolchains == [] || current_toolchain == default_toolchain) { _package_dir = "$root_out_dir/cronet" action("generate_license") { _license_path = "$_package_dir/LICENSE" script = "//components/cronet/tools/cronet_licenses.py" inputs = [ "//build/util/LASTCHANGE", "//buildtools/$host_os/gn", ] outputs = [ _license_path, ] args = [ "license", rebase_path(_license_path, root_build_dir), "--gn", "--gn-path", rebase_path("//buildtools/$host_os/gn", root_build_dir), ] } copy("cronet_package_copy") { sources = [ "$root_out_dir/Cronet.framework", "//AUTHORS", "//chrome/VERSION", ] outputs = [ "$_package_dir/{{source_file_part}}", ] deps = [ ":cronet_framework", ] } if (enable_dsyms) { action("cronet_dsym_archive") { script = "//chrome/tools/build/mac/archive_symbols.py" # These are the dSYMs that will be archived. The sources list must be # the target outputs that correspond to the dSYMs (since a dSYM is a # directory it cannot be listed as a source file). The targets that # generate both the dSYM and binary image are listed in deps. _dsyms = [ "$root_out_dir/Cronet.dSYM" ] sources = [ "$root_out_dir/Cronet.framework", ] _output = "$_package_dir/Cronet.dSYM.tar.bz2" outputs = [ _output, ] args = [ rebase_path(_output, root_out_dir) ] + rebase_path(_dsyms, root_out_dir) deps = [ ":cronet_framework", ] } } else { group("cronet_dsym_archive") { } } group("cronet_package") { deps = [ ":cronet_dsym_archive", ":cronet_package_copy", ":generate_license", ] } }