| # 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.") |
| |
| declare_args() { |
| cronet_enable_data_reduction_proxy_support = false |
| } |
| |
| 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", |
| "//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" |
| } |
| |
| bundle_data("cronet_framework_resources") { |
| # This bundle contains "Accept-Languages" header values for known locales. |
| # TODO(mef): These strings should be auto-generated from chrome's .xtb |
| # files, not hardcoded. |
| sources = [ |
| "Resources/Localization/am.lproj", |
| "Resources/Localization/ar.lproj", |
| "Resources/Localization/bg.lproj", |
| "Resources/Localization/bn.lproj", |
| "Resources/Localization/ca.lproj", |
| "Resources/Localization/cs.lproj", |
| "Resources/Localization/da.lproj", |
| "Resources/Localization/de.lproj", |
| "Resources/Localization/el.lproj", |
| "Resources/Localization/en-GB.lproj", |
| "Resources/Localization/en.lproj", |
| "Resources/Localization/es-419.lproj", |
| "Resources/Localization/es.lproj", |
| "Resources/Localization/fa.lproj", |
| "Resources/Localization/fi.lproj", |
| "Resources/Localization/fil.lproj", |
| "Resources/Localization/fr.lproj", |
| "Resources/Localization/gu.lproj", |
| "Resources/Localization/he.lproj", |
| "Resources/Localization/hi.lproj", |
| "Resources/Localization/hr.lproj", |
| "Resources/Localization/hu.lproj", |
| "Resources/Localization/id.lproj", |
| "Resources/Localization/it.lproj", |
| "Resources/Localization/ja.lproj", |
| "Resources/Localization/kn.lproj", |
| "Resources/Localization/ko.lproj", |
| "Resources/Localization/lt.lproj", |
| "Resources/Localization/lv.lproj", |
| "Resources/Localization/ml.lproj", |
| "Resources/Localization/mr.lproj", |
| "Resources/Localization/ms.lproj", |
| "Resources/Localization/nb.lproj", |
| "Resources/Localization/nl.lproj", |
| "Resources/Localization/pl.lproj", |
| "Resources/Localization/pt-BR.lproj", |
| "Resources/Localization/pt-PT.lproj", |
| "Resources/Localization/pt.lproj", |
| "Resources/Localization/ro.lproj", |
| "Resources/Localization/ru.lproj", |
| "Resources/Localization/sk.lproj", |
| "Resources/Localization/sl.lproj", |
| "Resources/Localization/sr.lproj", |
| "Resources/Localization/sv.lproj", |
| "Resources/Localization/sw.lproj", |
| "Resources/Localization/ta.lproj", |
| "Resources/Localization/te.lproj", |
| "Resources/Localization/th.lproj", |
| "Resources/Localization/tr.lproj", |
| "Resources/Localization/uk.lproj", |
| "Resources/Localization/vi.lproj", |
| "Resources/Localization/zh-Hans.lproj", |
| "Resources/Localization/zh-Hant.lproj", |
| "Resources/Localization/zh.lproj", |
| ] |
| outputs = [ |
| "{{bundle_resources_dir}}/cronet_resources.bundle/{{source_file_part}}", |
| ] |
| } |
| |
| ios_framework_bundle("cronet_framework") { |
| output_name = "Cronet" |
| info_plist_target = ":tweak_cronet_plist" |
| |
| deps = [ |
| ":cronet_framework_resources", |
| ":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", |
| ] |
| } |
| |
| 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", |
| ] |
| } |
| |
| group("cronet_package") { |
| deps = [ |
| ":cronet_package_copy", |
| ":generate_license", |
| ] |
| } |
| } |