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

Side by Side Diff: sdk/BUILD.gn

Issue 2875893002: [infra] Fix copy_tree.py to avoid extra rebuilding in Fuchsia (Closed)
Patch Set: Format 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/copy_tree.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 # Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 # for details. All rights reserved. Use of this source code is governed by a 2 # for details. All rights reserved. Use of this source code is governed by a
3 # BSD-style license that can be found in the LICENSE file. 3 # BSD-style license that can be found in the LICENSE file.
4 4
5 # The SDK for Fuchsia does not include: 5 # The SDK for Fuchsia does not include:
6 # dart2js 6 # dart2js
7 # dartdoc 7 # dartdoc
8 # ddc 8 # ddc
9 # and libraries that are browser-specific, since these are not used and require 9 # and libraries that are browser-specific, since these are not used and require
10 # significant time to build. 10 # significant time to build.
11 # TODO(zra): Assemble the SDK completely with GN, and remove create_sdk.py. 11 # TODO(zra): Assemble the SDK completely with GN, and remove create_sdk.py.
12 if (defined(is_fuchsia) && (is_fuchsia || is_fuchsia_host)) { 12 if (defined(is_fuchsia) && (is_fuchsia || is_fuchsia_host)) {
13 13 template("copy_tree") {
14 template("copy_tree") { 14 assert(defined(invoker.source), "copy_tree must define 'source'")
15 assert(defined(invoker.source), "copy_tree must define 'source'") 15 assert(defined(invoker.dest), "copy_tree must define 'dest'")
16 assert(defined(invoker.dest), "copy_tree must define 'dest'") 16 source = invoker.source
17 source = invoker.source 17 dest = invoker.dest
18 dest = invoker.dest 18 action(target_name) {
19 action(target_name) { 19 deps = []
20 deps = [] 20 if (defined(invoker.deps)) {
21 if (defined(invoker.deps)) { 21 deps += invoker.deps
22 deps += invoker.deps 22 }
23 } 23
24 input_files = exec_script("../tools/list_files.py", 24 common_args = [
25 [ 25 "--from",
26 "absolute", 26 rebase_path(source),
27 "", 27 "--to",
28 rebase_path(source), 28 rebase_path(dest),
29 ], 29 ]
30 "list lines") 30 if (defined(invoker.exclude)) {
31 inputs = input_files 31 common_args += [
32 relative_files = rebase_path(input_files, rebase_path(source)) 32 "--exclude",
33 33 invoker.exclude,
34 output_files = [] 34 ]
35 foreach(input, relative_files) { 35 }
36 output_files += ["$dest/$input"] 36
37 } 37 dry_run_args = common_args + [ "--dry-run" ]
38 38 input_files =
39 outputs = output_files 39 exec_script("../tools/copy_tree.py", dry_run_args, "list lines")
40 script = "../tools/copy_tree.py" 40 inputs = input_files
41 relative_files = rebase_path(input_files, rebase_path(source))
42
43 output_files = []
44 foreach(input, relative_files) {
45 output_files += [ "$dest/$input" ]
46 }
47
48 outputs = output_files
49 script = "../tools/copy_tree.py"
50 args = common_args
51 }
52 }
53
54 copy("copy_dart") {
55 deps = [
56 "../runtime/bin:dart",
57 ]
58 dart_out = get_label_info("../runtime/bin:dart", "root_out_dir")
59 dart_name = get_label_info("../runtime/bin:dart", "name")
60 sources = [
61 "$dart_out/$dart_name",
62 ]
63 outputs = [
64 "$root_out_dir/dart-sdk/bin/dart",
65 ]
66 }
67
68 copy("copy_dylibs") {
69 deps = [
70 "//third_party/boringssl:crypto",
71 "//third_party/boringssl:ssl",
72 ]
73 crypto_out =
74 get_label_info("//third_party/boringssl:crypto", "root_out_dir")
75 crypto_name = get_label_info("//third_party/boringssl:crypto", "name")
76 ssl_out = get_label_info("//third_party/boringssl:ssl", "root_out_dir")
77 ssl_name = get_label_info("//third_party/boringssl:ssl", "name")
78 sources = [
79 "$crypto_out/lib${crypto_name}.so",
80 "$ssl_out/lib${ssl_name}.so",
81 ]
82 outputs = [
83 "$root_out_dir/dart-sdk/bin/{{source_file_part}}",
84 ]
85 }
86
87 template("copy_sdk_script") {
88 assert(defined(invoker.name), "copy_sdk_script must define 'name'")
89 name = invoker.name
90 copy(target_name) {
91 sources = [
92 "bin/${name}_sdk",
93 ]
94 outputs = [
95 "$root_out_dir/dart-sdk/bin/${name}",
96 ]
97 }
98 }
99
100 _sdk_scripts = [
101 "dartanalyzer",
102 "dartfmt",
103 "pub",
104 ]
105
106 foreach(sdk_script, _sdk_scripts) {
107 copy_sdk_script("copy_${sdk_script}_script") {
108 name = sdk_script
109 }
110 }
111
112 group("copy_scripts") {
113 deps = [
114 ":copy_dartanalyzer_script",
115 ":copy_dartfmt_script",
116 ":copy_pub_script",
117 ]
118 }
119
120 _snapshots = [
121 [
122 "analysis_server",
123 "../utils/analysis_server",
124 ],
125 [
126 "dartanalyzer",
127 "../utils/dartanalyzer:generate_dartanalyzer_snapshot",
128 ],
129 [
130 "dartfmt",
131 "../utils/dartfmt",
132 ],
133 [
134 "pub",
135 "../utils/pub",
136 ],
137 ]
138
139 foreach(snapshot, _snapshots) {
140 copy("copy_${snapshot[0]}_snapshot") {
141 deps = [
142 snapshot[1],
143 ]
144 sources = [
145 "$root_gen_dir/${snapshot[0]}.dart.snapshot",
146 ]
147 outputs = [
148 "$root_out_dir/dart-sdk/bin/snapshots/{{source_file_part}}",
149 ]
150 }
151 }
152
153 group("copy_snapshots") {
154 deps = [
155 ":copy_analysis_server_snapshot",
156 ":copy_dartanalyzer_snapshot",
157 ":copy_dartfmt_snapshot",
158 ":copy_pub_snapshot",
159 ]
160 }
161
162 copy("copy_analysis_summaries") {
163 deps = [
164 ":copy_libraries",
165 "../utils/dartanalyzer:generate_summary_spec",
166 "../utils/dartanalyzer:generate_summary_strong",
167 ]
168 sources = [
169 "$root_gen_dir/spec.sum",
170 "$root_gen_dir/strong.sum",
171 ]
172 outputs = [
173 "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}",
174 ]
175 }
176
177 copy("copy_headers") {
178 sources = [
179 "../runtime/include/dart_api.h",
180 "../runtime/include/dart_mirrors_api.h",
181 "../runtime/include/dart_native_api.h",
182 "../runtime/include/dart_tools_api.h",
183 ]
184 outputs = [
185 "$root_out_dir/dart-sdk/include/{{source_file_part}}",
186 ]
187 }
188
189 copy("copy_platform_files") {
190 sources = [
191 "lib/dart_client.platform",
192 "lib/dart_server.platform",
193 "lib/dart_shared.platform",
194 ]
195 outputs = [
196 "$root_out_dir/dart-sdk/lib/{{source_file_part}}",
197 ]
198 }
199
200 copy_tree("copy_pub_assets") {
201 deps = [
202 ":copy_libraries",
203 ]
204 source = "../third_party/pkg/pub/lib/src/asset"
205 dest = "$root_out_dir/dart-sdk/lib/_internal/pub/asset"
206 }
207
208 _libraries = [
209 "_internal",
210 "async",
211 "collection",
212 "convert",
213 "core",
214 "developer",
215 "internal",
216 "io",
217 "isolate",
218 "math",
219 "mirrors",
220 "profiler",
221 "typed_data",
222 ]
223
224 foreach(library, _libraries) {
225 copy_tree("copy_${library}_library") {
226 source = "lib/$library"
227 dest = "$root_out_dir/dart-sdk/lib/$library"
228 exclude = "*.svn,doc,*.py,*.gypi,*.sh,.gitignore"
229 }
230 }
231
232 group("copy_libraries") {
233 deps = [
234 ":copy__internal_library",
235 ":copy_async_library",
236 ":copy_collection_library",
237 ":copy_convert_library",
238 ":copy_core_library",
239 ":copy_developer_library",
240 ":copy_internal_library",
241 ":copy_io_library",
242 ":copy_isolate_library",
243 ":copy_math_library",
244 ":copy_mirrors_library",
245 ":copy_profiler_library",
246 ":copy_typed_data_library",
247 ]
248 }
249
250 action("write_version_file") {
251 output = "$root_out_dir/dart-sdk/version"
252 outputs = [
253 output,
254 ]
255 script = "../tools/write_version_file.py"
41 args = [ 256 args = [
42 "--from", 257 "--output",
43 rebase_path(source), 258 rebase_path(output),
44 "--to", 259 ]
45 rebase_path(dest), 260 }
46 ] 261
47 if (defined(invoker.exclude)) { 262 action("write_revision_file") {
48 args += [ 263 output = "$root_out_dir/dart-sdk/revision"
49 "--exclude", 264 outputs = [
50 invoker.exclude, 265 output,
51 ] 266 ]
52 } 267 script = "../tools/write_revision_file.py"
268 args = [
269 "--output",
270 rebase_path(output),
271 ]
272 }
273
274 copy("copy_readme") {
275 sources = [
276 "../README.dart-sdk",
277 ]
278 outputs = [
279 "$root_out_dir/dart-sdk/README",
280 ]
281 }
282
283 copy("copy_license") {
284 sources = [
285 "../LICENSE",
286 ]
287 outputs = [
288 "$root_out_dir/dart-sdk/LICENSE",
289 ]
290 }
291
292 copy("copy_api_readme") {
293 sources = [
294 "api_readme.md",
295 ]
296 outputs = [
297 "$root_out_dir/dart-sdk/lib/api_readme.md",
298 ]
299 }
300
301 group("create_sdk") {
302 deps = [
303 ":copy_analysis_summaries",
304 ":copy_api_readme",
305 ":copy_dart",
306 ":copy_headers",
307 ":copy_libraries",
308 ":copy_license",
309 ":copy_platform_files",
310 ":copy_pub_assets",
311 ":copy_readme",
312 ":copy_scripts",
313 ":copy_snapshots",
314 ":write_revision_file",
315 ":write_version_file",
316 ]
317 if (is_fuchsia_host && is_linux) {
318 deps += [ ":copy_dylibs" ]
319 }
320 }
321 } else {
322 action("create_sdk") {
323 deps = [
324 "../runtime/bin:dart",
325 "../utils/analysis_server",
326 "../utils/compiler:dart2js",
327 "../utils/compiler:utils_wrapper",
328 "../utils/dartanalyzer:generate_dartanalyzer_snapshot",
329 "../utils/dartanalyzer:generate_summary_spec",
330 "../utils/dartanalyzer:generate_summary_strong",
331 "../utils/dartdevc",
332 "../utils/dartdoc",
333 "../utils/dartfmt",
334 "../utils/pub",
335 ]
336
337 sdk_lib_files = exec_script("../tools/list_dart_files.py",
338 [
339 "absolute",
340 rebase_path("lib"),
341 ],
342 "list lines")
343
344 preamble_files =
345 exec_script("../tools/list_files.py",
346 [
347 "absolute",
348 "",
349 rebase_path("lib/_internal/js_runtime/lib/preambles"),
350 ],
351 "list lines")
352
353 sdk_bin_files = exec_script("../tools/list_files.py",
354 [
355 "absolute",
356 "",
357 rebase_path("bin"),
358 ],
359 "list lines")
360
361 inputs = sdk_lib_files + preamble_files + sdk_bin_files + [
362 "lib/dart_client.platform",
363 "lib/dart_server.platform",
364 "lib/dart_shared.platform",
365 "$root_gen_dir/dart2js.dart.snapshot",
366 "$root_gen_dir/utils_wrapper.dart.snapshot",
367 "$root_gen_dir/pub.dart.snapshot",
368 "$root_gen_dir/dartanalyzer.dart.snapshot",
369 "$root_gen_dir/dartdevc.dart.snapshot",
370 "$root_gen_dir/dartfmt.dart.snapshot",
371 "$root_gen_dir/analysis_server.dart.snapshot",
372 "$root_gen_dir/dartdoc.dart.snapshot",
373 "$root_gen_dir/spec.sum",
374 "$root_gen_dir/strong.sum",
375 "../tools/VERSION",
376 ]
377
378 outputs = [
379 "$root_out_dir/dart-sdk/README",
380 ]
381
382 script = "../tools/create_sdk.py"
383 args = [
384 "--sdk_output_dir",
385 rebase_path("$root_out_dir/dart-sdk"),
386 "--snapshot_location",
387 rebase_path("$root_gen_dir"),
388 ]
53 } 389 }
54 } 390 }
55
56 copy("copy_dart") {
57 deps = [ "../runtime/bin:dart" ]
58 dart_out = get_label_info("../runtime/bin:dart", "root_out_dir")
59 dart_name = get_label_info("../runtime/bin:dart", "name")
60 sources = [ "$dart_out/$dart_name" ]
61 outputs = [ "$root_out_dir/dart-sdk/bin/dart" ]
62 }
63
64 copy("copy_dylibs") {
65 deps = [
66 "//third_party/boringssl:crypto",
67 "//third_party/boringssl:ssl",
68 ]
69 crypto_out = get_label_info("//third_party/boringssl:crypto", "root_out_dir")
70 crypto_name = get_label_info("//third_party/boringssl:crypto", "name")
71 ssl_out = get_label_info("//third_party/boringssl:ssl", "root_out_dir")
72 ssl_name = get_label_info("//third_party/boringssl:ssl", "name")
73 sources = [
74 "$crypto_out/lib${crypto_name}.so",
75 "$ssl_out/lib${ssl_name}.so"
76 ]
77 outputs = [ "$root_out_dir/dart-sdk/bin/{{source_file_part}}" ]
78 }
79
80 template("copy_sdk_script") {
81 assert(defined(invoker.name), "copy_sdk_script must define 'name'")
82 name = invoker.name
83 copy(target_name) {
84 sources = [ "bin/${name}_sdk" ]
85 outputs = [ "$root_out_dir/dart-sdk/bin/${name}"]
86 }
87 }
88
89 _sdk_scripts = [
90 "dartanalyzer",
91 "dartfmt",
92 "pub",
93 ]
94
95 foreach(sdk_script, _sdk_scripts) {
96 copy_sdk_script("copy_${sdk_script}_script") {
97 name = sdk_script
98 }
99 }
100
101 group("copy_scripts") {
102 deps = [
103 ":copy_dartanalyzer_script",
104 ":copy_dartfmt_script",
105 ":copy_pub_script",
106 ]
107 }
108
109 _snapshots = [
110 ["analysis_server", "../utils/analysis_server"],
111 ["dartanalyzer", "../utils/dartanalyzer:generate_dartanalyzer_snapshot"],
112 ["dartfmt", "../utils/dartfmt"],
113 ["pub", "../utils/pub"],
114 ]
115
116 foreach(snapshot, _snapshots) {
117 copy("copy_${snapshot[0]}_snapshot") {
118 deps = [
119 snapshot[1],
120 ]
121 sources = [ "$root_gen_dir/${snapshot[0]}.dart.snapshot" ]
122 outputs = [ "$root_out_dir/dart-sdk/bin/snapshots/{{source_file_part}}" ]
123 }
124 }
125
126 group("copy_snapshots") {
127 deps = [
128 ":copy_analysis_server_snapshot",
129 ":copy_dartanalyzer_snapshot",
130 ":copy_dartfmt_snapshot",
131 ":copy_pub_snapshot",
132 ]
133 }
134
135 copy("copy_analysis_summaries") {
136 deps = [
137 ":copy_libraries",
138 "../utils/dartanalyzer:generate_summary_spec",
139 "../utils/dartanalyzer:generate_summary_strong",
140 ]
141 sources = [
142 "$root_gen_dir/spec.sum",
143 "$root_gen_dir/strong.sum",
144 ]
145 outputs = [ "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}" ]
146 }
147
148 copy("copy_headers") {
149 sources = [
150 "../runtime/include/dart_api.h",
151 "../runtime/include/dart_mirrors_api.h",
152 "../runtime/include/dart_native_api.h",
153 "../runtime/include/dart_tools_api.h",
154 ]
155 outputs = [ "$root_out_dir/dart-sdk/include/{{source_file_part}}" ]
156 }
157
158 copy("copy_platform_files") {
159 sources = [
160 "lib/dart_client.platform",
161 "lib/dart_server.platform",
162 "lib/dart_shared.platform",
163 ]
164 outputs = [ "$root_out_dir/dart-sdk/lib/{{source_file_part}}" ]
165 }
166
167 copy_tree("copy_pub_assets") {
168 deps = [ ":copy_libraries" ]
169 source = "../third_party/pkg/pub/lib/src/asset"
170 dest = "$root_out_dir/dart-sdk/lib/_internal/pub/asset"
171 }
172
173 _libraries = [
174 "_internal",
175 "async",
176 "collection",
177 "convert",
178 "core",
179 "developer",
180 "internal",
181 "io",
182 "isolate",
183 "math",
184 "mirrors",
185 "profiler",
186 "typed_data",
187 ]
188
189 foreach(library, _libraries) {
190 copy_tree("copy_${library}_library") {
191 source = "lib/$library"
192 dest = "$root_out_dir/dart-sdk/lib/$library"
193 exclude = "*.svn,doc,*.py,*.gypi,*.sh,.gitignore"
194 }
195 }
196
197 group("copy_libraries") {
198 deps = [
199 ":copy__internal_library",
200 ":copy_async_library",
201 ":copy_collection_library",
202 ":copy_convert_library",
203 ":copy_core_library",
204 ":copy_developer_library",
205 ":copy_internal_library",
206 ":copy_io_library",
207 ":copy_isolate_library",
208 ":copy_math_library",
209 ":copy_mirrors_library",
210 ":copy_profiler_library",
211 ":copy_typed_data_library",
212 ]
213 }
214
215 action("write_version_file") {
216 output = "$root_out_dir/dart-sdk/version"
217 outputs = [ output ]
218 script = "../tools/write_version_file.py"
219 args = [
220 "--output",
221 rebase_path(output),
222 ]
223 }
224
225 action("write_revision_file") {
226 output = "$root_out_dir/dart-sdk/revision"
227 outputs = [ output ]
228 script = "../tools/write_revision_file.py"
229 args = [
230 "--output",
231 rebase_path(output)
232 ]
233 }
234
235 copy("copy_readme") {
236 sources = [ "../README.dart-sdk" ]
237 outputs = [ "$root_out_dir/dart-sdk/README" ]
238 }
239
240
241 copy("copy_license") {
242 sources = [ "../LICENSE" ]
243 outputs = [ "$root_out_dir/dart-sdk/LICENSE" ]
244 }
245
246
247 copy("copy_api_readme") {
248 sources = [ "api_readme.md" ]
249 outputs = [ "$root_out_dir/dart-sdk/lib/api_readme.md" ]
250 }
251
252
253 group("create_sdk") {
254 deps = [
255 ":copy_analysis_summaries",
256 ":copy_api_readme",
257 ":copy_dart",
258 ":copy_headers",
259 ":copy_libraries",
260 ":copy_license",
261 ":copy_platform_files",
262 ":copy_pub_assets",
263 ":copy_readme",
264 ":copy_scripts",
265 ":copy_snapshots",
266 ":write_revision_file",
267 ":write_version_file",
268 ]
269 if (is_fuchsia_host && is_linux) {
270 deps += [ ":copy_dylibs" ]
271 }
272 }
273
274 } else {
275
276 action("create_sdk") {
277 deps = [
278 "../runtime/bin:dart",
279 "../utils/analysis_server",
280 "../utils/compiler:dart2js",
281 "../utils/compiler:utils_wrapper",
282 "../utils/dartanalyzer:generate_dartanalyzer_snapshot",
283 "../utils/dartanalyzer:generate_summary_spec",
284 "../utils/dartanalyzer:generate_summary_strong",
285 "../utils/dartdevc",
286 "../utils/dartdoc",
287 "../utils/dartfmt",
288 "../utils/pub",
289 ]
290
291 sdk_lib_files = exec_script("../tools/list_dart_files.py",
292 [
293 "absolute",
294 rebase_path("lib"),
295 ],
296 "list lines")
297
298 preamble_files =
299 exec_script("../tools/list_files.py",
300 [
301 "absolute",
302 "",
303 rebase_path("lib/_internal/js_runtime/lib/preambles"),
304 ],
305 "list lines")
306
307 sdk_bin_files = exec_script("../tools/list_files.py",
308 [
309 "absolute",
310 "",
311 rebase_path("bin"),
312 ],
313 "list lines")
314
315 inputs = sdk_lib_files + preamble_files + sdk_bin_files + [
316 "lib/dart_client.platform",
317 "lib/dart_server.platform",
318 "lib/dart_shared.platform",
319 "$root_gen_dir/dart2js.dart.snapshot",
320 "$root_gen_dir/utils_wrapper.dart.snapshot",
321 "$root_gen_dir/pub.dart.snapshot",
322 "$root_gen_dir/dartanalyzer.dart.snapshot",
323 "$root_gen_dir/dartdevc.dart.snapshot",
324 "$root_gen_dir/dartfmt.dart.snapshot",
325 "$root_gen_dir/analysis_server.dart.snapshot",
326 "$root_gen_dir/dartdoc.dart.snapshot",
327 "$root_gen_dir/spec.sum",
328 "$root_gen_dir/strong.sum",
329 "../tools/VERSION",
330 ]
331
332 outputs = [
333 "$root_out_dir/dart-sdk/README",
334 ]
335
336 script = "../tools/create_sdk.py"
337 args = [
338 "--sdk_output_dir",
339 rebase_path("$root_out_dir/dart-sdk"),
340 "--snapshot_location",
341 rebase_path("$root_gen_dir"),
342 ]
343 }
344
345 }
OLDNEW
« no previous file with comments | « no previous file | tools/copy_tree.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698