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