Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Unified Diff: components/cronet/ios/BUILD.gn

Issue 2807283002: [Cronet] Build static libcronet.a for iOS with complete dependencies. (Closed)
Patch Set: Disable cronet_consumer_static target for fat builds. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/cronet/ios/BUILD.gn
diff --git a/components/cronet/ios/BUILD.gn b/components/cronet/ios/BUILD.gn
index 716fa0b47ef7212d96362b7236a846d969a6b4b2..8b8f4b1c698a06770c86333f9d40756dbeb1aca8 100644
--- a/components/cronet/ios/BUILD.gn
+++ b/components/cronet/ios/BUILD.gn
@@ -32,34 +32,61 @@ 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 = [
+ "Cronet.framework",
+ "UIKit.Framework",
+ "CFNetwork.framework",
+ "MobileCoreServices.framework",
+ "Security.framework",
+ "SystemConfiguration.framework",
+ "resolv",
]
+ configs = [ ":cronet_include_config" ]
+}
+
+_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",
+]
+
+_cronet_public_headers = [
+ "Cronet.h",
+ "cronet_c_for_grpc.h",
+]
+_cronet_public_headers += grpc_public_headers
+
+source_set("cronet_sources") {
+ deps = _cronet_deps
+
+ sources = _cronet_sources
include_dirs = [ "//components/grpc_support/include" ]
@@ -85,17 +112,11 @@ ios_framework_bundle("cronet_framework") {
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
+ public_headers = _cronet_public_headers
sources = [
"Cronet.h",
@@ -103,6 +124,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 +160,131 @@ action("generate_accept_languages") {
]
}
+# A static library which contains just _cronet_sources.
+static_library("cronet_static") {
+ visibility = [ ":*" ]
+ deps = _cronet_deps
+ sources = _cronet_sources
+ public_configs = [ ":cronet_include_config" ]
+ public_deps = [
+ "//components/grpc_support",
+ ]
+}
+
+# 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_static_complete") {
+ visibility = [ ":*" ]
+ script = "//components/cronet/tools/hide_symbols.py"
+ deps = [
+ ":cronet_deps_complete",
+ ":cronet_static",
+ ]
+ outputs = [
+ "$target_out_dir/$current_cpu/cronet_static_complete.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),
mef 2017/06/02 16:26:17 The x86 debug size of libcronet_deps_complete.a is
+ "--output_obj",
+ rebase_path("$target_out_dir/$current_cpu/cronet_static_complete.o",
+ root_build_dir),
+ "--output_lib",
+ rebase_path("$target_out_dir/$current_cpu/cronet_static_complete.a",
+ root_build_dir),
+ "--current_cpu",
+ current_cpu,
+ ]
+
+ public_configs = [ ":cronet_static_config" ]
+}
+
+# A fat static library which exports cronet public symbols and hides all dependendencies.
+lipo_binary("libcronet") {
+ arch_binary_target = ":cronet_static_complete"
+ arch_binary_output = "cronet_static_complete.a"
+ output_name = "libcronet.a"
+ enable_stripping = false
+ enable_dsyms = false
+}
+
+template("ios_static_framework") {
+ _target_name = target_name
+ _output_name = target_name
+ if (defined(invoker.output_name)) {
+ _output_name = invoker.output_name
+ }
+ _framework_name = target_name
+ if (defined(invoker.framework_name)) {
+ _framework_name = invoker.framework_name
+ }
+
+ _bundle_target_name = _target_name + "_bundle"
+ _framework_headers_target = _target_name + "_framework_headers"
+ bundle_data(_framework_headers_target) {
+ visibility = [ ":$_bundle_target_name" ]
+ sources = invoker.public_headers
+ outputs = [
+ "{{bundle_root_dir}}/Headers/{{source_file_part}}",
+ ]
+ }
+
+ _framework_binary_target = _target_name + "_framework_binary"
+ _static_library_target = invoker.static_library_target
+
+ bundle_data(_framework_binary_target) {
+ visibility = [ ":$_bundle_target_name" ]
+ sources = get_target_outputs(_static_library_target)
+ outputs = [
+ "{{bundle_root_dir}}/$_framework_name",
+ ]
+ public_deps = [
+ _static_library_target,
+ ]
+ }
+
+ create_bundle(_bundle_target_name) {
+ product_type = "com.apple.product-type.framework"
+ bundle_root_dir = "$root_out_dir/Static/$_output_name"
+ bundle_executable_dir = bundle_root_dir
+ bundle_resources_dir = bundle_root_dir
+ bundle_plugins_dir = bundle_root_dir
+ deps = [
+ ":$_framework_binary_target",
+ ":$_framework_headers_target",
+ ]
+ }
+
+ action(_target_name) {
+ script = "//components/cronet/tools/dummy.py"
mef 2017/06/02 16:26:17 This dummy action is used to put output of |cronet
+ outputs = [
+ "$root_out_dir/Static/$_output_name",
+ ]
+ deps = [
+ ":$_bundle_target_name",
+ ]
+ public_configs = invoker.public_configs
+ }
+}
+
+ios_static_framework("cronet_static_framework") {
+ output_name = "Cronet.framework"
+ framework_name = "Cronet"
+ public_headers = _cronet_public_headers
+ static_library_target = ":libcronet"
mef 2017/06/02 16:26:17 Depending on lipo_binary target to produce fat sta
+ public_configs = [ ":cronet_static_config" ]
+}
+
if (additional_toolchains == [] || current_toolchain == default_toolchain) {
_package_dir = "$root_out_dir/cronet"
@@ -160,6 +308,19 @@ if (additional_toolchains == [] || current_toolchain == default_toolchain) {
]
}
+ copy("cronet_static_copy") {
+ sources = [
+ "$root_out_dir/Static/Cronet.framework",
+ ]
+ outputs = [
+ "$_package_dir/Static/Cronet.framework",
+ ]
+
+ deps = [
+ ":cronet_static_framework",
+ ]
+ }
+
copy("cronet_package_copy") {
sources = [
"$root_out_dir/Cronet.framework",
@@ -172,6 +333,7 @@ if (additional_toolchains == [] || current_toolchain == default_toolchain) {
deps = [
":cronet_framework",
+ ":cronet_static_copy",
]
}
« no previous file with comments | « no previous file | components/cronet/ios/cronet_consumer/BUILD.gn » ('j') | components/cronet/ios/cronet_consumer/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698