OLD | NEW |
1 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2014, 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 config("libdart_vm_config") { | 5 config("libdart_vm_config") { |
6 if (defined(is_fuchsia) && is_fuchsia) { | 6 if (defined(is_fuchsia) && is_fuchsia) { |
7 libs = [ | 7 libs = [ |
8 "magenta", | 8 "magenta", |
9 ] | 9 ] |
10 } else if (is_win) { | 10 } else if (is_win) { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 "..:dart_no_snapshot_config",] | 134 "..:dart_no_snapshot_config",] |
135 public_configs = [":libdart_vm_config"] | 135 public_configs = [":libdart_vm_config"] |
136 set_sources_assignment_filter(["*_test.cc", "*_test.h"]) | 136 set_sources_assignment_filter(["*_test.cc", "*_test.h"]) |
137 sources = vm_sources_list.sources | 137 sources = vm_sources_list.sources |
138 include_dirs = [ | 138 include_dirs = [ |
139 "..", | 139 "..", |
140 ] | 140 ] |
141 } | 141 } |
142 | 142 |
143 | 143 |
144 template("process_library_source") { | 144 template("generate_library_source") { |
| 145 assert(defined(invoker.libname), "Need libname in $target_name") |
145 assert(defined(invoker.filename), "Need a filename in $target_name") | 146 assert(defined(invoker.filename), "Need a filename in $target_name") |
| 147 assert(defined(invoker.kind), "Need kind in $target_name") |
146 assert(defined(invoker.output), "Need output in $target_name") | 148 assert(defined(invoker.output), "Need output in $target_name") |
147 assert(defined(invoker.path), "Need path in $target_name") | 149 assert(defined(invoker.path), "Need path in $target_name") |
148 action(target_name) { | 150 action(target_name) { |
149 visibility = [ ":*" ] # Only targets in this file can see this. | 151 visibility = [ ":*" ] # Only targets in this file can see this. |
| 152 libname = invoker.libname |
150 filename = invoker.filename | 153 filename = invoker.filename |
| 154 kind = invoker.kind |
151 path = invoker.path | 155 path = invoker.path |
152 | 156 |
153 lib_sources_gypi = | 157 lib_sources_gypi = |
154 exec_script("../../tools/gypi_to_gn.py", | 158 exec_script("../../tools/gypi_to_gn.py", |
155 [rebase_path("${path}/${filename}_sources.gypi")], | 159 [rebase_path("${path}/${filename}_sources.gypi")], |
156 "scope", | 160 "scope", |
157 ["${path}/${filename}_sources.gypi"]) | 161 ["${path}/${filename}_sources.gypi"]) |
158 lib_sources = | 162 lib_sources = |
159 rebase_path(lib_sources_gypi.sources, ".", path) | 163 rebase_path(lib_sources_gypi.sources, ".", path) |
160 | 164 |
161 script = invoker.script | 165 script = "../tools/gen_library_src_paths.py" |
162 inputs = invoker.inputs + [script] | 166 inputs = [ |
| 167 "../tools/gen_library_src_paths.py", |
| 168 "../lib/libgen_in.cc", |
| 169 ] |
163 inputs += lib_sources | 170 inputs += lib_sources |
164 outputs = [invoker.output] | 171 outputs = [ invoker.output, ] |
165 args = invoker.args + rebase_path(lib_sources, root_build_dir) | |
166 } | |
167 } | |
168 | |
169 | |
170 template("generate_library_source") { | |
171 assert(defined(invoker.libname), "Need libname in $target_name") | |
172 assert(defined(invoker.filename), "Need a filename in $target_name") | |
173 assert(defined(invoker.kind), "Need kind in $target_name") | |
174 assert(defined(invoker.output), "Need output in $target_name") | |
175 assert(defined(invoker.path), "Need path in $target_name") | |
176 | |
177 process_library_source(target_name) { | |
178 libname = invoker.libname | |
179 filename = invoker.filename | |
180 kind = invoker.kind | |
181 output = invoker.output | |
182 path = invoker.path | |
183 script = "../tools/gen_library_src_paths.py" | |
184 inputs = ["../lib/libgen_in.cc"] | |
185 args = [ | 172 args = [ |
186 "--output", rebase_path(invoker.output, root_build_dir), | 173 "--output", rebase_path(invoker.output, root_build_dir), |
187 "--input_cc", rebase_path("../lib/libgen_in.cc", root_build_dir), | 174 "--input_cc", rebase_path("../lib/libgen_in.cc", root_build_dir), |
188 "--include", "vm/bootstrap.h", | 175 "--include", "vm/bootstrap.h", |
189 "--var_name", "dart::Bootstrap::${libname}_${kind}_paths_", | 176 "--var_name", "dart::Bootstrap::${libname}_${kind}_paths_", |
190 "--library_name", "dart:${libname}", | 177 "--library_name", "dart:${libname}",] + |
191 ] | 178 rebase_path(lib_sources, root_build_dir) |
192 } | 179 } |
193 } | 180 } |
194 | 181 |
195 | 182 |
196 # This templates expects invoker.sources to be a list of pairs of strings. | 183 # This templates expects invoker.sources to be a list of pairs of strings. |
197 # The pairs of strings mean the following. | 184 # The pairs of strings mean the following. |
198 # library name, file name | 185 # library name, file name |
199 # e.g. for the "internal" library named "dart:_internal", | 186 # e.g. for the "internal" library named "dart:_internal", |
200 # with sources listed at sdk/lib/internal/internal_sources.gypi and | 187 # with sources listed at sdk/lib/internal/internal_sources.gypi and |
201 # lib/internal_sources.gypi, we have: ["_internal", "internal"] | 188 # lib/internal_sources.gypi, we have: ["_internal", "internal"] |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 ["developer", "developer", true, "../../sdk/lib/developer", "../lib"], | 292 ["developer", "developer", true, "../../sdk/lib/developer", "../lib"], |
306 ["_internal", "internal", true, "../../sdk/lib/internal", "../lib"], | 293 ["_internal", "internal", true, "../../sdk/lib/internal", "../lib"], |
307 ["isolate", "isolate", true, "../../sdk/lib/isolate", "../lib"], | 294 ["isolate", "isolate", true, "../../sdk/lib/isolate", "../lib"], |
308 ["math", "math", true, "../../sdk/lib/math", "../lib"], | 295 ["math", "math", true, "../../sdk/lib/math", "../lib"], |
309 ["mirrors", "mirrors", true, "../../sdk/lib/mirrors", "../lib"], | 296 ["mirrors", "mirrors", true, "../../sdk/lib/mirrors", "../lib"], |
310 ["profiler", "profiler", false, "../../sdk/lib/profiler"], | 297 ["profiler", "profiler", false, "../../sdk/lib/profiler"], |
311 ["typed_data", "typed_data", false, "../lib"], | 298 ["typed_data", "typed_data", false, "../lib"], |
312 ["_vmservice", "vmservice", true, "../../sdk/lib/vmservice", "../lib"], | 299 ["_vmservice", "vmservice", true, "../../sdk/lib/vmservice", "../lib"], |
313 ] | 300 ] |
314 } | 301 } |
315 | |
316 | |
317 template("concatenate_patch") { | |
318 assert(defined(invoker.libname), "Need a name in $target_name") | |
319 assert(defined(invoker.dir), "Need a dir in $target_name") | |
320 assert(defined(invoker.output), "Need an output in $target_name") | |
321 | |
322 process_library_source(target_name) { | |
323 output = invoker.output | |
324 path = "../${invoker.dir}" | |
325 filename = invoker.libname | |
326 script = "../tools/concatenate_patches.py" | |
327 args = [ "--output", rebase_path(output, root_build_dir)] | |
328 inputs = [] | |
329 } | |
330 } | |
331 | |
332 | |
333 template("generate_patched_sdk") { | |
334 assert(defined(invoker.libraries), "Need libraries in $target_name") | |
335 | |
336 concatenation_target_names = [] | |
337 concatenation_files = [] | |
338 | |
339 # Concatenate vm library patches. | |
340 foreach(library, invoker.libraries) { | |
341 name = library[1] | |
342 | |
343 target_output = "$target_gen_dir/patches/${name}_patch.dart" | |
344 concatenate_patch("concatenate_${name}_patch") { | |
345 libname = name | |
346 dir = library[0] | |
347 output = target_output | |
348 } | |
349 concatenation_target_names += [ ":concatenate_${name}_patch" ] | |
350 concatenation_files += [ target_output ] | |
351 } | |
352 | |
353 # Build the patched sdk out of the concatenated patches and the special | |
354 # "runtime/bin/{builtin,nativewrappers}.dart" libraries". | |
355 action(target_name) { | |
356 deps = concatenation_target_names | |
357 | |
358 patches_dir = "$target_gen_dir/patches" | |
359 patched_sdk_dir = "$target_gen_dir/patched_sdk" | |
360 | |
361 script = "../../tools/patch_sdk.py" | |
362 | |
363 # We list all files which make up the sdk (modulo patches) and get them back | |
364 # as a GN list object. | |
365 shared_sdk_sources = exec_script( | |
366 "../../tools/list_dart_files.py", ["../../sdk/lib"], "list lines") | |
367 | |
368 # We list the `patch_sdk.dart` tool here because the [script] (which is | |
369 # implicitly an input) will call it. | |
370 inputs = [ "../../tools/patch_sdk.dart" ] | |
371 # Files below are not patches, they will not be in [concatenation_files] but | |
372 # the `patch_sdk.dart` script will copy them into the patched sdk. | |
373 inputs += [ | |
374 "../lib/typed_data.dart", | |
375 "../bin/builtin.dart", | |
376 "../bin/nativewrappers.dart", | |
377 "../bin/vmservice/vmservice_io.dart", | |
378 "../bin/vmservice/loader.dart", | |
379 "../bin/vmservice/server.dart", | |
380 ] | |
381 # Add all the normal sdk sources. | |
382 inputs += shared_sdk_sources | |
383 # Add all the concatenated patch files. | |
384 inputs += concatenation_files | |
385 | |
386 outputs = [ | |
387 # Instead of listing all outputs we list a single well-known one. | |
388 "${patched_sdk_dir}/lib/core/core.dart", | |
389 ] | |
390 | |
391 args = [ | |
392 "vm", | |
393 rebase_path("../../sdk"), | |
394 rebase_path(patches_dir, root_build_dir), | |
395 rebase_path(patched_sdk_dir, root_build_dir), | |
396 ] | |
397 } | |
398 } | |
399 | |
400 | |
401 generate_patched_sdk("patched_sdk") { | |
402 libraries = [ | |
403 ["lib", "async"], | |
404 ["lib", "collection"], | |
405 ["lib", "convert"], | |
406 ["lib", "core"], | |
407 ["lib", "developer"], | |
408 ["lib", "internal"], | |
409 ["lib", "isolate"], | |
410 ["lib", "math"], | |
411 ["lib", "mirrors"], | |
412 ["lib", "profiler"], | |
413 ["lib", "vmservice"], | |
414 ["bin", "io"], | |
415 ] | |
416 } | |
OLD | NEW |