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