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") { | 35 source_set("cronet_sources") { |
36 include_dirs = [ "//components/grpc_support/include" ] | 36 deps = [ |
37 } | 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 ] |
38 | 49 |
39 config("cronet_static_config") { | 50 sources = [ |
40 libs = [ | 51 "../histogram_manager.cc", |
41 "Cronet.framework", | 52 "../histogram_manager.h", |
42 "UIKit.Framework", | 53 "../stale_host_resolver.cc", |
43 "CFNetwork.framework", | 54 "../stale_host_resolver.h", |
44 "MobileCoreServices.framework", | 55 "../url_request_context_config.cc", |
45 "Security.framework", | 56 "../url_request_context_config.h", |
46 "SystemConfiguration.framework", | 57 "Cronet.h", |
47 "resolv", | 58 "Cronet.mm", |
| 59 "cronet_c_for_grpc.h", |
| 60 "cronet_environment.h", |
| 61 "cronet_environment.mm", |
48 ] | 62 ] |
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 | |
86 source_set("cronet_sources") { | |
87 deps = _cronet_deps | |
88 | |
89 sources = _cronet_sources | |
90 | 63 |
91 include_dirs = [ "//components/grpc_support/include" ] | 64 include_dirs = [ "//components/grpc_support/include" ] |
92 | 65 |
93 if (!use_platform_icu_alternatives) { | 66 if (!use_platform_icu_alternatives) { |
94 deps += [ "//base:i18n" ] | 67 deps += [ "//base:i18n" ] |
95 } | 68 } |
96 } | 69 } |
97 | 70 |
98 # Tweak |info_plist| with current version and revision. | 71 # Tweak |info_plist| with current version and revision. |
99 tweak_info_plist("tweak_cronet_plist") { | 72 tweak_info_plist("tweak_cronet_plist") { |
100 info_plist = "Info.plist" | 73 info_plist = "Info.plist" |
101 } | 74 } |
102 | 75 |
103 ios_framework_bundle("cronet_framework") { | 76 ios_framework_bundle("cronet_framework") { |
104 output_name = "Cronet" | 77 output_name = "Cronet" |
105 info_plist_target = ":tweak_cronet_plist" | 78 info_plist_target = ":tweak_cronet_plist" |
106 | 79 |
107 deps = [ | 80 deps = [ |
108 ":cronet_sources", | 81 ":cronet_sources", |
109 "//base", | 82 "//base", |
110 "//net:net", | 83 "//net:net", |
111 ] | 84 ] |
112 | 85 |
113 libs = [ "UIKit.Framework" ] | 86 libs = [ "UIKit.Framework" ] |
114 | 87 |
| 88 include_dirs = [ "//components/grpc_support/include" ] |
| 89 |
115 public_deps = [ | 90 public_deps = [ |
116 "//components/grpc_support", | 91 "//components/grpc_support", |
117 ] | 92 ] |
118 | 93 |
119 public_headers = _cronet_public_headers | 94 public_headers = [ |
| 95 "Cronet.h", |
| 96 "cronet_c_for_grpc.h", |
| 97 ] |
| 98 public_headers += grpc_public_headers |
120 | 99 |
121 sources = [ | 100 sources = [ |
122 "Cronet.h", | 101 "Cronet.h", |
123 ] | 102 ] |
124 | 103 |
125 configs -= [ "//build/config/compiler:default_symbols" ] | 104 configs -= [ "//build/config/compiler:default_symbols" ] |
126 configs += [ "//build/config/compiler:symbols" ] | 105 configs += [ "//build/config/compiler:symbols" ] |
127 | |
128 public_configs = [ ":cronet_include_config" ] | |
129 } | 106 } |
130 | 107 |
131 test("cronet_unittests") { | 108 test("cronet_unittests") { |
132 testonly = true | 109 testonly = true |
133 | 110 |
134 sources = [ | 111 sources = [ |
135 "//components/cronet/histogram_manager_unittest.cc", | 112 "//components/cronet/histogram_manager_unittest.cc", |
136 "//components/cronet/run_all_unittests.cc", | 113 "//components/cronet/run_all_unittests.cc", |
137 "//components/cronet/stale_host_resolver_unittest.cc", | 114 "//components/cronet/stale_host_resolver_unittest.cc", |
138 "//components/cronet/url_request_context_config_unittest.cc", | 115 "//components/cronet/url_request_context_config_unittest.cc", |
(...skipping 14 matching lines...) Expand all Loading... |
153 script = "//components/cronet/tools/generate_accept_languages.py" | 130 script = "//components/cronet/tools/generate_accept_languages.py" |
154 args = [ | 131 args = [ |
155 rebase_path("$target_gen_dir"), | 132 rebase_path("$target_gen_dir"), |
156 rebase_path("//"), | 133 rebase_path("//"), |
157 ] | 134 ] |
158 outputs = [ | 135 outputs = [ |
159 "$target_gen_dir/accept_languages_table.h", | 136 "$target_gen_dir/accept_languages_table.h", |
160 ] | 137 ] |
161 } | 138 } |
162 | 139 |
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 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" | |
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" | |
285 public_configs = [ ":cronet_static_config" ] | |
286 } | |
287 | |
288 if (additional_toolchains == [] || current_toolchain == default_toolchain) { | 140 if (additional_toolchains == [] || current_toolchain == default_toolchain) { |
289 _package_dir = "$root_out_dir/cronet" | 141 _package_dir = "$root_out_dir/cronet" |
290 | 142 |
291 action("generate_license") { | 143 action("generate_license") { |
292 _license_path = "$_package_dir/LICENSE" | 144 _license_path = "$_package_dir/LICENSE" |
293 | 145 |
294 script = "//components/cronet/tools/cronet_licenses.py" | 146 script = "//components/cronet/tools/cronet_licenses.py" |
295 inputs = [ | 147 inputs = [ |
296 "//build/util/LASTCHANGE", | 148 "//build/util/LASTCHANGE", |
297 "//buildtools/$host_os/gn", | 149 "//buildtools/$host_os/gn", |
298 ] | 150 ] |
299 outputs = [ | 151 outputs = [ |
300 _license_path, | 152 _license_path, |
301 ] | 153 ] |
302 args = [ | 154 args = [ |
303 "license", | 155 "license", |
304 rebase_path(_license_path, root_build_dir), | 156 rebase_path(_license_path, root_build_dir), |
305 "--gn", | 157 "--gn", |
306 "--gn-path", | 158 "--gn-path", |
307 rebase_path("//buildtools/$host_os/gn", root_build_dir), | 159 rebase_path("//buildtools/$host_os/gn", root_build_dir), |
308 ] | 160 ] |
309 } | 161 } |
310 | 162 |
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 | |
324 copy("cronet_package_copy") { | 163 copy("cronet_package_copy") { |
325 sources = [ | 164 sources = [ |
326 "$root_out_dir/Cronet.framework", | 165 "$root_out_dir/Cronet.framework", |
327 "//AUTHORS", | 166 "//AUTHORS", |
328 "//chrome/VERSION", | 167 "//chrome/VERSION", |
329 ] | 168 ] |
330 outputs = [ | 169 outputs = [ |
331 "$_package_dir/{{source_file_part}}", | 170 "$_package_dir/{{source_file_part}}", |
332 ] | 171 ] |
333 | 172 |
334 deps = [ | 173 deps = [ |
335 ":cronet_framework", | 174 ":cronet_framework", |
336 ":cronet_static_copy", | |
337 ] | 175 ] |
338 } | 176 } |
339 | 177 |
340 if (enable_dsyms) { | 178 if (enable_dsyms) { |
341 action("cronet_dsym_archive") { | 179 action("cronet_dsym_archive") { |
342 script = "//chrome/tools/build/mac/archive_symbols.py" | 180 script = "//chrome/tools/build/mac/archive_symbols.py" |
343 | 181 |
344 # These are the dSYMs that will be archived. The sources list must be | 182 # These are the dSYMs that will be archived. The sources list must be |
345 # the target outputs that correspond to the dSYMs (since a dSYM is a | 183 # the target outputs that correspond to the dSYMs (since a dSYM is a |
346 # directory it cannot be listed as a source file). The targets that | 184 # directory it cannot be listed as a source file). The targets that |
(...skipping 23 matching lines...) Expand all Loading... |
370 } | 208 } |
371 | 209 |
372 group("cronet_package") { | 210 group("cronet_package") { |
373 deps = [ | 211 deps = [ |
374 ":cronet_dsym_archive", | 212 ":cronet_dsym_archive", |
375 ":cronet_package_copy", | 213 ":cronet_package_copy", |
376 ":generate_license", | 214 ":generate_license", |
377 ] | 215 ] |
378 } | 216 } |
379 } | 217 } |
OLD | NEW |