| OLD | NEW |
| 1 # Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2017, 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 import("../build/prebuilt_dart_sdk.gni") | 5 import("../build/prebuilt_dart_sdk.gni") |
| 6 | 6 |
| 7 _dart_root = get_path_info("..", "abspath") | 7 _dart_root = get_path_info("..", "abspath") |
| 8 | 8 |
| 9 # Template to generate a patched_sdk folder. This invokes the tools/patch_sdk.py | 9 # Template to generate a patched_sdk folder. This invokes the tools/patch_sdk.py |
| 10 # script and sets up the right dependencies. | 10 # script and sets up the right dependencies. |
| 11 # | 11 # |
| 12 # This template expects four arguments: | 12 # This template expects four arguments: |
| 13 # - mode: vm or dart2js (whether to build an sdk for the vm or for dart2js) | 13 # - mode: vm or dart2js (whether to build an sdk for the vm or for dart2js) |
| 14 # - input_patches_dir: directory containing the input library files. | 14 # - input_patches_dir: directory containing the input library files. |
| 15 # - patched_sdk_dir: the output location | 15 # - patched_sdk_dir: the output location |
| 16 # - deps: extra dependencies that must be built ahead of time. | 16 # - deps: extra dependencies that must be built ahead of time. |
| 17 template("generate_patched_sdk") { | 17 template("generate_patched_sdk") { |
| 18 assert(defined(invoker.input_patches_dir), | 18 assert(defined(invoker.input_patches_dir), |
| 19 "Need input_patches_dir in $target_name") | 19 "Need input_patches_dir in $target_name") |
| 20 assert(defined(invoker.patched_sdk_dir), | 20 assert(defined(invoker.patched_sdk_dir), |
| 21 "Need patched_sdk_dir in $target_name") | 21 "Need patched_sdk_dir in $target_name") |
| 22 assert(defined(invoker.mode), "Need mode in $target_name") | 22 assert(defined(invoker.mode), "Need mode in $target_name") |
| 23 action(target_name) { | 23 action(target_name) { |
| 24 | |
| 25 if (defined(invoker.deps)) { | 24 if (defined(invoker.deps)) { |
| 26 deps = invoker.deps | 25 deps = invoker.deps |
| 27 } else { | 26 } else { |
| 28 deps = [] | 27 deps = [] |
| 29 } | 28 } |
| 30 | 29 |
| 31 if (!prebuilt_dart_exe_works) { | 30 if (!prebuilt_dart_exe_works) { |
| 32 deps += ["$_dart_root/runtime/bin:dart_bootstrap($host_toolchain)"] | 31 deps += [ "$_dart_root/runtime/bin:dart_bootstrap_host_arch($host_toolchai
n)" ] |
| 33 } | 32 } |
| 34 | 33 |
| 35 script = "$_dart_root/tools/patch_sdk.py" | 34 script = "$_dart_root/tools/patch_sdk.py" |
| 36 | 35 |
| 37 # We list the `patch_sdk.dart` tool here because the [script] (which is | 36 # We list the `patch_sdk.dart` tool here because the [script] (which is |
| 38 # implicitly an input) will call it. | 37 # implicitly an input) will call it. |
| 39 inputs = [ | 38 inputs = [ |
| 40 "$_dart_root/tools/patch_sdk.dart", | 39 "$_dart_root/tools/patch_sdk.dart", |
| 41 ] | 40 ] |
| 42 | 41 |
| 43 depfile = "$root_out_dir/${target_name}.d" | 42 depfile = "$root_out_dir/${target_name}.d" |
| 44 | 43 |
| 45 outputs = [ | 44 outputs = [ |
| 46 # Instead of listing all outputs we list a single well-known one. | 45 # Instead of listing all outputs we list a single well-known one. |
| 47 "$root_out_dir/${invoker.patched_sdk_dir}/platform.dill", | 46 "$root_out_dir/${invoker.patched_sdk_dir}/platform.dill", |
| 48 ] | 47 ] |
| 49 | 48 |
| 50 args = [ "--quiet" ] | 49 args = [ "--quiet" ] |
| 51 if (!prebuilt_dart_exe_works) { | 50 if (!prebuilt_dart_exe_works) { |
| 52 dart_out_dir = get_label_info( | 51 dart_out_dir = get_label_info( |
| 53 "$_dart_root/runtime/bin:dart_bootstrap($host_toolchain)", | 52 "$_dart_root/runtime/bin:dart_bootstrap_host_arch($host_toolchain)
", |
| 54 "root_out_dir") | 53 "root_out_dir") |
| 55 dart_bootstrap = | 54 dart_bootstrap = rebase_path( |
| 56 rebase_path("$dart_out_dir/dart_bootstrap$executable_suffix") | 55 "$dart_out_dir/dart_bootstrap_host_arch$executable_suffix") |
| 57 args += [ | 56 args += [ |
| 58 "--dart-executable", | 57 "--dart-executable", |
| 59 dart_bootstrap, | 58 dart_bootstrap, |
| 60 ] | 59 ] |
| 61 } | 60 } |
| 62 args += [ | 61 args += [ |
| 63 invoker.mode, | 62 invoker.mode, |
| 64 rebase_path("$_dart_root/sdk"), | 63 rebase_path("$_dart_root/sdk"), |
| 65 rebase_path(invoker.input_patches_dir), | 64 rebase_path(invoker.input_patches_dir), |
| 66 rebase_path("$root_out_dir/${invoker.patched_sdk_dir}", root_build_dir), | 65 rebase_path("$root_out_dir/${invoker.patched_sdk_dir}", root_build_dir), |
| 67 rebase_path("$_dart_root/.packages"), | 66 rebase_path("$_dart_root/.packages"), |
| 68 ] | 67 ] |
| 69 } | 68 } |
| 70 } | 69 } |
| 71 | |
| OLD | NEW |