OLD | NEW |
(Empty) | |
| 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 |
| 3 # BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 # This build rule will copy the source for one Dart SDK library. |
| 6 # |
| 7 # Required arguments: |
| 8 # sdk_lib_name |
| 9 # The name of a Dart SDK library. |
| 10 # |
| 11 # Optional arguments: |
| 12 # dart_root |
| 13 # Path to the Dart SDK source root. Default value is "//dart". |
| 14 # |
| 15 # The sources will be copied into $root_gen_dir/dart_sdk_libs/$sdk_lib_name/. |
| 16 # |
| 17 template("dart_sdk_lib_copy") { |
| 18 assert(defined(invoker.sdk_lib_name)) |
| 19 if (defined(invoker.dart_root)) { |
| 20 dart_root = rebase_path(invoker.dart_root) |
| 21 } else { |
| 22 dart_root = rebase_path("//dart") |
| 23 } |
| 24 dart_sdk_sdk_lib_path = |
| 25 rebase_path("sdk/lib", "", dart_root) |
| 26 dart_sdk_tools_gypi_to_gn_path = |
| 27 rebase_path("tools/gypi_to_gn.py", "", dart_root) |
| 28 # The name of the SDK library being copied. |
| 29 lib_name = invoker.sdk_lib_name |
| 30 # The path to the libraries source directory. |
| 31 lib_path = rebase_path(lib_name, "", dart_sdk_sdk_lib_path) |
| 32 # The path to the sources gypi. |
| 33 lib_sources_gypi = lib_name + "_sources.gypi" |
| 34 # Get the contents of the gypi file. |
| 35 sdk_lib_sources_gypi = |
| 36 exec_script(dart_sdk_tools_gypi_to_gn_path, |
| 37 [rebase_path(lib_sources_gypi, "", lib_path)], |
| 38 "scope", |
| 39 [rebase_path(lib_sources_gypi, "", lib_path)]) |
| 40 copy(target_name) { |
| 41 sources = rebase_path(sdk_lib_sources_gypi.sources, "", lib_path) |
| 42 outputs = [ "$root_gen_dir/dart_sdk_libs/$lib_name/{{source_file_part}}" ] |
| 43 } |
| 44 } |
OLD | NEW |