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 "CronetStatic.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), |
| 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 bundle_data("cronet_static_headers") { |
| 222 sources = _cronet_public_headers |
| 223 outputs = [ |
| 224 "{{bundle_root_dir}}/Headers/{{source_file_part}}", |
| 225 ] |
| 226 } |
| 227 |
| 228 bundle_data("cronet_static_binary") { |
| 229 sources = get_target_outputs(":libcronet") |
| 230 outputs = [ |
| 231 "{{bundle_root_dir}}/Cronet", |
| 232 ] |
| 233 public_deps = [ |
| 234 ":libcronet", |
| 235 ] |
| 236 } |
| 237 |
| 238 template("ios_static_framework") { |
| 239 _target_name = target_name |
| 240 _output_name = target_name |
| 241 if (defined(invoker.output_name)) { |
| 242 _output_name = invoker.output_name |
| 243 } |
| 244 _has_public_headers = |
| 245 defined(invoker.public_headers) && invoker.public_headers != [] |
| 246 _has_public_headers = defined(public_headers) && public_headers != [] |
| 247 |
| 248 #_default_toolchain_root_out_dir = |
| 249 # get_label_info("$_target_name($default_toolchain)", "root_out_dir") |
| 250 |
| 251 if (_has_public_headers) { |
| 252 _framework_headers_target = _target_name + "_framework_headers" |
| 253 _framework_headers_config = _target_name + "_framework_headers_config" |
| 254 config(_framework_headers_config) { |
| 255 # The link settings are inherited from the framework_bundle config. |
| 256 cflags = [ |
| 257 "-F", |
| 258 rebase_path("$_default_toolchain_root_out_dir/.", root_build_dir), |
| 259 ] |
| 260 } |
| 261 |
| 262 _headers_map_config = _target_name + "_headers_map" |
| 263 _header_map_filename = |
| 264 "$_default_toolchain_target_gen_dir/$_output_name.headers.hmap" |
| 265 config(_headers_map_config) { |
| 266 visibility = [ ":$_target_name" ] |
| 267 include_dirs = [ _header_map_filename ] |
| 268 } |
| 269 } |
| 270 |
| 271 create_bundle(_target_name) { |
| 272 bundle_root_dir = "$root_out_dir/$_output_name" |
| 273 deps = invoker.deps |
| 274 } |
| 275 } |
| 276 |
| 277 ios_static_framework("cronet_static_framework") { |
| 278 output_name = "CronetStatic.framework" |
| 279 deps = [ |
| 280 ":cronet_static_binary", |
| 281 ":cronet_static_headers", |
| 282 ] |
| 283 } |
| 284 |
140 if (additional_toolchains == [] || current_toolchain == default_toolchain) { | 285 if (additional_toolchains == [] || current_toolchain == default_toolchain) { |
141 _package_dir = "$root_out_dir/cronet" | 286 _package_dir = "$root_out_dir/cronet" |
142 | 287 |
143 action("generate_license") { | 288 action("generate_license") { |
144 _license_path = "$_package_dir/LICENSE" | 289 _license_path = "$_package_dir/LICENSE" |
145 | 290 |
146 script = "//components/cronet/tools/cronet_licenses.py" | 291 script = "//components/cronet/tools/cronet_licenses.py" |
147 inputs = [ | 292 inputs = [ |
148 "//build/util/LASTCHANGE", | 293 "//build/util/LASTCHANGE", |
149 "//buildtools/$host_os/gn", | 294 "//buildtools/$host_os/gn", |
150 ] | 295 ] |
151 outputs = [ | 296 outputs = [ |
152 _license_path, | 297 _license_path, |
153 ] | 298 ] |
154 args = [ | 299 args = [ |
155 "license", | 300 "license", |
156 rebase_path(_license_path, root_build_dir), | 301 rebase_path(_license_path, root_build_dir), |
157 "--gn", | 302 "--gn", |
158 "--gn-path", | 303 "--gn-path", |
159 rebase_path("//buildtools/$host_os/gn", root_build_dir), | 304 rebase_path("//buildtools/$host_os/gn", root_build_dir), |
160 ] | 305 ] |
161 } | 306 } |
162 | 307 |
163 copy("cronet_package_copy") { | 308 copy("cronet_package_copy") { |
164 sources = [ | 309 sources = [ |
165 "$root_out_dir/Cronet.framework", | 310 "$root_out_dir/Cronet.framework", |
| 311 "$root_out_dir/CronetStatic.framework", |
| 312 "$target_out_dir/libcronet.a", |
166 "//AUTHORS", | 313 "//AUTHORS", |
167 "//chrome/VERSION", | 314 "//chrome/VERSION", |
168 ] | 315 ] |
169 outputs = [ | 316 outputs = [ |
170 "$_package_dir/{{source_file_part}}", | 317 "$_package_dir/{{source_file_part}}", |
171 ] | 318 ] |
172 | 319 |
173 deps = [ | 320 deps = [ |
174 ":cronet_framework", | 321 ":cronet_framework", |
| 322 ":cronet_static_framework", |
| 323 ":libcronet", |
175 ] | 324 ] |
176 } | 325 } |
177 | 326 |
178 if (enable_dsyms) { | 327 if (enable_dsyms) { |
179 action("cronet_dsym_archive") { | 328 action("cronet_dsym_archive") { |
180 script = "//chrome/tools/build/mac/archive_symbols.py" | 329 script = "//chrome/tools/build/mac/archive_symbols.py" |
181 | 330 |
182 # These are the dSYMs that will be archived. The sources list must be | 331 # 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 | 332 # 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 | 333 # directory it cannot be listed as a source file). The targets that |
(...skipping 23 matching lines...) Expand all Loading... |
208 } | 357 } |
209 | 358 |
210 group("cronet_package") { | 359 group("cronet_package") { |
211 deps = [ | 360 deps = [ |
212 ":cronet_dsym_archive", | 361 ":cronet_dsym_archive", |
213 ":cronet_package_copy", | 362 ":cronet_package_copy", |
214 ":generate_license", | 363 ":generate_license", |
215 ] | 364 ] |
216 } | 365 } |
217 } | 366 } |
OLD | NEW |