Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import("//build/buildflag_header.gni") | 5 import("//build/buildflag_header.gni") |
| 6 import("//build/config/ios/rules.gni") | 6 import("//build/config/ios/rules.gni") |
| 7 import("//build/config/mac/symbols.gni") | 7 import("//build/config/mac/symbols.gni") |
| 8 import("//build/mac/tweak_info_plist.gni") | 8 import("//build/mac/tweak_info_plist.gni") |
| 9 import("//build/util/process_version.gni") | 9 import("//build/util/process_version.gni") |
| 10 import("//build/util/version.gni") | 10 import("//build/util/version.gni") |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 sources = [ | 25 sources = [ |
| 26 "//chrome/VERSION", | 26 "//chrome/VERSION", |
| 27 ] | 27 ] |
| 28 output = "$target_gen_dir/version.h" | 28 output = "$target_gen_dir/version.h" |
| 29 extra_args = [ | 29 extra_args = [ |
| 30 "-e", | 30 "-e", |
| 31 "VERSION_FULL=\"%s.%s.%s.%s\" % (MAJOR,MINOR,BUILD,PATCH)", | 31 "VERSION_FULL=\"%s.%s.%s.%s\" % (MAJOR,MINOR,BUILD,PATCH)", |
| 32 ] | 32 ] |
| 33 } | 33 } |
| 34 | 34 |
| 35 config("cronet_include_config") { | |
| 36 include_dirs = [ "//components/grpc_support/include" ] | |
| 37 } | |
| 38 | |
| 39 config("cronet_static_config") { | |
| 40 libs = [ | |
| 41 "Cronet.framework", | |
| 42 "UIKit.Framework", | |
| 43 "CFNetwork.framework", | |
| 44 "MobileCoreServices.framework", | |
| 45 "Security.framework", | |
| 46 "SystemConfiguration.framework", | |
| 47 "resolv", | |
| 48 ] | |
| 49 configs = [ ":cronet_include_config" ] | |
| 50 } | |
| 51 | |
| 52 _cronet_deps = [ | |
| 53 ":cronet_version_header", | |
| 54 ":generate_accept_languages", | |
| 55 "//base:base", | |
| 56 "//components/grpc_support", | |
| 57 "//components/metrics:metrics", | |
| 58 "//components/metrics/proto:proto", | |
| 59 "//components/prefs:prefs", | |
| 60 "//ios/net:net", | |
| 61 "//ios/web:user_agent", | |
| 62 "//net", | |
| 63 "//url", | |
| 64 ] | |
| 65 | |
| 66 _cronet_sources = [ | |
| 67 "../histogram_manager.cc", | |
| 68 "../histogram_manager.h", | |
| 69 "../stale_host_resolver.cc", | |
| 70 "../stale_host_resolver.h", | |
| 71 "../url_request_context_config.cc", | |
| 72 "../url_request_context_config.h", | |
| 73 "Cronet.h", | |
| 74 "Cronet.mm", | |
| 75 "cronet_c_for_grpc.h", | |
| 76 "cronet_environment.h", | |
| 77 "cronet_environment.mm", | |
| 78 ] | |
| 79 | |
| 80 _cronet_public_headers = [ | |
| 81 "Cronet.h", | |
| 82 "cronet_c_for_grpc.h", | |
| 83 ] | |
| 84 _cronet_public_headers += grpc_public_headers | |
| 85 | |
| 35 source_set("cronet_sources") { | 86 source_set("cronet_sources") { |
| 36 deps = [ | 87 deps = _cronet_deps |
| 37 ":cronet_version_header", | |
| 38 ":generate_accept_languages", | |
| 39 "//base:base", | |
| 40 "//components/grpc_support", | |
| 41 "//components/metrics:metrics", | |
| 42 "//components/metrics/proto:proto", | |
| 43 "//components/prefs:prefs", | |
| 44 "//ios/net:net", | |
| 45 "//ios/web:user_agent", | |
| 46 "//net", | |
| 47 "//url", | |
| 48 ] | |
| 49 | 88 |
| 50 sources = [ | 89 sources = _cronet_sources |
| 51 "../histogram_manager.cc", | |
| 52 "../histogram_manager.h", | |
| 53 "../stale_host_resolver.cc", | |
| 54 "../stale_host_resolver.h", | |
| 55 "../url_request_context_config.cc", | |
| 56 "../url_request_context_config.h", | |
| 57 "Cronet.h", | |
| 58 "Cronet.mm", | |
| 59 "cronet_c_for_grpc.h", | |
| 60 "cronet_environment.h", | |
| 61 "cronet_environment.mm", | |
| 62 ] | |
| 63 | 90 |
| 64 include_dirs = [ "//components/grpc_support/include" ] | 91 include_dirs = [ "//components/grpc_support/include" ] |
| 65 | 92 |
| 66 if (!use_platform_icu_alternatives) { | 93 if (!use_platform_icu_alternatives) { |
| 67 deps += [ "//base:i18n" ] | 94 deps += [ "//base:i18n" ] |
| 68 } | 95 } |
| 69 } | 96 } |
| 70 | 97 |
| 71 # Tweak |info_plist| with current version and revision. | 98 # Tweak |info_plist| with current version and revision. |
| 72 tweak_info_plist("tweak_cronet_plist") { | 99 tweak_info_plist("tweak_cronet_plist") { |
| 73 info_plist = "Info.plist" | 100 info_plist = "Info.plist" |
| 74 } | 101 } |
| 75 | 102 |
| 76 ios_framework_bundle("cronet_framework") { | 103 ios_framework_bundle("cronet_framework") { |
| 77 output_name = "Cronet" | 104 output_name = "Cronet" |
| 78 info_plist_target = ":tweak_cronet_plist" | 105 info_plist_target = ":tweak_cronet_plist" |
| 79 | 106 |
| 80 deps = [ | 107 deps = [ |
| 81 ":cronet_sources", | 108 ":cronet_sources", |
| 82 "//base", | 109 "//base", |
| 83 "//net:net", | 110 "//net:net", |
| 84 ] | 111 ] |
| 85 | 112 |
| 86 libs = [ "UIKit.Framework" ] | 113 libs = [ "UIKit.Framework" ] |
| 87 | 114 |
| 88 include_dirs = [ "//components/grpc_support/include" ] | |
| 89 | |
| 90 public_deps = [ | 115 public_deps = [ |
| 91 "//components/grpc_support", | 116 "//components/grpc_support", |
| 92 ] | 117 ] |
| 93 | 118 |
| 94 public_headers = [ | 119 public_headers = _cronet_public_headers |
| 95 "Cronet.h", | |
| 96 "cronet_c_for_grpc.h", | |
| 97 ] | |
| 98 public_headers += grpc_public_headers | |
| 99 | 120 |
| 100 sources = [ | 121 sources = [ |
| 101 "Cronet.h", | 122 "Cronet.h", |
| 102 ] | 123 ] |
| 103 | 124 |
| 104 configs -= [ "//build/config/compiler:default_symbols" ] | 125 configs -= [ "//build/config/compiler:default_symbols" ] |
| 105 configs += [ "//build/config/compiler:symbols" ] | 126 configs += [ "//build/config/compiler:symbols" ] |
| 127 | |
| 128 public_configs = [ ":cronet_include_config" ] | |
| 106 } | 129 } |
| 107 | 130 |
| 108 test("cronet_unittests") { | 131 test("cronet_unittests") { |
| 109 testonly = true | 132 testonly = true |
| 110 | 133 |
| 111 sources = [ | 134 sources = [ |
| 112 "//components/cronet/histogram_manager_unittest.cc", | 135 "//components/cronet/histogram_manager_unittest.cc", |
| 113 "//components/cronet/run_all_unittests.cc", | 136 "//components/cronet/run_all_unittests.cc", |
| 114 "//components/cronet/stale_host_resolver_unittest.cc", | 137 "//components/cronet/stale_host_resolver_unittest.cc", |
| 115 "//components/cronet/url_request_context_config_unittest.cc", | 138 "//components/cronet/url_request_context_config_unittest.cc", |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 130 script = "//components/cronet/tools/generate_accept_languages.py" | 153 script = "//components/cronet/tools/generate_accept_languages.py" |
| 131 args = [ | 154 args = [ |
| 132 rebase_path("$target_gen_dir"), | 155 rebase_path("$target_gen_dir"), |
| 133 rebase_path("//"), | 156 rebase_path("//"), |
| 134 ] | 157 ] |
| 135 outputs = [ | 158 outputs = [ |
| 136 "$target_gen_dir/accept_languages_table.h", | 159 "$target_gen_dir/accept_languages_table.h", |
| 137 ] | 160 ] |
| 138 } | 161 } |
| 139 | 162 |
| 163 # A static library which contains just _cronet_sources. | |
| 164 static_library("cronet_static") { | |
| 165 visibility = [ ":*" ] | |
| 166 deps = _cronet_deps | |
| 167 sources = _cronet_sources | |
| 168 public_configs = [ ":cronet_include_config" ] | |
| 169 public_deps = [ | |
| 170 "//components/grpc_support", | |
| 171 ] | |
| 172 } | |
| 173 | |
| 174 # A static library which contains all dependencies of :cronet_static. | |
| 175 static_library("cronet_deps_complete") { | |
| 176 visibility = [ ":*" ] | |
| 177 complete_static_lib = true | |
| 178 deps = [ | |
| 179 ":cronet_static", | |
| 180 ] | |
| 181 } | |
| 182 | |
| 183 # A static library which contains cronet and all dependendencies hidden inside. | |
| 184 action("cronet_static_complete") { | |
| 185 visibility = [ ":*" ] | |
| 186 script = "//components/cronet/tools/hide_symbols.py" | |
| 187 deps = [ | |
| 188 ":cronet_deps_complete", | |
| 189 ":cronet_static", | |
| 190 ] | |
| 191 outputs = [ | |
| 192 "$target_out_dir/$current_cpu/cronet_static_complete.a", | |
| 193 ] | |
| 194 args = [ | |
| 195 "--input_libs", | |
| 196 rebase_path("$target_out_dir/libcronet_static.a", root_build_dir), | |
| 197 "--deps_lib", | |
| 198 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
| |
| 199 "--output_obj", | |
| 200 rebase_path("$target_out_dir/$current_cpu/cronet_static_complete.o", | |
| 201 root_build_dir), | |
| 202 "--output_lib", | |
| 203 rebase_path("$target_out_dir/$current_cpu/cronet_static_complete.a", | |
| 204 root_build_dir), | |
| 205 "--current_cpu", | |
| 206 current_cpu, | |
| 207 ] | |
| 208 | |
| 209 public_configs = [ ":cronet_static_config" ] | |
| 210 } | |
| 211 | |
| 212 # A fat static library which exports cronet public symbols and hides all depende ndencies. | |
| 213 lipo_binary("libcronet") { | |
| 214 arch_binary_target = ":cronet_static_complete" | |
| 215 arch_binary_output = "cronet_static_complete.a" | |
| 216 output_name = "libcronet.a" | |
| 217 enable_stripping = false | |
| 218 enable_dsyms = false | |
| 219 } | |
| 220 | |
| 221 template("ios_static_framework") { | |
| 222 _target_name = target_name | |
| 223 _output_name = target_name | |
| 224 if (defined(invoker.output_name)) { | |
| 225 _output_name = invoker.output_name | |
| 226 } | |
| 227 _framework_name = target_name | |
| 228 if (defined(invoker.framework_name)) { | |
| 229 _framework_name = invoker.framework_name | |
| 230 } | |
| 231 | |
| 232 _bundle_target_name = _target_name + "_bundle" | |
| 233 _framework_headers_target = _target_name + "_framework_headers" | |
| 234 bundle_data(_framework_headers_target) { | |
| 235 visibility = [ ":$_bundle_target_name" ] | |
| 236 sources = invoker.public_headers | |
| 237 outputs = [ | |
| 238 "{{bundle_root_dir}}/Headers/{{source_file_part}}", | |
| 239 ] | |
| 240 } | |
| 241 | |
| 242 _framework_binary_target = _target_name + "_framework_binary" | |
| 243 _static_library_target = invoker.static_library_target | |
| 244 | |
| 245 bundle_data(_framework_binary_target) { | |
| 246 visibility = [ ":$_bundle_target_name" ] | |
| 247 sources = get_target_outputs(_static_library_target) | |
| 248 outputs = [ | |
| 249 "{{bundle_root_dir}}/$_framework_name", | |
| 250 ] | |
| 251 public_deps = [ | |
| 252 _static_library_target, | |
| 253 ] | |
| 254 } | |
| 255 | |
| 256 create_bundle(_bundle_target_name) { | |
| 257 product_type = "com.apple.product-type.framework" | |
| 258 bundle_root_dir = "$root_out_dir/Static/$_output_name" | |
| 259 bundle_executable_dir = bundle_root_dir | |
| 260 bundle_resources_dir = bundle_root_dir | |
| 261 bundle_plugins_dir = bundle_root_dir | |
| 262 deps = [ | |
| 263 ":$_framework_binary_target", | |
| 264 ":$_framework_headers_target", | |
| 265 ] | |
| 266 } | |
| 267 | |
| 268 action(_target_name) { | |
| 269 script = "//components/cronet/tools/dummy.py" | |
|
mef
2017/06/02 16:26:17
This dummy action is used to put output of |cronet
| |
| 270 outputs = [ | |
| 271 "$root_out_dir/Static/$_output_name", | |
| 272 ] | |
| 273 deps = [ | |
| 274 ":$_bundle_target_name", | |
| 275 ] | |
| 276 public_configs = invoker.public_configs | |
| 277 } | |
| 278 } | |
| 279 | |
| 280 ios_static_framework("cronet_static_framework") { | |
| 281 output_name = "Cronet.framework" | |
| 282 framework_name = "Cronet" | |
| 283 public_headers = _cronet_public_headers | |
| 284 static_library_target = ":libcronet" | |
|
mef
2017/06/02 16:26:17
Depending on lipo_binary target to produce fat sta
| |
| 285 public_configs = [ ":cronet_static_config" ] | |
| 286 } | |
| 287 | |
| 140 if (additional_toolchains == [] || current_toolchain == default_toolchain) { | 288 if (additional_toolchains == [] || current_toolchain == default_toolchain) { |
| 141 _package_dir = "$root_out_dir/cronet" | 289 _package_dir = "$root_out_dir/cronet" |
| 142 | 290 |
| 143 action("generate_license") { | 291 action("generate_license") { |
| 144 _license_path = "$_package_dir/LICENSE" | 292 _license_path = "$_package_dir/LICENSE" |
| 145 | 293 |
| 146 script = "//components/cronet/tools/cronet_licenses.py" | 294 script = "//components/cronet/tools/cronet_licenses.py" |
| 147 inputs = [ | 295 inputs = [ |
| 148 "//build/util/LASTCHANGE", | 296 "//build/util/LASTCHANGE", |
| 149 "//buildtools/$host_os/gn", | 297 "//buildtools/$host_os/gn", |
| 150 ] | 298 ] |
| 151 outputs = [ | 299 outputs = [ |
| 152 _license_path, | 300 _license_path, |
| 153 ] | 301 ] |
| 154 args = [ | 302 args = [ |
| 155 "license", | 303 "license", |
| 156 rebase_path(_license_path, root_build_dir), | 304 rebase_path(_license_path, root_build_dir), |
| 157 "--gn", | 305 "--gn", |
| 158 "--gn-path", | 306 "--gn-path", |
| 159 rebase_path("//buildtools/$host_os/gn", root_build_dir), | 307 rebase_path("//buildtools/$host_os/gn", root_build_dir), |
| 160 ] | 308 ] |
| 161 } | 309 } |
| 162 | 310 |
| 311 copy("cronet_static_copy") { | |
| 312 sources = [ | |
| 313 "$root_out_dir/Static/Cronet.framework", | |
| 314 ] | |
| 315 outputs = [ | |
| 316 "$_package_dir/Static/Cronet.framework", | |
| 317 ] | |
| 318 | |
| 319 deps = [ | |
| 320 ":cronet_static_framework", | |
| 321 ] | |
| 322 } | |
| 323 | |
| 163 copy("cronet_package_copy") { | 324 copy("cronet_package_copy") { |
| 164 sources = [ | 325 sources = [ |
| 165 "$root_out_dir/Cronet.framework", | 326 "$root_out_dir/Cronet.framework", |
| 166 "//AUTHORS", | 327 "//AUTHORS", |
| 167 "//chrome/VERSION", | 328 "//chrome/VERSION", |
| 168 ] | 329 ] |
| 169 outputs = [ | 330 outputs = [ |
| 170 "$_package_dir/{{source_file_part}}", | 331 "$_package_dir/{{source_file_part}}", |
| 171 ] | 332 ] |
| 172 | 333 |
| 173 deps = [ | 334 deps = [ |
| 174 ":cronet_framework", | 335 ":cronet_framework", |
| 336 ":cronet_static_copy", | |
| 175 ] | 337 ] |
| 176 } | 338 } |
| 177 | 339 |
| 178 if (enable_dsyms) { | 340 if (enable_dsyms) { |
| 179 action("cronet_dsym_archive") { | 341 action("cronet_dsym_archive") { |
| 180 script = "//chrome/tools/build/mac/archive_symbols.py" | 342 script = "//chrome/tools/build/mac/archive_symbols.py" |
| 181 | 343 |
| 182 # These are the dSYMs that will be archived. The sources list must be | 344 # These are the dSYMs that will be archived. The sources list must be |
| 183 # the target outputs that correspond to the dSYMs (since a dSYM is a | 345 # the target outputs that correspond to the dSYMs (since a dSYM is a |
| 184 # directory it cannot be listed as a source file). The targets that | 346 # directory it cannot be listed as a source file). The targets that |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 208 } | 370 } |
| 209 | 371 |
| 210 group("cronet_package") { | 372 group("cronet_package") { |
| 211 deps = [ | 373 deps = [ |
| 212 ":cronet_dsym_archive", | 374 ":cronet_dsym_archive", |
| 213 ":cronet_package_copy", | 375 ":cronet_package_copy", |
| 214 ":generate_license", | 376 ":generate_license", |
| 215 ] | 377 ] |
| 216 } | 378 } |
| 217 } | 379 } |
| OLD | NEW |