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 deps = _cronet_deps | |
166 | |
167 sources = _cronet_sources | |
168 | |
169 visibility = [ ":*" ] | |
170 | |
171 public_configs = [ ":cronet_include_config" ] | |
172 | |
173 public_deps = [ | |
174 "//components/grpc_support", | |
175 ] | |
176 } | |
177 | |
178 # A static library which contains all dependencies of :cronet_static. | |
179 static_library("cronet_deps_complete") { | |
180 visibility = [ ":*" ] | |
181 complete_static_lib = true | |
182 deps = [ | |
183 ":cronet_static", | |
184 ] | |
185 } | |
186 | |
187 # A static library which contains cronet and all dependendencies hidden inside. | |
188 action("cronet_static_complete") { | |
189 script = "//components/cronet/tools/hide_symbols.py" | |
190 deps = [ | |
191 ":cronet_deps_complete", | |
192 ":cronet_static", | |
193 ] | |
194 outputs = [ | |
195 "$target_out_dir/$current_cpu/cronet_static_complete.a", | |
196 ] | |
197 args = [ | |
198 "--input_libs", | |
199 rebase_path("$target_out_dir/libcronet_static.a", root_build_dir), | |
200 "--deps_lib", | |
201 rebase_path("$target_out_dir/libcronet_deps_complete.a", root_build_dir), | |
202 "--output_obj", | |
203 rebase_path("$target_out_dir/$current_cpu/cronet_static_complete.o", | |
204 root_build_dir), | |
205 "--output_lib", | |
206 rebase_path("$target_out_dir/$current_cpu/cronet_static_complete.a", | |
207 root_build_dir), | |
208 "--current_cpu", | |
209 current_cpu, | |
210 ] | |
211 | |
212 public_configs = [ ":cronet_static_config" ] | |
213 } | |
214 | |
215 # A fat static library which exports cronet public symbols and hides all depende ndencies. | |
216 lipo_binary("libcronet") { | |
217 arch_binary_target = ":cronet_static_complete" | |
218 arch_binary_output = "cronet_static_complete.a" | |
219 output_name = "libcronet.a" | |
220 enable_stripping = false | |
221 enable_dsyms = false | |
222 } | |
223 | |
224 bundle_data("cronet_static_headers") { | |
225 sources = _cronet_public_headers | |
226 outputs = [ | |
227 "{{bundle_root_dir}}/Headers/{{source_file_part}}", | |
228 ] | |
229 } | |
230 | |
231 bundle_data("cronet_static_binary") { | |
232 sources = get_target_outputs(":libcronet") | |
233 outputs = [ | |
234 "{{bundle_root_dir}}/Cronet", | |
kapishnikov
2017/05/23 21:37:46
Can we somehow parameterize the binary name? Targe
mef
2017/05/24 21:36:59
Done.
| |
235 ] | |
236 public_deps = [ | |
237 ":libcronet", | |
238 ] | |
239 } | |
240 | |
241 template("ios_static_framework") { | |
242 _target_name = target_name | |
243 _output_name = target_name | |
244 if (defined(invoker.output_name)) { | |
245 _output_name = invoker.output_name | |
246 } | |
247 _has_public_headers = | |
248 defined(invoker.public_headers) && invoker.public_headers != [] | |
249 _has_public_headers = defined(public_headers) && public_headers != [] | |
250 | |
251 #_default_toolchain_root_out_dir = | |
252 # get_label_info("$_target_name($default_toolchain)", "root_out_dir") | |
kapishnikov
2017/05/23 21:37:46
Should remove it before submitting if it is not ne
mef
2017/05/24 21:36:59
Done.
| |
253 | |
254 if (_has_public_headers) { | |
255 _framework_headers_target = _target_name + "_framework_headers" | |
256 _framework_headers_config = _target_name + "_framework_headers_config" | |
257 config(_framework_headers_config) { | |
258 # The link settings are inherited from the framework_bundle config. | |
259 cflags = [ | |
260 "-F", | |
261 rebase_path("$_default_toolchain_root_out_dir/.", root_build_dir), | |
262 ] | |
263 } | |
264 | |
265 _headers_map_config = _target_name + "_headers_map" | |
266 _header_map_filename = | |
267 "$_default_toolchain_target_gen_dir/$_output_name.headers.hmap" | |
268 config(_headers_map_config) { | |
269 visibility = [ ":$_target_name" ] | |
270 include_dirs = [ _header_map_filename ] | |
271 } | |
272 } | |
273 | |
274 create_bundle(_target_name) { | |
275 bundle_root_dir = "$root_out_dir/$_output_name" | |
276 deps = invoker.deps | |
277 } | |
278 } | |
279 | |
280 ios_static_framework("cronet_static_framework") { | |
281 # bundle_root_dir = "$root_out_dir/CronetStatic.framework" | |
kapishnikov
2017/05/23 21:37:46
Remove it if it is not needed.
mef
2017/05/24 21:36:59
Done.
| |
282 output_name = "CronetStatic.framework" | |
283 deps = [ | |
284 ":cronet_static_binary", | |
285 ":cronet_static_headers", | |
286 ] | |
287 } | |
288 | |
140 if (additional_toolchains == [] || current_toolchain == default_toolchain) { | 289 if (additional_toolchains == [] || current_toolchain == default_toolchain) { |
141 _package_dir = "$root_out_dir/cronet" | 290 _package_dir = "$root_out_dir/cronet" |
142 | 291 |
143 action("generate_license") { | 292 action("generate_license") { |
144 _license_path = "$_package_dir/LICENSE" | 293 _license_path = "$_package_dir/LICENSE" |
145 | 294 |
146 script = "//components/cronet/tools/cronet_licenses.py" | 295 script = "//components/cronet/tools/cronet_licenses.py" |
147 inputs = [ | 296 inputs = [ |
148 "//build/util/LASTCHANGE", | 297 "//build/util/LASTCHANGE", |
149 "//buildtools/$host_os/gn", | 298 "//buildtools/$host_os/gn", |
150 ] | 299 ] |
151 outputs = [ | 300 outputs = [ |
152 _license_path, | 301 _license_path, |
153 ] | 302 ] |
154 args = [ | 303 args = [ |
155 "license", | 304 "license", |
156 rebase_path(_license_path, root_build_dir), | 305 rebase_path(_license_path, root_build_dir), |
157 "--gn", | 306 "--gn", |
158 "--gn-path", | 307 "--gn-path", |
159 rebase_path("//buildtools/$host_os/gn", root_build_dir), | 308 rebase_path("//buildtools/$host_os/gn", root_build_dir), |
160 ] | 309 ] |
161 } | 310 } |
162 | 311 |
163 copy("cronet_package_copy") { | 312 copy("cronet_package_copy") { |
164 sources = [ | 313 sources = [ |
165 "$root_out_dir/Cronet.framework", | 314 "$root_out_dir/Cronet.framework", |
315 "$root_out_dir/CronetStatic.framework", | |
316 "$target_out_dir/libcronet.a", | |
166 "//AUTHORS", | 317 "//AUTHORS", |
167 "//chrome/VERSION", | 318 "//chrome/VERSION", |
168 ] | 319 ] |
169 outputs = [ | 320 outputs = [ |
170 "$_package_dir/{{source_file_part}}", | 321 "$_package_dir/{{source_file_part}}", |
171 ] | 322 ] |
172 | 323 |
173 deps = [ | 324 deps = [ |
174 ":cronet_framework", | 325 ":cronet_framework", |
326 ":cronet_static_framework", | |
327 ":libcronet", | |
175 ] | 328 ] |
176 } | 329 } |
177 | 330 |
178 if (enable_dsyms) { | 331 if (enable_dsyms) { |
179 action("cronet_dsym_archive") { | 332 action("cronet_dsym_archive") { |
180 script = "//chrome/tools/build/mac/archive_symbols.py" | 333 script = "//chrome/tools/build/mac/archive_symbols.py" |
181 | 334 |
182 # These are the dSYMs that will be archived. The sources list must be | 335 # 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 | 336 # 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 | 337 # directory it cannot be listed as a source file). The targets that |
(...skipping 23 matching lines...) Expand all Loading... | |
208 } | 361 } |
209 | 362 |
210 group("cronet_package") { | 363 group("cronet_package") { |
211 deps = [ | 364 deps = [ |
212 ":cronet_dsym_archive", | 365 ":cronet_dsym_archive", |
213 ":cronet_package_copy", | 366 ":cronet_package_copy", |
214 ":generate_license", | 367 ":generate_license", |
215 ] | 368 ] |
216 } | 369 } |
217 } | 370 } |
OLD | NEW |