OLD | NEW |
1 # Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2016, 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 default_dart_root = rebase_path("../..") |
| 6 |
5 # This build rule will copy the source for one Dart SDK library. | 7 # This build rule will copy the source for one Dart SDK library. |
6 # | 8 # |
7 # Required arguments: | 9 # Required arguments: |
8 # sdk_lib_name | 10 # sdk_lib_name |
9 # The name of a Dart SDK library. | 11 # The name of a Dart SDK library. |
10 # | 12 # |
11 # Optional arguments: | 13 # Optional arguments: |
12 # destination | 14 # destination |
13 # Base path to copy sources. Default value is "$root_gen_dir/dart_sdk". | 15 # Base path to copy sources. Default value is "$root_gen_dir/dart_sdk". |
14 # | 16 # |
15 # dart_root | 17 # dart_root |
16 # Path to the Dart SDK source root. Default value is "//dart". | 18 # Path to the Dart SDK source root. Default value is "../..". |
17 # | 19 # |
18 # The sources will be copied into $root_gen_dir/dart_sdk/$sdk_lib_name/. | 20 # The sources will be copied into $root_gen_dir/dart_sdk/$sdk_lib_name/. |
19 # | 21 # |
20 template("dart_sdk_lib_copy") { | 22 template("dart_sdk_lib_copy") { |
21 assert(defined(invoker.sdk_lib_name)) | 23 assert(defined(invoker.sdk_lib_name)) |
22 if (defined(invoker.dart_root)) { | 24 if (defined(invoker.dart_root)) { |
23 dart_root = rebase_path(invoker.dart_root) | 25 dart_root = rebase_path(invoker.dart_root) |
24 } else { | 26 } else { |
25 dart_root = rebase_path("//dart") | 27 dart_root = default_dart_root |
26 } | 28 } |
27 if (defined(invoker.destination)) { | 29 if (defined(invoker.destination)) { |
28 destination = invoker.destination | 30 destination = invoker.destination |
29 } else { | 31 } else { |
30 destination = "$root_gen_dir/dart_sdk" | 32 destination = "$root_gen_dir/dart_sdk" |
31 } | 33 } |
32 dart_sdk_sdk_lib_path = | 34 dart_sdk_sdk_lib_path = |
33 rebase_path("sdk/lib", "", dart_root) | 35 rebase_path("sdk/lib", "", dart_root) |
34 dart_sdk_tools_gypi_to_gn_path = | 36 dart_sdk_tools_gypi_to_gn_path = |
35 rebase_path("tools/gypi_to_gn.py", "", dart_root) | 37 rebase_path("tools/gypi_to_gn.py", "", dart_root) |
36 # The name of the SDK library being copied. | 38 # The name of the SDK library being copied. |
37 lib_name = invoker.sdk_lib_name | 39 lib_name = invoker.sdk_lib_name |
38 # The path to the libraries source directory. | 40 # The path to the libraries source directory. |
39 lib_path = rebase_path(lib_name, "", dart_sdk_sdk_lib_path) | 41 lib_path = rebase_path(lib_name, "", dart_sdk_sdk_lib_path) |
40 # The path to the sources gypi. | 42 # The path to the sources gypi. |
41 lib_sources_gypi = lib_name + "_sources.gypi" | 43 lib_sources_gypi = lib_name + "_sources.gypi" |
42 # Get the contents of the gypi file. | 44 # Get the contents of the gypi file. |
43 sdk_lib_sources_gypi = | 45 sdk_lib_sources_gypi = |
44 exec_script(dart_sdk_tools_gypi_to_gn_path, | 46 exec_script(dart_sdk_tools_gypi_to_gn_path, |
45 [rebase_path(lib_sources_gypi, "", lib_path)], | 47 [rebase_path(lib_sources_gypi, "", lib_path)], |
46 "scope", | 48 "scope", |
47 [rebase_path(lib_sources_gypi, "", lib_path)]) | 49 [rebase_path(lib_sources_gypi, "", lib_path)]) |
48 copy(target_name) { | 50 copy(target_name) { |
49 sources = rebase_path(sdk_lib_sources_gypi.sources, "", lib_path) | 51 sources = rebase_path(sdk_lib_sources_gypi.sources, "", lib_path) |
50 outputs = [ "$destination/$lib_name/{{source_file_part}}" ] | 52 outputs = [ "$destination/$lib_name/{{source_file_part}}" ] |
51 } | 53 } |
52 } | 54 } |
OLD | NEW |