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

Side by Side Diff: sdk/BUILD.gn

Issue 2992353002: Invoke copy_tree.py only once to collect all input file lists. (Closed)
Patch Set: Created 3 years, 4 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 | « build/copy_tree.gni ('k') | 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 # This GN file contains build rules for assembling the Dart SDK. There are 5 # This GN file contains build rules for assembling the Dart SDK. There are
6 # two possible variants: the "Full" SDK, and the "Platform" SDK. If you want 6 # two possible variants: the "Full" SDK, and the "Platform" SDK. If you want
7 # to make a new subset of the Full SDK, make it the same way we make 7 # to make a new subset of the Full SDK, make it the same way we make
8 # the Platform SDK. 8 # the Platform SDK.
9 # 9 #
10 # Warning: 10 # Warning:
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 ] 208 ]
209 209
210 # Package sources copied to lib/ 210 # Package sources copied to lib/
211 _analyzer_source_dirs = [ 211 _analyzer_source_dirs = [
212 "analyzer", 212 "analyzer",
213 "analysis_server", 213 "analysis_server",
214 "front_end", 214 "front_end",
215 "kernel", 215 "kernel",
216 ] 216 ]
217 217
218 # copy_trees() arranges to invoke copy_tree.py only once to gather the list of
219 # input source files for every copy_tree() target. It takes a list of scopes as
220 # a parameter. The scopes should contain the following mappings.
221 #
222 # target: The target name for the copy_tree() target.
223 # visibility: The visibility for the copy_tree() target.
224 # source: The source directory relative to this directory.
225 # dest: The destination directory for the copy_tree() target.
226 # deps: Any deps needed for the copy_tree() target.
227 # ignore_patterns: Patterns to ignore when walking the directory tree.
228 # This should be '{}' if nothing should be ignored.
229 #
230 # copy_trees() will then make sure each invocation of copy_tree() has the
231 # correct 'inputs' parameter
232 template("copy_trees") {
zra 2017/08/09 18:05:01 I moved this to copy_tree.gni
233 assert(defined(invoker.sources), "$target_name must define 'source'")
234 sources = invoker.sources
235 copy_tree_source_paths = []
236 foreach(copy_tree_spec, sources) {
237 copy_tree_source_paths += [
238 rebase_path(copy_tree_spec.source),
239 copy_tree_spec.ignore_patterns
240 ]
241 }
242 # A scope containing a single value "sources"
rmacnak 2017/08/07 22:20:19 Evaluate script output as GN, producing a scope...
zra 2017/08/09 18:05:01 Done.
243 copy_tree_inputs_scope = exec_script("../tools/copy_tree.py",
244 ["--gn"] + copy_tree_source_paths,
245 "scope")
246 # A list of lists of input source files for copy_tree.
247 copy_tree_inputs = copy_tree_inputs_scope.sources
248 copy_tree_inputs_index = 0
249 foreach(copy_tree_spec, sources) {
250 copy_tree(copy_tree_spec.target) {
251 visibility = copy_tree_spec.visibility
252 source = copy_tree_spec.source
253 dest = copy_tree_spec.dest
254 inputs = copy_tree_inputs[copy_tree_inputs_index]
255 if (defined(copy_tree_spec.deps)) {
256 deps = copy_tree_spec.deps
257 }
258 if (copy_tree_spec.ignore_patterns != "{}") {
259 exclude = copy_tree_spec.ignore_patterns
260 }
261 }
262 copy_tree_inputs_index = copy_tree_inputs_index + 1
263 }
264 }
265
266 # From here down to the copy_trees() invocation, we collect all the information
267 # about trees that need to be copied in the list of scopes, copy_tree_specs.
268 copy_tree_specs = []
269
270 # This loop generates rules for copying analyzer sources into lib/
271 foreach(analyzer_source_dir, _analyzer_source_dirs) {
272 copy_tree_specs += [{
273 target = "copy_${analyzer_source_dir}_source_dir"
274 visibility = [ ":copy_analyzer_sources" ]
275 source = "../pkg/$analyzer_source_dir"
276 dest = "$root_out_dir/dart-sdk/lib/$analyzer_source_dir"
277 ignore_patterns = "*.svn,doc,*.py,*.gypi,*.sh,.gitignore,packages,test,testc ases"
278 }]
279 }
280
281 # This rule copies dartdoc templates to
282 # bin/snapshots/resources/dartdoc/templates
283 copy_tree_specs += [{
284 target = "copy_dartdoc_templates"
285 visibility = [ ":copy_dartdoc_files" ]
286 source = "../third_party/pkg/dartdoc/lib/templates"
287 dest = "$root_out_dir/dart-sdk/bin/snapshots/resources/dartdoc/templates"
288 ignore_patterns = "{}"
289 }]
290
291 # This rule copies dartdoc resources to
292 # bin/snapshots/resources/dartdoc/resources
293 copy_tree_specs += [{
294 target = "copy_dartdoc_resources"
295 visibility = [ ":copy_dartdoc_files" ]
296 source = "../third_party/pkg/dartdoc/lib/resources"
297 dest = "$root_out_dir/dart-sdk/bin/snapshots/resources/dartdoc/resources"
298 ignore_patterns = "{}"
299 }]
300
301 # This rule copies js needed by ddc to lib/dev_compiler
302 copy_tree_specs += [{
303 target = "copy_dev_compiler_js"
304 visibility = [
305 ":copy_dev_compiler_sdk",
306 ":copy_dev_compiler_require_js",
307 ":copy_dev_compiler_tools",
308 ]
309 source = "../pkg/dev_compiler/lib/js"
310 dest = "$root_out_dir/dart-sdk/lib/dev_compiler"
311 ignore_patterns = "{}"
312 }]
313
314 # This rule copies pub assets to lib/_internal/pub/asset
315 copy_tree_specs += [{
316 target = "copy_pub_assets"
317 visibility = [
318 ":create_common_sdk",
319 ":copy_7zip",
320 ]
321 deps = [
322 ":copy_libraries",
323 ]
324 source = "../third_party/pkg/pub/lib/src/asset"
325 dest = "$root_out_dir/dart-sdk/lib/_internal/pub/asset"
326 ignore_patterns = "{}"
327 }]
328
329 # This loop generates rules to copy libraries to lib/
330 foreach(library, _full_sdk_libraries) {
331 copy_tree_specs += [{
332 target = "copy_${library}_library"
333 visibility = [
334 ":copy_platform_sdk_libraries",
335 ":copy_full_sdk_libraries",
336 ]
337 source = "lib/$library"
338 dest = "$root_out_dir/dart-sdk/lib/$library"
339 ignore_patterns = "*.svn,doc,*.py,*.gypi,*.sh,.gitignore"
340 }]
341 }
342
343 if (is_win) {
344 copy_tree_specs += [{
345 target = "copy_7zip"
346 visibility = [ ":create_common_sdk" ]
347 deps = [
348 ":copy_libraries",
349 ":copy_pub_assets",
350 ]
351 source = "../third_party/7zip"
352 dest = "$root_out_dir/dart-sdk/lib/_internal/pub/asset/7zip"
353 ignore_patterns = ".svn"
354 }]
355 }
356
357 # This generates all of the copy_tree() targets.
358 copy_trees("copy_trees") {
359 sources = copy_tree_specs
360 }
361
218 # Copies the Dart VM binary into bin/ 362 # Copies the Dart VM binary into bin/
219 copy("copy_dart") { 363 copy("copy_dart") {
220 visibility = [ ":create_common_sdk" ] 364 visibility = [ ":create_common_sdk" ]
221 deps = [ 365 deps = [
222 "../runtime/bin:dart", 366 "../runtime/bin:dart",
223 ] 367 ]
224 dart_out = get_label_info("../runtime/bin:dart", "root_out_dir") 368 dart_out = get_label_info("../runtime/bin:dart", "root_out_dir")
225 if (is_win) { 369 if (is_win) {
226 sources = [ 370 sources = [
227 "$dart_out/dart.exe", 371 "$dart_out/dart.exe",
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 # This is the main rule for copying snapshots from _full_sdk_snapshots to 518 # This is the main rule for copying snapshots from _full_sdk_snapshots to
375 # bin/snapshots 519 # bin/snapshots
376 group("copy_full_sdk_snapshots") { 520 group("copy_full_sdk_snapshots") {
377 visibility = [ ":create_full_sdk" ] 521 visibility = [ ":create_full_sdk" ]
378 deps = [] 522 deps = []
379 foreach(snapshot, _full_sdk_snapshots) { 523 foreach(snapshot, _full_sdk_snapshots) {
380 deps += [ ":copy_${snapshot[0]}_snapshot" ] 524 deps += [ ":copy_${snapshot[0]}_snapshot" ]
381 } 525 }
382 } 526 }
383 527
384 # This loop generates rules for copying analyzer sources into lib/
385 foreach(analyzer_source_dir, _analyzer_source_dirs) {
386 copy_tree("copy_${analyzer_source_dir}_source_dir") {
387 visibility = [ ":copy_analyzer_sources" ]
388 source = "../pkg/$analyzer_source_dir"
389 dest = "$root_out_dir/dart-sdk/lib/$analyzer_source_dir"
390 exclude = "*.svn,doc,*.py,*.gypi,*.sh,.gitignore,packages,test,testcases"
391 }
392 }
393
394 # This is the main rule for copying analyzer sources to lib/ 528 # This is the main rule for copying analyzer sources to lib/
395 group("copy_analyzer_sources") { 529 group("copy_analyzer_sources") {
396 visibility = [ ":create_common_sdk" ] 530 visibility = [ ":create_common_sdk" ]
397 deps = [] 531 deps = []
398 foreach(analyzer_source_dir, _analyzer_source_dirs) { 532 foreach(analyzer_source_dir, _analyzer_source_dirs) {
399 deps += [ ":copy_${analyzer_source_dir}_source_dir" ] 533 deps += [ ":copy_${analyzer_source_dir}_source_dir" ]
400 } 534 }
401 } 535 }
402 536
403 # This rule copies dartdoc templates to
404 # bin/snapshots/resources/dartdoc/templates
405 copy_tree("copy_dartdoc_templates") {
406 visibility = [ ":copy_dartdoc_files" ]
407 source = "../third_party/pkg/dartdoc/lib/templates"
408 dest = "$root_out_dir/dart-sdk/bin/snapshots/resources/dartdoc/templates"
409 }
410
411 # This rule copies dartdoc resources to
412 # bin/snapshots/resources/dartdoc/resources
413 copy_tree("copy_dartdoc_resources") {
414 visibility = [ ":copy_dartdoc_files" ]
415 source = "../third_party/pkg/dartdoc/lib/resources"
416 dest = "$root_out_dir/dart-sdk/bin/snapshots/resources/dartdoc/resources"
417 }
418
419 # This rule writes the .packages file for dartdoc resources. 537 # This rule writes the .packages file for dartdoc resources.
420 write_file("$root_out_dir/dart-sdk/bin/snapshots/resources/dartdoc/.packages", 538 write_file("$root_out_dir/dart-sdk/bin/snapshots/resources/dartdoc/.packages",
421 "dartdoc:.") 539 "dartdoc:.")
422 540
423 # This is the main rule for copying the files that dartdoc needs. 541 # This is the main rule for copying the files that dartdoc needs.
424 group("copy_dartdoc_files") { 542 group("copy_dartdoc_files") {
425 visibility = [ ":create_common_sdk" ] 543 visibility = [ ":create_common_sdk" ]
426 deps = [ 544 deps = [
427 ":copy_dartdoc_resources", 545 ":copy_dartdoc_resources",
428 ":copy_dartdoc_templates", 546 ":copy_dartdoc_templates",
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 ":copy_libraries", 601 ":copy_libraries",
484 ] 602 ]
485 sources = [ 603 sources = [
486 "../pkg/dev_compiler/lib/sdk/ddc_sdk.sum", 604 "../pkg/dev_compiler/lib/sdk/ddc_sdk.sum",
487 ] 605 ]
488 outputs = [ 606 outputs = [
489 "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}", 607 "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}",
490 ] 608 ]
491 } 609 }
492 610
493 # This rule copies js needed by ddc to lib/dev_compiler
494 copy_tree("copy_dev_compiler_js") {
495 visibility = [
496 ":copy_dev_compiler_sdk",
497 ":copy_dev_compiler_require_js",
498 ":copy_dev_compiler_tools",
499 ]
500 source = "../pkg/dev_compiler/lib/js"
501 dest = "$root_out_dir/dart-sdk/lib/dev_compiler"
502 }
503
504 # This rule copies require.js to lib/dev_compiler/amd 611 # This rule copies require.js to lib/dev_compiler/amd
505 copy("copy_dev_compiler_require_js") { 612 copy("copy_dev_compiler_require_js") {
506 visibility = [ ":copy_dev_compiler_sdk" ] 613 visibility = [ ":copy_dev_compiler_sdk" ]
507 deps = [ 614 deps = [
508 ":copy_dev_compiler_js", 615 ":copy_dev_compiler_js",
509 ] 616 ]
510 sources = [ 617 sources = [
511 "../third_party/requirejs/require.js", 618 "../third_party/requirejs/require.js",
512 ] 619 ]
513 outputs = [ 620 outputs = [
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 sources = [ 671 sources = [
565 "lib/dart_client.platform", 672 "lib/dart_client.platform",
566 "lib/dart_server.platform", 673 "lib/dart_server.platform",
567 "lib/dart_shared.platform", 674 "lib/dart_shared.platform",
568 ] 675 ]
569 outputs = [ 676 outputs = [
570 "$root_out_dir/dart-sdk/lib/{{source_file_part}}", 677 "$root_out_dir/dart-sdk/lib/{{source_file_part}}",
571 ] 678 ]
572 } 679 }
573 680
574 # This rule copies pub assets to lib/_internal/pub/asset
575 copy_tree("copy_pub_assets") {
576 visibility = [
577 ":create_common_sdk",
578 ":copy_7zip",
579 ]
580 deps = [
581 ":copy_libraries",
582 ]
583 source = "../third_party/pkg/pub/lib/src/asset"
584 dest = "$root_out_dir/dart-sdk/lib/_internal/pub/asset"
585 }
586
587 # This loop generates rules to copy libraries to lib/
588 foreach(library, _full_sdk_libraries) {
589 copy_tree("copy_${library}_library") {
590 visibility = [
591 ":copy_platform_sdk_libraries",
592 ":copy_full_sdk_libraries",
593 ]
594 source = "lib/$library"
595 dest = "$root_out_dir/dart-sdk/lib/$library"
596 exclude = "*.svn,doc,*.py,*.gypi,*.sh,.gitignore"
597 }
598 }
599
600 # This is the main rule to copy libraries in _platform_sdk_libraries to lib/ 681 # This is the main rule to copy libraries in _platform_sdk_libraries to lib/
601 group("copy_platform_sdk_libraries") { 682 group("copy_platform_sdk_libraries") {
602 visibility = [ 683 visibility = [
603 ":create_platform_sdk", 684 ":create_platform_sdk",
604 ":copy_libraries", 685 ":copy_libraries",
605 ] 686 ]
606 deps = [] 687 deps = []
607 foreach(library, _platform_sdk_libraries) { 688 foreach(library, _platform_sdk_libraries) {
608 deps += [ ":copy_${library}_library" ] 689 deps += [ ":copy_${library}_library" ]
609 } 690 }
(...skipping 16 matching lines...) Expand all
626 deps = [ 707 deps = [
627 ":copy_platform_sdk_libraries", 708 ":copy_platform_sdk_libraries",
628 ] 709 ]
629 } else { 710 } else {
630 deps = [ 711 deps = [
631 ":copy_full_sdk_libraries", 712 ":copy_full_sdk_libraries",
632 ] 713 ]
633 } 714 }
634 } 715 }
635 716
636 if (is_win) {
637 copy_tree("copy_7zip") {
638 visibility = [ ":create_common_sdk" ]
639 deps = [
640 ":copy_libraries",
641 ":copy_pub_assets",
642 ]
643 source = "../third_party/7zip"
644 dest = "$root_out_dir/dart-sdk/lib/_internal/pub/asset/7zip"
645 exclude = ".svn"
646 }
647 }
648
649 # This rule writes the version file. 717 # This rule writes the version file.
650 action("write_version_file") { 718 action("write_version_file") {
651 visibility = [ ":create_common_sdk" ] 719 visibility = [ ":create_common_sdk" ]
652 output = "$root_out_dir/dart-sdk/version" 720 output = "$root_out_dir/dart-sdk/version"
653 outputs = [ 721 outputs = [
654 output, 722 output,
655 ] 723 ]
656 script = "../tools/write_version_file.py" 724 script = "../tools/write_version_file.py"
657 args = [ 725 args = [
658 "--output", 726 "--output",
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 group("create_sdk") { 851 group("create_sdk") {
784 deps = [ 852 deps = [
785 ":create_common_sdk", 853 ":create_common_sdk",
786 ] 854 ]
787 if (dart_platform_sdk) { 855 if (dart_platform_sdk) {
788 deps += [ ":create_platform_sdk" ] 856 deps += [ ":create_platform_sdk" ]
789 } else { 857 } else {
790 deps += [ ":create_full_sdk" ] 858 deps += [ ":create_full_sdk" ]
791 } 859 }
792 } 860 }
OLDNEW
« no previous file with comments | « build/copy_tree.gni ('k') | tools/copy_tree.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698