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

Side by Side Diff: sdk/BUILD.gn

Issue 2848943003: [infra] Assembles the SDK using GN rather than create_sdk.py (Closed)
Patch Set: Move copy_dev_compiler_tools out of the default full SDK build 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 | « runtime/vm/BUILD.gn ('k') | tools/create_sdk.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 # This GN file contains build rules for assembling the Dart SDK. There are
6 # dart2js 6 # two possible variants: the "Full" SDK, and the "Platform" SDK. If you want
7 # dartdoc 7 # to make a new subset of the Full SDK, make it the same way we make
8 # ddc 8 # the Platform SDK.
9 # and libraries that are browser-specific, since these are not used and require 9 #
10 # significant time to build. 10 # Warning:
11 # TODO(zra): Assemble the SDK completely with GN, and remove create_sdk.py. 11 # If you need to copy something into dart-sdk/lib/foo in addition to the stuff
12 if (defined(is_fuchsia) && (is_fuchsia || is_fuchsia_host)) { 12 # copied there by :copy_libraries, then you must depend on ":copy_libraries",
13 template("copy_tree") { 13 # or ":copy_libraries" may delete/overwrite your addition, and the build will
14 assert(defined(invoker.source), "copy_tree must define 'source'") 14 # fail.
15 assert(defined(invoker.dest), "copy_tree must define 'dest'") 15
16 source = invoker.source 16 import("../build/copy_tree.gni")
17 dest = invoker.dest 17
18 action(target_name) { 18 declare_args() {
19 deps = [] 19 # Build a SDK with less stuff. It excludes dart2js, ddc, and web libraries.
20 if (defined(invoker.deps)) { 20 dart_platform_sdk = false
21 deps += invoker.deps 21 }
22 } 22
23 23 if (is_fuchsia || is_fuchsia_host) {
24 common_args = [ 24 dart_platform_sdk = true
25 "--from", 25 }
26 rebase_path(source), 26
27 "--to", 27 # The directory layout of the SDK is as follows:
28 rebase_path(dest), 28 #
29 ] 29 # ..dart-sdk/
30 if (defined(invoker.exclude)) { 30 # ....bin/
31 common_args += [ 31 # ......dart or dart.exe (executable)
32 "--exclude", 32 # ......dart.lib (import library for VM native extensions on Windows)
33 invoker.exclude, 33 # ......dartdoc
34 ] 34 # ......dartfmt
35 } 35 # ......dart2js
36 36 # ......dartanalyzer
37 dry_run_args = common_args + [ "--dry-run" ] 37 # ......dartdevc
38 input_files = 38 # ......pub
39 exec_script("../tools/copy_tree.py", dry_run_args, "list lines") 39 # ......snapshots/
40 inputs = input_files 40 # ........analysis_server.dart.snapshot
41 relative_files = rebase_path(input_files, rebase_path(source)) 41 # ........dart2js.dart.snapshot
42 42 # ........dartanalyzer.dart.snapshot
43 output_files = [] 43 # ........dartdoc.dart.snapshot
44 foreach(input, relative_files) { 44 # ........dartfmt.dart.snapshot
45 output_files += [ "$dest/$input" ] 45 # ........dartdevc.dart.snapshot
46 } 46 # ........pub.dart.snapshot
47 47 # ........utils_wrapper.dart.snapshot
48 outputs = output_files 48 #.........resources/
49 script = "../tools/copy_tree.py" 49 #...........dartdoc/
50 args = common_args 50 #..............packages
51 } 51 #.............resources/
52 } 52 #.............templates/
53 53 # ....include/
54 copy("copy_dart") { 54 # ......dart_api.h
55 deps = [ 55 # ......dart_mirrors_api.h
56 "../runtime/bin:dart", 56 # ......dart_native_api.h
57 # ......dart_tools_api.h
58 # ....lib/
59 # ......dart_client.platform
60 # ......dart_server.platform
61 # ......dart_shared.platform
62 # ......_internal/
63 #.........spec.sum
64 #.........strong.sum
65 #.........dev_compiler/
66 # ......analysis_server/
67 # ......analyzer/
68 # ......async/
69 # ......collection/
70 # ......convert/
71 # ......core/
72 # ......front_end/
73 # ......html/
74 # ......internal/
75 # ......io/
76 # ......isolate/
77 # ......js/
78 # ......js_util/
79 # ......kernel/
80 # ......math/
81 # ......mirrors/
82 # ......typed_data/
83 # ......api_readme.md
84
85 # Scripts that go under bin/
86 _platform_sdk_scripts = [
87 "dartanalyzer",
88 "dartfmt",
89 "pub",
90 ]
91
92 _full_sdk_scripts = [
93 "dart2js",
94 "dartanalyzer",
95 "dartdevc",
96 "dartfmt",
97 "pub",
98 ]
99
100 # Scripts not ending in _sdk that go under bin/
101 _scripts = [ "dartdoc" ]
102
103 # Snapshots that go under bin/snapshots
104 _platform_sdk_snapshots = [
105 [
106 "analysis_server",
107 "../utils/analysis_server",
108 ],
109 [
110 "dartanalyzer",
111 "../utils/dartanalyzer:generate_dartanalyzer_snapshot",
112 ],
113 [
114 "dartdoc",
115 "../utils/dartdoc",
116 ],
117 [
118 "dartfmt",
119 "../utils/dartfmt",
120 ],
121 [
122 "pub",
123 "../utils/pub",
124 ],
125 ]
126
127 _full_sdk_snapshots = [
128 [
129 "analysis_server",
130 "../utils/analysis_server",
131 ],
132 [
133 "dart2js",
134 "../utils/compiler:dart2js",
135 ],
136 [
137 "dartanalyzer",
138 "../utils/dartanalyzer:generate_dartanalyzer_snapshot",
139 ],
140 [
141 "dartdevc",
142 "../utils/dartdevc",
143 ],
144 [
145 "dartdoc",
146 "../utils/dartdoc",
147 ],
148 [
149 "dartfmt",
150 "../utils/dartfmt",
151 ],
152 [
153 "pub",
154 "../utils/pub",
155 ],
156 [
157 "utils_wrapper",
158 "../utils/compiler:utils_wrapper",
159 ],
160 ]
161
162 # Libraries that go under lib/
163 _platform_sdk_libraries = [
164 "_internal",
165 "async",
166 "collection",
167 "convert",
168 "core",
169 "developer",
170 "internal",
171 "io",
172 "isolate",
173 "math",
174 "mirrors",
175 "profiler",
176 "typed_data",
177 ]
178
179 _full_sdk_libraries = [
180 "_blink",
181 "_chrome",
182 "_internal",
183 "async",
184 "collection",
185 "convert",
186 "core",
187 "developer",
188 "html",
189 "indexed_db",
190 "internal",
191 "io",
192 "isolate",
193 "js",
194 "js_util",
195 "math",
196 "mirrors",
197 "profiler",
198 "svg",
199 "typed_data",
200 "web_audio",
201 "web_gl",
202 "web_sql",
203 ]
204
205 # Package sources copied to lib/
206 _analyzer_source_dirs = [
207 "analyzer",
208 "analysis_server",
209 "front_end",
210 "kernel",
211 ]
212
213 # Copies the Dart VM binary into bin/
214 copy("copy_dart") {
215 visibility = [ ":create_common_sdk" ]
216 deps = [
217 "../runtime/bin:dart",
218 ]
219 dart_out = get_label_info("../runtime/bin:dart", "root_out_dir")
220 if (is_win) {
221 sources = [
222 "$dart_out/dart.exe",
57 ] 223 ]
58 dart_out = get_label_info("../runtime/bin:dart", "root_out_dir") 224 } else if (is_fuchsia || is_fuchsia_host) {
59 dart_name = get_label_info("../runtime/bin:dart", "name")
60 sources = [ 225 sources = [
61 "$dart_out/$dart_name", 226 "$dart_out/dart",
62 ] 227 ]
63 outputs = [ 228 } else {
64 "$root_out_dir/dart-sdk/bin/dart", 229 sources = [
230 "$dart_out/exe.stripped/dart",
65 ] 231 ]
66 } 232 }
67 233 if (is_win) {
234 sources += [ "$dart_out/dart.lib" ]
235 }
236 outputs = [
237 "$root_out_dir/dart-sdk/bin/{{source_file_part}}",
238 ]
239 }
240
241 # Copies dynamically linked libraries into bin/. This is currently only needed
242 # for Fuchsia when building for Linux hosts.
243 if (is_fuchsia_host && is_linux) {
68 copy("copy_dylibs") { 244 copy("copy_dylibs") {
245 visibility = [ ":create_common_sdk" ]
69 deps = [ 246 deps = [
70 "//third_party/boringssl:crypto", 247 "//third_party/boringssl:crypto",
71 "//third_party/boringssl:ssl", 248 "//third_party/boringssl:ssl",
72 "//third_party/zlib", 249 "//third_party/zlib",
73 ] 250 ]
74 crypto_out = 251 crypto_out =
75 get_label_info("//third_party/boringssl:crypto", "root_out_dir") 252 get_label_info("//third_party/boringssl:crypto", "root_out_dir")
76 crypto_name = get_label_info("//third_party/boringssl:crypto", "name") 253 crypto_name = get_label_info("//third_party/boringssl:crypto", "name")
77 ssl_out = get_label_info("//third_party/boringssl:ssl", "root_out_dir") 254 ssl_out = get_label_info("//third_party/boringssl:ssl", "root_out_dir")
78 ssl_name = get_label_info("//third_party/boringssl:ssl", "name") 255 ssl_name = get_label_info("//third_party/boringssl:ssl", "name")
79 zlib_out = get_label_info("//third_party/zlib", "root_out_dir") 256 zlib_out = get_label_info("//third_party/zlib", "root_out_dir")
80 sources = [ 257 sources = [
81 "$crypto_out/lib${crypto_name}.so", 258 "$crypto_out/lib${crypto_name}.so",
82 "$ssl_out/lib${ssl_name}.so", 259 "$ssl_out/lib${ssl_name}.so",
83 "$zlib_out/libz.so", 260 "$zlib_out/libz.so",
84 ] 261 ]
85 outputs = [ 262 outputs = [
86 "$root_out_dir/dart-sdk/bin/{{source_file_part}}", 263 "$root_out_dir/dart-sdk/bin/{{source_file_part}}",
87 ] 264 ]
88 } 265 }
89 266 }
90 template("copy_sdk_script") { 267
91 assert(defined(invoker.name), "copy_sdk_script must define 'name'") 268 # A template for copying the things in _platform_sdk_scripts and
92 name = invoker.name 269 # _full_sdk_scripts into bin/
93 copy(target_name) { 270 template("copy_sdk_script") {
94 sources = [ 271 assert(defined(invoker.name), "copy_sdk_script must define 'name'")
95 "bin/${name}_sdk", 272 name = invoker.name
96 ] 273 ext = ""
97 outputs = [ 274 if (is_win) {
98 "$root_out_dir/dart-sdk/bin/${name}", 275 ext = ".bat"
99 ] 276 }
277 copy(target_name) {
278 visibility = [
279 ":copy_platform_sdk_scripts",
280 ":copy_full_sdk_scripts",
281 ]
282 sources = [
283 "bin/${name}_sdk$ext",
284 ]
285 outputs = [
286 "$root_out_dir/dart-sdk/bin/$name$ext",
287 ]
288 }
289 }
290
291 foreach(sdk_script, _full_sdk_scripts) {
292 copy_sdk_script("copy_${sdk_script}_script") {
293 name = sdk_script
294 }
295 }
296
297 foreach(script, _scripts) {
298 copy("copy_${script}_script") {
299 visibility = [
300 ":copy_platform_sdk_scripts",
301 ":copy_full_sdk_scripts",
302 ]
303 ext = ""
304 if (is_win) {
305 ext = ".bat"
100 } 306 }
101 } 307 sources = [
102 308 "bin/$script$ext",
103 _sdk_scripts = [ 309 ]
104 "dartanalyzer", 310 outputs = [
105 "dartfmt", 311 "$root_out_dir/dart-sdk/bin/{{source_file_part}}",
106 "pub", 312 ]
107 ] 313 }
108 314 }
109 foreach(sdk_script, _sdk_scripts) { 315
110 copy_sdk_script("copy_${sdk_script}_script") { 316 # This is the main target for copying scripts in _platform_sdk_scripts to bin/
111 name = sdk_script 317 group("copy_platform_sdk_scripts") {
112 } 318 visibility = [ ":create_platform_sdk" ]
113 } 319 deps = []
114 320 foreach(sdk_script, _platform_sdk_scripts) {
115 group("copy_scripts") { 321 deps += [ ":copy_${sdk_script}_script" ]
322 }
323 foreach(script, _scripts) {
324 deps += [ ":copy_${script}_script" ]
325 }
326 }
327
328 # This is the main target for copying scripts in _full_sdk_scripts to bin/
329 group("copy_full_sdk_scripts") {
330 visibility = [ ":create_full_sdk" ]
331 deps = []
332 foreach(sdk_script, _full_sdk_scripts) {
333 deps += [ ":copy_${sdk_script}_script" ]
334 }
335 foreach(script, _scripts) {
336 deps += [ ":copy_${script}_script" ]
337 }
338 }
339
340 # This loop generates "copy" targets that put snapshots into bin/snapshots
341 foreach(snapshot, _full_sdk_snapshots) {
342 copy("copy_${snapshot[0]}_snapshot") {
343 visibility = [
344 ":copy_platform_sdk_snapshots",
345 ":copy_full_sdk_snapshots",
346 ]
116 deps = [ 347 deps = [
117 ":copy_dartanalyzer_script", 348 snapshot[1],
118 ":copy_dartfmt_script", 349 ]
119 ":copy_pub_script", 350 sources = [
120 ] 351 "$root_gen_dir/${snapshot[0]}.dart.snapshot",
121 } 352 ]
122 353 outputs = [
123 _snapshots = [ 354 "$root_out_dir/dart-sdk/bin/snapshots/{{source_file_part}}",
124 [ 355 ]
125 "analysis_server", 356 }
126 "../utils/analysis_server", 357 }
127 ], 358
128 [ 359 # This is the main rule for copying snapshots from _platform_sdk_snapshots to
129 "dartanalyzer", 360 # bin/snapshots
130 "../utils/dartanalyzer:generate_dartanalyzer_snapshot", 361 group("copy_platform_sdk_snapshots") {
131 ], 362 visibility = [ ":create_platform_sdk" ]
132 [ 363 deps = []
133 "dartfmt", 364 foreach(snapshot, _platform_sdk_snapshots) {
134 "../utils/dartfmt", 365 deps += [ ":copy_${snapshot[0]}_snapshot" ]
135 ], 366 }
136 [ 367 }
137 "pub", 368
138 "../utils/pub", 369 # This is the main rule for copying snapshots from _full_sdk_snapshots to
139 ], 370 # bin/snapshots
140 ] 371 group("copy_full_sdk_snapshots") {
141 372 visibility = [ ":create_full_sdk" ]
142 foreach(snapshot, _snapshots) { 373 deps = []
143 copy("copy_${snapshot[0]}_snapshot") { 374 foreach(snapshot, _full_sdk_snapshots) {
144 deps = [ 375 deps += [ ":copy_${snapshot[0]}_snapshot" ]
145 snapshot[1], 376 }
146 ] 377 }
147 sources = [ 378
148 "$root_gen_dir/${snapshot[0]}.dart.snapshot", 379 # This loop generates rules for copying analyzer sources into lib/
149 ] 380 foreach(analyzer_source_dir, _analyzer_source_dirs) {
150 outputs = [ 381 copy_tree("copy_${analyzer_source_dir}_source_dir") {
151 "$root_out_dir/dart-sdk/bin/snapshots/{{source_file_part}}", 382 visibility = [ ":copy_analyzer_sources" ]
152 ] 383 source = "../pkg/$analyzer_source_dir"
153 } 384 dest = "$root_out_dir/dart-sdk/lib/$analyzer_source_dir"
154 } 385 exclude = "*.svn,doc,*.py,*.gypi,*.sh,.gitignore,packages"
155 386 }
156 group("copy_snapshots") { 387 }
388
389 # This is the main rule for copying analyzer sources to lib/
390 group("copy_analyzer_sources") {
391 visibility = [ ":create_common_sdk" ]
392 deps = []
393 foreach(analyzer_source_dir, _analyzer_source_dirs) {
394 deps += [ ":copy_${analyzer_source_dir}_source_dir" ]
395 }
396 }
397
398 # This rule copies dartdoc templates to
399 # bin/snapshots/resources/dartdoc/templates
400 copy_tree("copy_dartdoc_templates") {
401 visibility = [ ":copy_dartdoc_files" ]
402 source = "../third_party/pkg/dartdoc/lib/templates"
403 dest = "$root_out_dir/dart-sdk/bin/snapshots/resources/dartdoc/templates"
404 }
405
406 # This rule copies dartdoc resources to
407 # bin/snapshots/resources/dartdoc/resources
408 copy_tree("copy_dartdoc_resources") {
409 visibility = [ ":copy_dartdoc_files" ]
410 source = "../third_party/pkg/dartdoc/lib/resources"
411 dest = "$root_out_dir/dart-sdk/bin/snapshots/resources/dartdoc/resources"
412 }
413
414 # This rule writes the .packages file for dartdoc resources.
415 write_file("$root_out_dir/dart-sdk/bin/snapshots/resources/dartdoc/.packages",
416 "dartdoc:.")
417
418 # This is the main rule for copying the files that dartdoc needs.
419 group("copy_dartdoc_files") {
420 visibility = [ ":create_common_sdk" ]
421 deps = [
422 ":copy_dartdoc_resources",
423 ":copy_dartdoc_templates",
424 ]
425 }
426
427 # This rule copies analyzer summaries to lib/_internal
428 copy("copy_analysis_summaries") {
429 visibility = [ ":create_common_sdk" ]
430 deps = [
431 ":copy_libraries",
432 "../utils/dartanalyzer:generate_summary_spec",
433 "../utils/dartanalyzer:generate_summary_strong",
434 ]
435 sources = [
436 "$root_gen_dir/spec.sum",
437 "$root_gen_dir/strong.sum",
438 ]
439 outputs = [
440 "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}",
441 ]
442 }
443
444 # This rule copies ddc summaries to lib/_internal
445 copy("copy_dev_compiler_summary") {
446 visibility = [ ":copy_dev_compiler_sdk" ]
447 deps = [
448 ":copy_libraries",
449 ]
450 sources = [
451 "../pkg/dev_compiler/lib/sdk/ddc_sdk.sum",
452 ]
453 outputs = [
454 "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}",
455 ]
456 }
457
458 # This rule copies js needed by ddc to lib/dev_compiler
459 copy_tree("copy_dev_compiler_js") {
460 visibility = [
461 ":copy_dev_compiler_sdk",
462 ":copy_dev_compiler_require_js",
463 ]
464 source = "../pkg/dev_compiler/lib/js"
465 dest = "$root_out_dir/dart-sdk/lib/dev_compiler"
466 }
467
468 # This rule copies require.js to lib/dev_compiler/amd
469 copy("copy_dev_compiler_require_js") {
470 visibility = [ ":copy_dev_compiler_sdk" ]
471 deps = [
472 ":copy_dev_compiler_js",
473 ]
474 sources = [
475 "../third_party/requirejs/require.js",
476 ]
477 outputs = [
478 "$root_out_dir/dart-sdk/lib/dev_compiler/amd/{{source_file_part}}",
479 ]
480 }
481
482 # This is the main rule for copying ddc's dependencies to lib/
483 group("copy_dev_compiler_sdk") {
484 visibility = [ ":create_full_sdk" ]
485 deps = [
486 ":copy_dev_compiler_js",
487 ":copy_dev_compiler_require_js",
488 ":copy_dev_compiler_summary",
489 ]
490 }
491
492 # This rule copies header files to include/
493 copy("copy_headers") {
494 visibility = [ ":create_common_sdk" ]
495 sources = [
496 "../runtime/include/dart_api.h",
497 "../runtime/include/dart_mirrors_api.h",
498 "../runtime/include/dart_native_api.h",
499 "../runtime/include/dart_tools_api.h",
500 ]
501 outputs = [
502 "$root_out_dir/dart-sdk/include/{{source_file_part}}",
503 ]
504 }
505
506 # This rule copies .platform files to lib/
507 copy("copy_platform_files") {
508 visibility = [ ":create_common_sdk" ]
509 sources = [
510 "lib/dart_client.platform",
511 "lib/dart_server.platform",
512 "lib/dart_shared.platform",
513 ]
514 outputs = [
515 "$root_out_dir/dart-sdk/lib/{{source_file_part}}",
516 ]
517 }
518
519 # This rule copies pub assets to lib/_internal/pub/asset
520 copy_tree("copy_pub_assets") {
521 visibility = [
522 ":create_common_sdk",
523 ":copy_7zip",
524 ]
525 deps = [
526 ":copy_libraries",
527 ]
528 source = "../third_party/pkg/pub/lib/src/asset"
529 dest = "$root_out_dir/dart-sdk/lib/_internal/pub/asset"
530 }
531
532 # This loop generates rules to copy libraries to lib/
533 foreach(library, _full_sdk_libraries) {
534 copy_tree("copy_${library}_library") {
535 visibility = [
536 ":copy_platform_sdk_libraries",
537 ":copy_full_sdk_libraries",
538 ]
539 source = "lib/$library"
540 dest = "$root_out_dir/dart-sdk/lib/$library"
541 exclude = "*.svn,doc,*.py,*.gypi,*.sh,.gitignore"
542 }
543 }
544
545 # This is the main rule to copy libraries in _platform_sdk_libraries to lib/
546 group("copy_platform_sdk_libraries") {
547 visibility = [
548 ":create_platform_sdk",
549 ":copy_libraries",
550 ]
551 deps = []
552 foreach(library, _platform_sdk_libraries) {
553 deps += [ ":copy_${library}_library" ]
554 }
555 }
556
557 # This is the main rule to copy libraries in _full_sdk_libraries to lib/
558 group("copy_full_sdk_libraries") {
559 visibility = [
560 ":create_full_sdk",
561 ":copy_libraries",
562 ]
563 deps = []
564 foreach(library, _full_sdk_libraries) {
565 deps += [ ":copy_${library}_library" ]
566 }
567 }
568
569 group("copy_libraries") {
570 if (dart_platform_sdk) {
157 deps = [ 571 deps = [
158 ":copy_analysis_server_snapshot", 572 ":copy_platform_sdk_libraries",
159 ":copy_dartanalyzer_snapshot", 573 ]
160 ":copy_dartfmt_snapshot", 574 } else {
161 ":copy_pub_snapshot", 575 deps = [
162 ] 576 ":copy_full_sdk_libraries",
163 } 577 ]
164 578 }
165 copy("copy_analysis_summaries") { 579 }
580
581 if (is_win) {
582 copy_tree("copy_7zip") {
583 visibility = [ ":create_common_sdk" ]
166 deps = [ 584 deps = [
167 ":copy_libraries", 585 ":copy_libraries",
168 "../utils/dartanalyzer:generate_summary_spec",
169 "../utils/dartanalyzer:generate_summary_strong",
170 ]
171 sources = [
172 "$root_gen_dir/spec.sum",
173 "$root_gen_dir/strong.sum",
174 ]
175 outputs = [
176 "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}",
177 ]
178 }
179
180 copy("copy_headers") {
181 sources = [
182 "../runtime/include/dart_api.h",
183 "../runtime/include/dart_mirrors_api.h",
184 "../runtime/include/dart_native_api.h",
185 "../runtime/include/dart_tools_api.h",
186 ]
187 outputs = [
188 "$root_out_dir/dart-sdk/include/{{source_file_part}}",
189 ]
190 }
191
192 copy("copy_platform_files") {
193 sources = [
194 "lib/dart_client.platform",
195 "lib/dart_server.platform",
196 "lib/dart_shared.platform",
197 ]
198 outputs = [
199 "$root_out_dir/dart-sdk/lib/{{source_file_part}}",
200 ]
201 }
202
203 copy_tree("copy_pub_assets") {
204 deps = [
205 ":copy_libraries",
206 ]
207 source = "../third_party/pkg/pub/lib/src/asset"
208 dest = "$root_out_dir/dart-sdk/lib/_internal/pub/asset"
209 }
210
211 _libraries = [
212 "_internal",
213 "async",
214 "collection",
215 "convert",
216 "core",
217 "developer",
218 "internal",
219 "io",
220 "isolate",
221 "math",
222 "mirrors",
223 "profiler",
224 "typed_data",
225 ]
226
227 foreach(library, _libraries) {
228 copy_tree("copy_${library}_library") {
229 source = "lib/$library"
230 dest = "$root_out_dir/dart-sdk/lib/$library"
231 exclude = "*.svn,doc,*.py,*.gypi,*.sh,.gitignore"
232 }
233 }
234
235 group("copy_libraries") {
236 deps = [
237 ":copy__internal_library",
238 ":copy_async_library",
239 ":copy_collection_library",
240 ":copy_convert_library",
241 ":copy_core_library",
242 ":copy_developer_library",
243 ":copy_internal_library",
244 ":copy_io_library",
245 ":copy_isolate_library",
246 ":copy_math_library",
247 ":copy_mirrors_library",
248 ":copy_profiler_library",
249 ":copy_typed_data_library",
250 ]
251 }
252
253 action("write_version_file") {
254 output = "$root_out_dir/dart-sdk/version"
255 outputs = [
256 output,
257 ]
258 script = "../tools/write_version_file.py"
259 args = [
260 "--output",
261 rebase_path(output),
262 ]
263 }
264
265 action("write_revision_file") {
266 output = "$root_out_dir/dart-sdk/revision"
267 outputs = [
268 output,
269 ]
270 script = "../tools/write_revision_file.py"
271 args = [
272 "--output",
273 rebase_path(output),
274 ]
275 }
276
277 copy("copy_readme") {
278 sources = [
279 "../README.dart-sdk",
280 ]
281 outputs = [
282 "$root_out_dir/dart-sdk/README",
283 ]
284 }
285
286 copy("copy_license") {
287 sources = [
288 "../LICENSE",
289 ]
290 outputs = [
291 "$root_out_dir/dart-sdk/LICENSE",
292 ]
293 }
294
295 copy("copy_api_readme") {
296 sources = [
297 "api_readme.md",
298 ]
299 outputs = [
300 "$root_out_dir/dart-sdk/lib/api_readme.md",
301 ]
302 }
303
304 group("create_sdk") {
305 deps = [
306 ":copy_analysis_summaries",
307 ":copy_api_readme",
308 ":copy_dart",
309 ":copy_headers",
310 ":copy_libraries",
311 ":copy_license",
312 ":copy_platform_files",
313 ":copy_pub_assets", 586 ":copy_pub_assets",
314 ":copy_readme", 587 ]
315 ":copy_scripts", 588 source = "../third_party/7zip"
316 ":copy_snapshots", 589 dest = "$root_out_dir/dart-sdk/lib/_internal/pub/asset/7zip"
317 ":write_revision_file", 590 exclude = ".svn"
318 ":write_version_file", 591 }
319 ] 592 }
320 if (is_fuchsia_host && is_linux) { 593
321 deps += [ ":copy_dylibs" ] 594 # This rule writes the version file.
322 } 595 action("write_version_file") {
323 } 596 visibility = [ ":create_common_sdk" ]
324 } else { 597 output = "$root_out_dir/dart-sdk/version"
325 action("create_sdk") { 598 outputs = [
326 deps = [ 599 output,
327 "../runtime/bin:dart", 600 ]
328 "../utils/analysis_server", 601 script = "../tools/write_version_file.py"
329 "../utils/compiler:dart2js", 602 args = [
330 "../utils/compiler:utils_wrapper", 603 "--output",
331 "../utils/dartanalyzer:generate_dartanalyzer_snapshot", 604 rebase_path(output),
332 "../utils/dartanalyzer:generate_summary_spec", 605 ]
333 "../utils/dartanalyzer:generate_summary_strong", 606 }
334 "../utils/dartdevc", 607
335 "../utils/dartdoc", 608 # This rule writes the revision file.
336 "../utils/dartfmt", 609 action("write_revision_file") {
337 "../utils/pub", 610 visibility = [ ":create_common_sdk" ]
338 ] 611 output = "$root_out_dir/dart-sdk/revision"
339 612 outputs = [
340 sdk_lib_files = exec_script("../tools/list_dart_files.py", 613 output,
341 [ 614 ]
342 "absolute", 615 script = "../tools/write_revision_file.py"
343 rebase_path("lib"), 616 args = [
344 ], 617 "--output",
345 "list lines") 618 rebase_path(output),
346 619 ]
347 preamble_files = 620 }
348 exec_script("../tools/list_files.py", 621
349 [ 622 # Copy libraries.dart to lib/_internal/libraries.dart for backwards
350 "absolute", 623 # compatibility.
351 "", 624 #
352 rebase_path("lib/_internal/js_runtime/lib/preambles"), 625 # TODO(sigmund): stop copying libraries.dart. Old versions (<=0.25.1-alpha.4)
353 ], 626 # of the analyzer package do not support the new location of this file. We
354 "list lines") 627 # should be able to remove the old file once we release a newer version of
355 628 # analyzer and popular frameworks have migrated to use it.
356 sdk_bin_files = exec_script("../tools/list_files.py", 629 copy("copy_libraries_dart") {
357 [ 630 visibility = [ ":create_common_sdk" ]
358 "absolute", 631 deps = [
359 "", 632 ":copy_libraries",
360 rebase_path("bin"), 633 ]
361 ], 634 sources = [
362 "list lines") 635 "lib/_internal/sdk_library_metadata/lib/libraries.dart",
363 636 ]
364 inputs = sdk_lib_files + preamble_files + sdk_bin_files + [ 637 outputs = [
365 "lib/dart_client.platform", 638 "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}",
366 "lib/dart_server.platform", 639 ]
367 "lib/dart_shared.platform", 640 }
368 "$root_gen_dir/dart2js.dart.snapshot", 641
369 "$root_gen_dir/utils_wrapper.dart.snapshot", 642 # This rule copies the README file.
370 "$root_gen_dir/pub.dart.snapshot", 643 copy("copy_readme") {
371 "$root_gen_dir/dartanalyzer.dart.snapshot", 644 visibility = [ ":create_common_sdk" ]
372 "$root_gen_dir/dartdevc.dart.snapshot", 645 sources = [
373 "$root_gen_dir/dartfmt.dart.snapshot", 646 "../README.dart-sdk",
374 "$root_gen_dir/analysis_server.dart.snapshot", 647 ]
375 "$root_gen_dir/dartdoc.dart.snapshot", 648 outputs = [
376 "$root_gen_dir/spec.sum", 649 "$root_out_dir/dart-sdk/README",
377 "$root_gen_dir/strong.sum", 650 ]
378 "../tools/VERSION", 651 }
379 ] 652
380 653 # This rule copies the LICENSE file.
381 outputs = [ 654 copy("copy_license") {
382 "$root_out_dir/dart-sdk/README", 655 visibility = [ ":create_common_sdk" ]
383 ] 656 sources = [
384 657 "../LICENSE",
385 script = "../tools/create_sdk.py" 658 ]
386 args = [ 659 outputs = [
387 "--sdk_output_dir", 660 "$root_out_dir/dart-sdk/LICENSE",
388 rebase_path("$root_out_dir/dart-sdk"), 661 ]
389 "--snapshot_location", 662 }
390 rebase_path("$root_gen_dir"), 663
391 ] 664 # This rule copies the API readme file to lib/
392 } 665 copy("copy_api_readme") {
393 666 visibility = [ ":create_common_sdk" ]
394 copy("copy_dev_compiler_tools") { 667 sources = [
395 deps = [ 668 "api_readme.md",
396 ":create_sdk", 669 ]
397 "../utils/dartdevc:dartdevc_web", 670 outputs = [
398 "../utils/dartdevc:stack_trace_mapper", 671 "$root_out_dir/dart-sdk/lib/api_readme.md",
399 ] 672 ]
400 dart_out = get_label_info("../utils/dartdevc:dartdevc_web", "root_out_dir") 673 }
401 sources = [ 674
402 "$dart_out/dev_compiler/build/web/ddc_web_compiler.js", 675 # Parts common to both platform and full SDKs.
403 "$dart_out/dev_compiler/build/web/dart_stack_trace_mapper.js", 676 group("create_common_sdk") {
404 ] 677 visibility = [ ":create_sdk" ]
405 outputs = [ 678 deps = [
406 "$root_out_dir/dart-sdk/lib/dev_compiler/web/{{source_file_part}}", 679 ":copy_analysis_summaries",
407 ] 680 ":copy_analyzer_sources",
408 } 681 ":copy_api_readme",
409 } 682 ":copy_dart",
683 ":copy_dartdoc_files",
684 ":copy_headers",
685 ":copy_libraries_dart",
686 ":copy_license",
687 ":copy_platform_files",
688 ":copy_pub_assets",
689 ":copy_readme",
690 ":write_revision_file",
691 ":write_version_file",
692 ]
693 if (is_win) {
694 deps += [ ":copy_7zip" ]
695 }
696 if (is_fuchsia_host && is_linux) {
697 deps += [ ":copy_dylibs" ]
698 }
699 }
700
701 # Parts specific to the platform SDK.
702 group("create_platform_sdk") {
703 visibility = [ ":create_sdk" ]
704 deps = [
705 ":copy_platform_sdk_libraries",
706 ":copy_platform_sdk_scripts",
707 ":copy_platform_sdk_snapshots",
708 ]
709 }
710
711 # Parts specific to the full SDK.
712 group("create_full_sdk") {
713 visibility = [
714 ":copy_dev_compiler_tools",
715 ":create_sdk",
716 ]
717 deps = [
718 ":copy_dev_compiler_sdk",
719 ":copy_full_sdk_libraries",
720 ":copy_full_sdk_scripts",
721 ":copy_full_sdk_snapshots",
722 ]
723 }
724
725 # The main target to depend on from ../BUILD.gn
726 group("create_sdk") {
727 deps = [
728 ":create_common_sdk",
729 ]
730 if (dart_platform_sdk) {
731 deps += [ ":create_platform_sdk" ]
732 } else {
733 deps += [ ":create_full_sdk" ]
734 }
735 }
736
737 # This rule copies tools to go along with ddc.
738 copy("copy_dev_compiler_tools") {
739 deps = [
740 ":create_full_sdk",
741 "../utils/dartdevc:dartdevc_web",
742 "../utils/dartdevc:stack_trace_mapper",
743 ]
744 dart_out = get_label_info("../utils/dartdevc:dartdevc_web", "root_out_dir")
745 sources = [
746 "$dart_out/dev_compiler/build/web/dart_stack_trace_mapper.js",
747 "$dart_out/dev_compiler/build/web/ddc_web_compiler.js",
748 ]
749 outputs = [
750 "$root_out_dir/dart-sdk/lib/dev_compiler/web/{{source_file_part}}",
751 ]
752 }
OLDNEW
« no previous file with comments | « runtime/vm/BUILD.gn ('k') | tools/create_sdk.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698