Index: components/cronet/ios/BUILD.gn |
diff --git a/components/cronet/ios/BUILD.gn b/components/cronet/ios/BUILD.gn |
index 716fa0b47ef7212d96362b7236a846d969a6b4b2..8484e57cfdf4298d5a64cf96d9cdb0d01a2c78bb 100644 |
--- a/components/cronet/ios/BUILD.gn |
+++ b/components/cronet/ios/BUILD.gn |
@@ -32,34 +32,54 @@ process_version("cronet_version_header") { |
] |
} |
-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", |
- ] |
+config("cronet_include_config") { |
+ include_dirs = [ "//components/grpc_support/include" ] |
+} |
- 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", |
+config("cronet_static_config") { |
+ libs = [ |
+ "$target_out_dir/$current_cpu/libcronet_hide.a", |
+ "UIKit.Framework", |
+ "CFNetwork.framework", |
+ "MobileCoreServices.framework", |
+ "Security.framework", |
+ "SystemConfiguration.framework", |
+ "resolv", |
] |
+} |
+ |
+_cronet_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", |
+] |
+ |
+_cronet_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", |
+] |
+ |
+source_set("cronet_sources") { |
+ deps = _cronet_deps |
+ |
+ sources = _cronet_sources |
include_dirs = [ "//components/grpc_support/include" ] |
@@ -103,6 +123,8 @@ ios_framework_bundle("cronet_framework") { |
configs -= [ "//build/config/compiler:default_symbols" ] |
configs += [ "//build/config/compiler:symbols" ] |
+ |
+ public_configs = [ ":cronet_include_config" ] |
} |
test("cronet_unittests") { |
@@ -137,6 +159,76 @@ action("generate_accept_languages") { |
] |
} |
+# A static library which contains just _cronet_sources. |
+static_library("cronet_static") { |
+ deps = _cronet_deps |
+ |
+ sources = _cronet_sources |
+ |
+ visibility = [ ":*" ] |
+ |
+ include_dirs = [ "//components/grpc_support/include" ] |
kapishnikov
2017/05/22 17:15:57
Replace it with "cronet_include_config"?
mef
2017/05/22 20:53:53
Done.
|
+ |
+ public_deps = [ |
+ "//components/grpc_support", |
+ ] |
+ |
+ public_headers = [ |
+ "Cronet.h", |
+ "cronet_c_for_grpc.h", |
+ ] |
+ public_headers += grpc_public_headers |
+} |
+ |
+# A static library which contains all dependencies of :cronet_static. |
+static_library("cronet_deps_complete") { |
+ visibility = [ ":*" ] |
+ complete_static_lib = true |
+ deps = [ |
+ ":cronet_static", |
+ ] |
+} |
+ |
+# A static library which contains cronet and all dependendencies hidden inside. |
+action("cronet_hide") { |
kapishnikov
2017/05/22 17:15:57
Do we intend to keep this target public? If yes, w
mef
2017/05/22 20:53:53
It is currently used by cronet_consumer_static.
I
|
+ script = "//components/cronet/tools/hide_symbols.py" |
+ deps = [ |
+ ":cronet_deps_complete", |
+ ":cronet_static", |
+ ] |
+ outputs = [ |
+ "$target_out_dir/$current_cpu/libcronet_hide.a", |
+ ] |
+ args = [ |
+ "--input_libs", |
+ rebase_path("$target_out_dir/libcronet_static.a", root_build_dir), |
+ "--deps_lib", |
+ rebase_path("$target_out_dir/libcronet_deps_complete.a", root_build_dir), |
+ "--output_obj", |
+ rebase_path("$target_out_dir/$current_cpu/libcronet_hide.o", |
+ root_build_dir), |
+ "--output_lib", |
+ rebase_path("$target_out_dir/$current_cpu/libcronet_hide.a", |
+ root_build_dir), |
+ "--current_cpu", |
+ current_cpu, |
+ ] |
+ |
+ public_configs = [ |
+ ":cronet_include_config", |
kapishnikov
2017/05/22 17:15:56
Should we add ":cronet_include_config" to ":cronet
mef
2017/05/22 20:53:53
Done.
|
+ ":cronet_static_config", |
+ ] |
+} |
+ |
+# A fat static library which exports cronet public symbols and hides all dependendencies. |
+lipo_binary("libcronet") { |
+ arch_binary_target = ":cronet_hide" |
+ arch_binary_output = "libcronet_hide.a" |
+ output_name = "libcronet.a" |
+ enable_stripping = false |
+ enable_dsyms = false |
+} |
+ |
if (additional_toolchains == [] || current_toolchain == default_toolchain) { |
_package_dir = "$root_out_dir/cronet" |
@@ -163,6 +255,7 @@ if (additional_toolchains == [] || current_toolchain == default_toolchain) { |
copy("cronet_package_copy") { |
sources = [ |
"$root_out_dir/Cronet.framework", |
+ "$target_out_dir/libcronet.a", |
"//AUTHORS", |
"//chrome/VERSION", |
] |
@@ -172,6 +265,7 @@ if (additional_toolchains == [] || current_toolchain == default_toolchain) { |
deps = [ |
":cronet_framework", |
+ ":libcronet", |
] |
} |