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