mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
[infra] Use dart_action() instead of python scripts
This change shifts logic for invoking Dart scripts during the build from a couple of python scripts to a new template called dart_action(). Change-Id: Ic0818122cd7317cbd22a7255d880fe8f87271b7e Reviewed-on: https://dart-review.googlesource.com/39260 Commit-Queue: Zach Anderson <zra@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
parent
079a4b08f5
commit
e842c9b0b5
|
@ -74,7 +74,7 @@ if (host_os == "win") {
|
||||||
_host_executable_suffix = ""
|
_host_executable_suffix = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
_dart_root = rebase_path("..")
|
_dart_root = get_path_info("..", "abspath")
|
||||||
|
|
||||||
template("compiled_action") {
|
template("compiled_action") {
|
||||||
assert(defined(invoker.tool), "tool must be defined for $target_name")
|
assert(defined(invoker.tool), "tool must be defined for $target_name")
|
||||||
|
@ -120,6 +120,10 @@ template("compiled_action") {
|
||||||
deps += invoker.deps
|
deps += invoker.deps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (defined(invoker.depfile)) {
|
||||||
|
depfile = invoker.depfile
|
||||||
|
}
|
||||||
|
|
||||||
# The script takes as arguments the binary to run, and then the arguments
|
# The script takes as arguments the binary to run, and then the arguments
|
||||||
# to pass it.
|
# to pass it.
|
||||||
args = [
|
args = [
|
||||||
|
@ -173,6 +177,10 @@ template("compiled_action_foreach") {
|
||||||
deps += invoker.deps
|
deps += invoker.deps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (defined(invoker.depfile)) {
|
||||||
|
depfile = invoker.depfile
|
||||||
|
}
|
||||||
|
|
||||||
# The script takes as arguments the binary to run, and then the arguments
|
# The script takes as arguments the binary to run, and then the arguments
|
||||||
# to pass it.
|
# to pass it.
|
||||||
args = [
|
args = [
|
||||||
|
|
92
build/dart_action.gni
Normal file
92
build/dart_action.gni
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
# Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
|
||||||
|
# for details. All rights reserved. Use of this source code is governed by a
|
||||||
|
# BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
import("compiled_action.gni")
|
||||||
|
import("executable_suffix.gni")
|
||||||
|
import("prebuilt_dart_sdk.gni")
|
||||||
|
|
||||||
|
_dart_root = get_path_info("..", "abspath")
|
||||||
|
|
||||||
|
# A template for running Dart scripts during the build. This should *not* be
|
||||||
|
# used for generating snapshots. It uses the dart binary from the prebuilt
|
||||||
|
# Dart SDK if one is available, and dart_bootstrap otherwise.
|
||||||
|
#
|
||||||
|
# Parameters:
|
||||||
|
# script:
|
||||||
|
# The un-rebased path to the Dart script.
|
||||||
|
#
|
||||||
|
# args:
|
||||||
|
# The arguments to pass to the Dart script.
|
||||||
|
|
||||||
|
# packages (optional):
|
||||||
|
# The un-rebased path to the .packages file.
|
||||||
|
#
|
||||||
|
# Forwarded to action() with the usual meaning:
|
||||||
|
# depfile
|
||||||
|
# deps
|
||||||
|
# inputs
|
||||||
|
# outputs
|
||||||
|
# visibility
|
||||||
|
template("dart_action") {
|
||||||
|
assert(defined(invoker.script), "script must be defined for $target_name")
|
||||||
|
assert(defined(invoker.outputs), "outputs must be defined for $target_name")
|
||||||
|
assert(defined(invoker.args), "args must be defined for $target_name")
|
||||||
|
assert(!defined(invoker.sources),
|
||||||
|
"dart_action doesn't take a sources arg. Use inputs instead.")
|
||||||
|
|
||||||
|
if (prebuilt_dart_exe_works) {
|
||||||
|
action(target_name) {
|
||||||
|
forward_variables_from(invoker, [
|
||||||
|
"inputs",
|
||||||
|
"outputs",
|
||||||
|
"deps",
|
||||||
|
"visibility",
|
||||||
|
"depfile",
|
||||||
|
])
|
||||||
|
script = "$_dart_root/build/gn_run_binary.py"
|
||||||
|
prebuilt_dart_binary =
|
||||||
|
"$_dart_root/tools/sdks/$host_os/dart-sdk/bin/dart$executable_suffix"
|
||||||
|
|
||||||
|
inputs += [ invoker.script ]
|
||||||
|
if (defined(invoker.packages)) {
|
||||||
|
inputs += [ invoker.packages ]
|
||||||
|
}
|
||||||
|
|
||||||
|
args = [
|
||||||
|
"compiled_action",
|
||||||
|
rebase_path(prebuilt_dart_binary),
|
||||||
|
]
|
||||||
|
if (defined(invoker.packages)) {
|
||||||
|
args += [
|
||||||
|
"--packages=" + rebase_path(invoker.packages),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
args += [ rebase_path(invoker.script) ] + invoker.args
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
compiled_action(target_name) {
|
||||||
|
forward_variables_from(invoker, [
|
||||||
|
"inputs",
|
||||||
|
"outputs",
|
||||||
|
"deps",
|
||||||
|
"visibility",
|
||||||
|
"depfile",
|
||||||
|
])
|
||||||
|
|
||||||
|
inputs += [ invoker.script ]
|
||||||
|
if (defined(invoker.packages)) {
|
||||||
|
inputs += [ invoker.packages ]
|
||||||
|
}
|
||||||
|
|
||||||
|
tool = "runtime/bin:dart_bootstrap"
|
||||||
|
args = []
|
||||||
|
if (defined(invoker.packages)) {
|
||||||
|
args += [
|
||||||
|
"--packages=" + rebase_path(invoker.packages),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
args += [ rebase_path(invoker.script) ] + invoker.args
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,63 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
|
|
||||||
# for details. All rights reserved. Use of this source code is governed by a
|
|
||||||
# BSD-style license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
import utils
|
|
||||||
|
|
||||||
usage = """patch_sdk.py [options]"""
|
|
||||||
|
|
||||||
def DisplayBootstrapWarning():
|
|
||||||
print """\
|
|
||||||
|
|
||||||
|
|
||||||
WARNING: Your system cannot run the checked-in Dart SDK. Using the
|
|
||||||
bootstrap Dart executable will make debug builds slow.
|
|
||||||
Please see the Wiki for instructions on replacing the checked-in Dart SDK.
|
|
||||||
|
|
||||||
https://github.com/dart-lang/sdk/wiki/The-checked-in-SDK-in-tools
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
def BuildArguments():
|
|
||||||
result = argparse.ArgumentParser(usage=usage)
|
|
||||||
result.add_argument("-q", "--quiet",
|
|
||||||
help="emit no output",
|
|
||||||
default=False,
|
|
||||||
action="store_true")
|
|
||||||
result.add_argument("--dart-executable",
|
|
||||||
help="dart executable",
|
|
||||||
default=None)
|
|
||||||
result.add_argument("--script",
|
|
||||||
help="patch script to run",
|
|
||||||
default=None)
|
|
||||||
return result
|
|
||||||
|
|
||||||
def main():
|
|
||||||
# Parse the options.
|
|
||||||
parser = BuildArguments()
|
|
||||||
(options, args) = parser.parse_known_args()
|
|
||||||
if utils.CheckedInSdkCheckExecutable():
|
|
||||||
options.dart_executable = utils.CheckedInSdkExecutable()
|
|
||||||
elif options.dart_executable is not None:
|
|
||||||
if not options.quiet:
|
|
||||||
DisplayBootstrapWarning()
|
|
||||||
options.dart_executable = os.path.abspath(options.dart_executable)
|
|
||||||
else:
|
|
||||||
print >> sys.stderr, 'ERROR: cannot locate dart executable'
|
|
||||||
return -1
|
|
||||||
|
|
||||||
if options.script is not None:
|
|
||||||
dart_file = options.script
|
|
||||||
else:
|
|
||||||
dart_file = os.path.join(os.path.dirname(__file__), 'patch_sdk.dart')
|
|
||||||
|
|
||||||
subprocess.check_call([options.dart_executable, dart_file] + args)
|
|
||||||
return 0
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.exit(main())
|
|
|
@ -1,60 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
|
|
||||||
# for details. All rights reserved. Use of this source code is governed by a
|
|
||||||
# BSD-style license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
import utils
|
|
||||||
|
|
||||||
usage = """run_dart.py [--dart=<path>] <script> args..."""
|
|
||||||
|
|
||||||
def DisplayBootstrapWarning():
|
|
||||||
print """\
|
|
||||||
|
|
||||||
|
|
||||||
WARNING: Your system cannot run the checked-in Dart SDK. Using the
|
|
||||||
bootstrap Dart executable will make debug builds slow.
|
|
||||||
Please see the Wiki for instructions on replacing the checked-in Dart SDK.
|
|
||||||
|
|
||||||
https://github.com/dart-lang/sdk/wiki/The-checked-in-SDK-in-tools
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
def BuildArguments():
|
|
||||||
result = argparse.ArgumentParser(usage=usage)
|
|
||||||
result.add_argument("--dart",
|
|
||||||
help="dart executable",
|
|
||||||
default=None)
|
|
||||||
result.add_argument("-q", "--quiet",
|
|
||||||
help="emit no output",
|
|
||||||
default=False,
|
|
||||||
action="store_true")
|
|
||||||
return result
|
|
||||||
|
|
||||||
def main():
|
|
||||||
# Parse the options.
|
|
||||||
parser = BuildArguments()
|
|
||||||
(options, args) = parser.parse_known_args()
|
|
||||||
if utils.CheckedInSdkCheckExecutable():
|
|
||||||
options.dart = utils.CheckedInSdkExecutable()
|
|
||||||
elif options.dart is not None:
|
|
||||||
DisplayBootstrapWarning()
|
|
||||||
options.dart = os.path.abspath(options.dart)
|
|
||||||
else:
|
|
||||||
print >> sys.stderr, 'ERROR: cannot locate dart executable'
|
|
||||||
return -1
|
|
||||||
|
|
||||||
if options.quiet:
|
|
||||||
# Pipe output to /dev/null. See https://stackoverflow.com/a/14736249/9457.
|
|
||||||
out = open(os.devnull, 'w')
|
|
||||||
else:
|
|
||||||
out = None
|
|
||||||
|
|
||||||
return subprocess.call([options.dart] + args,
|
|
||||||
stdout=out, stderr=out)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.exit(main())
|
|
|
@ -56,7 +56,7 @@ template("application_snapshot") {
|
||||||
]
|
]
|
||||||
|
|
||||||
abs_depfile = rebase_path(depfile)
|
abs_depfile = rebase_path(depfile)
|
||||||
abs_output = rebase_path(output)
|
abs_output = rebase_path(output, root_build_dir)
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"--deterministic",
|
"--deterministic",
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
# for details. All rights reserved. Use of this source code is governed by a
|
# for details. All rights reserved. Use of this source code is governed by a
|
||||||
# BSD-style license that can be found in the LICENSE file.
|
# BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
import("../../build/compiled_action.gni")
|
import("../../build/dart_action.gni")
|
||||||
import("../../build/prebuilt_dart_sdk.gni")
|
|
||||||
import("../application_snapshot.gni")
|
import("../application_snapshot.gni")
|
||||||
|
|
||||||
group("dartanalyzer") {
|
group("dartanalyzer") {
|
||||||
|
@ -48,42 +47,16 @@ template("generate_summary") {
|
||||||
assert(defined(invoker.type), "Must specify the summary type")
|
assert(defined(invoker.type), "Must specify the summary type")
|
||||||
type = invoker.type
|
type = invoker.type
|
||||||
assert(type == "spec" || type == "strong")
|
assert(type == "spec" || type == "strong")
|
||||||
action(target_name) {
|
|
||||||
|
|
||||||
if (!prebuilt_dart_exe_works) {
|
|
||||||
deps = [ "../../runtime/bin:dart_bootstrap($dart_host_toolchain)" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
script = "../../tools/run_dart.py"
|
|
||||||
|
|
||||||
args = []
|
|
||||||
if (!prebuilt_dart_exe_works) {
|
|
||||||
dart_out_dir = get_label_info(
|
|
||||||
"../../runtime/bin:dart_bootstrap($dart_host_toolchain)",
|
|
||||||
"root_out_dir")
|
|
||||||
dart_bootstrap =
|
|
||||||
rebase_path("$dart_out_dir/dart_bootstrap$executable_suffix")
|
|
||||||
args += [
|
|
||||||
"--dart",
|
|
||||||
dart_bootstrap,
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
dart_action(target_name) {
|
||||||
|
script = "../../pkg/analyzer/tool/summary/build_sdk_summaries.dart"
|
||||||
|
packages = "../../.packages"
|
||||||
inputs = sdk_lib_files + analyzer_files
|
inputs = sdk_lib_files + analyzer_files
|
||||||
|
|
||||||
output = "$root_gen_dir/$type.sum"
|
output = "$root_gen_dir/$type.sum"
|
||||||
outputs = [
|
outputs = [
|
||||||
output,
|
output,
|
||||||
]
|
]
|
||||||
|
args = [
|
||||||
dot_packages = rebase_path("../../.packages")
|
|
||||||
build_sdk_summaries =
|
|
||||||
rebase_path("../../pkg/analyzer/tool/summary/build_sdk_summaries.dart")
|
|
||||||
|
|
||||||
args += [
|
|
||||||
"--quiet",
|
|
||||||
"--packages=$dot_packages",
|
|
||||||
build_sdk_summaries,
|
|
||||||
"build-$type",
|
"build-$type",
|
||||||
rebase_path(output),
|
rebase_path(output),
|
||||||
rebase_path("../../sdk"),
|
rebase_path("../../sdk"),
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
# for details. All rights reserved. Use of this source code is governed by a
|
# for details. All rights reserved. Use of this source code is governed by a
|
||||||
# BSD-style license that can be found in the LICENSE file.
|
# BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
import("../../build/dart_action.gni")
|
||||||
import("../../build/prebuilt_dart_sdk.gni")
|
import("../../build/prebuilt_dart_sdk.gni")
|
||||||
import("../application_snapshot.gni")
|
import("../application_snapshot.gni")
|
||||||
import("../create_timestamp.gni")
|
import("../create_timestamp.gni")
|
||||||
|
@ -127,7 +128,7 @@ dart2js_compile("stack_trace_mapper") {
|
||||||
|
|
||||||
# Apply dev_compiler's patch files to create the Dart version of the dartdevc
|
# Apply dev_compiler's patch files to create the Dart version of the dartdevc
|
||||||
# SDK.
|
# SDK.
|
||||||
action("dartdevc_patch_sdk") {
|
dart_action("dartdevc_patch_sdk") {
|
||||||
# TODO(rnystrom): Unfork DDC's patch_sdk.dart script with the
|
# TODO(rnystrom): Unfork DDC's patch_sdk.dart script with the
|
||||||
# tools/patch_sdk.dart and then change this to use generate_patch_sdk().
|
# tools/patch_sdk.dart and then change this to use generate_patch_sdk().
|
||||||
deps = [
|
deps = [
|
||||||
|
@ -138,20 +139,10 @@ action("dartdevc_patch_sdk") {
|
||||||
"../../pkg:pkg_files_stamp",
|
"../../pkg:pkg_files_stamp",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (!prebuilt_dart_exe_works) {
|
script = "../../pkg/dev_compiler/tool/patch_sdk.dart"
|
||||||
deps += [ "../../runtime/bin:dart_bootstrap($dart_host_toolchain)" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
script = "../../tools/patch_sdk.py"
|
|
||||||
|
|
||||||
# We list the `patch_sdk.dart` tool here because the [script] (which is
|
|
||||||
# implicitly an input) will call it.
|
|
||||||
inputs = [
|
|
||||||
"../../pkg/dev_compiler/tool/patch_sdk.dart",
|
|
||||||
]
|
|
||||||
|
|
||||||
# The main SDK library sources.
|
# The main SDK library sources.
|
||||||
inputs += sdk_lib_files
|
inputs = sdk_lib_files
|
||||||
|
|
||||||
# dev_compiler's additional sources and patch files.
|
# dev_compiler's additional sources and patch files.
|
||||||
inputs += exec_script("../../tools/list_dart_files.py",
|
inputs += exec_script("../../tools/list_dart_files.py",
|
||||||
|
@ -168,22 +159,7 @@ action("dartdevc_patch_sdk") {
|
||||||
"$patched_sdk_dir/version",
|
"$patched_sdk_dir/version",
|
||||||
]
|
]
|
||||||
|
|
||||||
args = []
|
args = [
|
||||||
if (!prebuilt_dart_exe_works) {
|
|
||||||
dart_out_dir = get_label_info(
|
|
||||||
"../../runtime/bin:dart_bootstrap($dart_host_toolchain)",
|
|
||||||
"root_out_dir")
|
|
||||||
dart_bootstrap =
|
|
||||||
rebase_path("$dart_out_dir/dart_bootstrap$executable_suffix")
|
|
||||||
args += [
|
|
||||||
"--dart-executable",
|
|
||||||
dart_bootstrap,
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
args += [
|
|
||||||
"--script",
|
|
||||||
rebase_path("../../pkg/dev_compiler/tool/patch_sdk.dart"),
|
|
||||||
rebase_path("../../"),
|
rebase_path("../../"),
|
||||||
rebase_path("../../pkg/dev_compiler/tool/input_sdk"),
|
rebase_path("../../pkg/dev_compiler/tool/input_sdk"),
|
||||||
rebase_path(patched_sdk_dir),
|
rebase_path(patched_sdk_dir),
|
||||||
|
@ -192,56 +168,14 @@ action("dartdevc_patch_sdk") {
|
||||||
|
|
||||||
# Compiles the Dart core libraries and DDC runtime to an analyzer summary and
|
# Compiles the Dart core libraries and DDC runtime to an analyzer summary and
|
||||||
# JS.
|
# JS.
|
||||||
action("dartdevc_sdk") {
|
dart_action("dartdevc_sdk") {
|
||||||
deps = [
|
deps = [
|
||||||
":dartdevc_files_stamp",
|
":dartdevc_files_stamp",
|
||||||
":dartdevc_patch_sdk",
|
":dartdevc_patch_sdk",
|
||||||
"../../pkg:pkg_files_stamp",
|
"../../pkg:pkg_files_stamp",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (!prebuilt_dart_exe_works) {
|
script = "../../pkg/dev_compiler/tool/build_sdk.dart"
|
||||||
deps += [ "../../runtime/bin:dart_bootstrap($dart_host_toolchain)" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
script = "../../tools/run_dart.py"
|
|
||||||
|
|
||||||
args = []
|
|
||||||
if (!prebuilt_dart_exe_works) {
|
|
||||||
dart_out_dir = get_label_info(
|
|
||||||
"../../runtime/bin:dart_bootstrap($dart_host_toolchain)",
|
|
||||||
"root_out_dir")
|
|
||||||
dart_bootstrap =
|
|
||||||
rebase_path("$dart_out_dir/dart_bootstrap$executable_suffix")
|
|
||||||
args += [
|
|
||||||
"--dart",
|
|
||||||
dart_bootstrap,
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
args += [
|
|
||||||
"--quiet",
|
|
||||||
rebase_path("../../pkg/dev_compiler/tool/build_sdk.dart"),
|
|
||||||
"--dart-sdk",
|
|
||||||
rebase_path(patched_sdk_dir),
|
|
||||||
"--dart-sdk-summary=build",
|
|
||||||
"--summary-out",
|
|
||||||
rebase_path(sdk_summary),
|
|
||||||
"--source-map",
|
|
||||||
"--source-map-comment",
|
|
||||||
"--inline-source-map",
|
|
||||||
"--modules=amd",
|
|
||||||
"-o",
|
|
||||||
rebase_path("$target_gen_dir/js/amd/dart_sdk.js"),
|
|
||||||
"--modules=es6",
|
|
||||||
"-o",
|
|
||||||
rebase_path("$target_gen_dir/js/es6/dart_sdk.js"),
|
|
||||||
"--modules=common",
|
|
||||||
"-o",
|
|
||||||
rebase_path("$target_gen_dir/js/common/dart_sdk.js"),
|
|
||||||
"--modules=legacy",
|
|
||||||
"-o",
|
|
||||||
rebase_path("$target_gen_dir/js/legacy/dart_sdk.js"),
|
|
||||||
]
|
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
"../../pkg/dev_compiler/tool/build_sdk.dart",
|
"../../pkg/dev_compiler/tool/build_sdk.dart",
|
||||||
|
@ -271,6 +205,29 @@ action("dartdevc_sdk") {
|
||||||
"$target_gen_dir/js/legacy/dart_sdk.js",
|
"$target_gen_dir/js/legacy/dart_sdk.js",
|
||||||
"$target_gen_dir/js/legacy/dart_sdk.js.map",
|
"$target_gen_dir/js/legacy/dart_sdk.js.map",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
args = [
|
||||||
|
"--dart-sdk",
|
||||||
|
rebase_path(patched_sdk_dir),
|
||||||
|
"--dart-sdk-summary=build",
|
||||||
|
"--summary-out",
|
||||||
|
rebase_path(sdk_summary),
|
||||||
|
"--source-map",
|
||||||
|
"--source-map-comment",
|
||||||
|
"--inline-source-map",
|
||||||
|
"--modules=amd",
|
||||||
|
"-o",
|
||||||
|
rebase_path("$target_gen_dir/js/amd/dart_sdk.js"),
|
||||||
|
"--modules=es6",
|
||||||
|
"-o",
|
||||||
|
rebase_path("$target_gen_dir/js/es6/dart_sdk.js"),
|
||||||
|
"--modules=common",
|
||||||
|
"-o",
|
||||||
|
rebase_path("$target_gen_dir/js/common/dart_sdk.js"),
|
||||||
|
"--modules=legacy",
|
||||||
|
"-o",
|
||||||
|
rebase_path("$target_gen_dir/js/legacy/dart_sdk.js"),
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Builds everything needed to run dartdevc and dartdevk tests using test.dart.
|
# Builds everything needed to run dartdevc and dartdevk tests using test.dart.
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
# for details. All rights reserved. Use of this source code is governed by a
|
# for details. All rights reserved. Use of this source code is governed by a
|
||||||
# BSD-style license that can be found in the LICENSE file.
|
# BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
import("../build/dart_action.gni")
|
||||||
import("../build/dart_host_sdk_toolchain.gni")
|
import("../build/dart_host_sdk_toolchain.gni")
|
||||||
import("../build/prebuilt_dart_sdk.gni")
|
import("../build/prebuilt_dart_sdk.gni")
|
||||||
|
|
||||||
_dart_root = get_path_info("..", "abspath")
|
_dart_root = get_path_info("..", "abspath")
|
||||||
|
|
||||||
# Template to generate a patched_sdk folder. This invokes the tools/patch_sdk.py
|
# Template to generate a patched_sdk folder.
|
||||||
# script and sets up the right dependencies.
|
|
||||||
#
|
#
|
||||||
# This template expects four arguments:
|
# This template expects four arguments:
|
||||||
# - mode: vm or dart2js (whether to build an sdk for the vm or for dart2js)
|
# - mode: vm or dart2js (whether to build an sdk for the vm or for dart2js)
|
||||||
|
@ -21,26 +21,15 @@ template("generate_patched_sdk") {
|
||||||
assert(defined(invoker.patched_sdk_dir),
|
assert(defined(invoker.patched_sdk_dir),
|
||||||
"Need patched_sdk_dir in $target_name")
|
"Need patched_sdk_dir in $target_name")
|
||||||
assert(defined(invoker.mode), "Need mode in $target_name")
|
assert(defined(invoker.mode), "Need mode in $target_name")
|
||||||
action(target_name) {
|
|
||||||
if (defined(invoker.deps)) {
|
|
||||||
deps = invoker.deps
|
|
||||||
} else {
|
|
||||||
deps = []
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!prebuilt_dart_exe_works) {
|
dart_action(target_name) {
|
||||||
deps += [ "$_dart_root/runtime/bin:dart_bootstrap($dart_host_toolchain)" ]
|
forward_variables_from(invoker, [
|
||||||
}
|
"deps",
|
||||||
|
])
|
||||||
|
|
||||||
script = "$_dart_root/tools/patch_sdk.py"
|
depfile = "$root_out_dir/${target_name}_patched_sdk.d"
|
||||||
|
|
||||||
# We list the `patch_sdk.dart` tool here because the [script] (which is
|
script = "$_dart_root/tools/patch_sdk.dart"
|
||||||
# implicitly an input) will call it.
|
|
||||||
inputs = [
|
|
||||||
"$_dart_root/tools/patch_sdk.dart",
|
|
||||||
]
|
|
||||||
|
|
||||||
depfile = "$root_out_dir/${target_name}.d"
|
|
||||||
|
|
||||||
if (defined(invoker.outputs)) {
|
if (defined(invoker.outputs)) {
|
||||||
outputs = invoker.outputs
|
outputs = invoker.outputs
|
||||||
|
@ -53,19 +42,7 @@ template("generate_patched_sdk") {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
args = [ "--quiet" ]
|
args = [
|
||||||
if (!prebuilt_dart_exe_works) {
|
|
||||||
dart_out_dir = get_label_info(
|
|
||||||
"$_dart_root/runtime/bin:dart_bootstrap($dart_host_toolchain)",
|
|
||||||
"root_out_dir")
|
|
||||||
dart_bootstrap =
|
|
||||||
rebase_path("$dart_out_dir/dart_bootstrap$executable_suffix")
|
|
||||||
args += [
|
|
||||||
"--dart-executable",
|
|
||||||
dart_bootstrap,
|
|
||||||
]
|
|
||||||
}
|
|
||||||
args += [
|
|
||||||
invoker.mode,
|
invoker.mode,
|
||||||
rebase_path("$_dart_root/sdk"),
|
rebase_path("$_dart_root/sdk"),
|
||||||
rebase_path(invoker.input_patches_dir),
|
rebase_path(invoker.input_patches_dir),
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
# for details. All rights reserved. Use of this source code is governed by a
|
# for details. All rights reserved. Use of this source code is governed by a
|
||||||
# BSD-style license that can be found in the LICENSE file.
|
# BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
import("../../build/dart_action.gni")
|
||||||
import("../../build/dart_host_sdk_toolchain.gni")
|
import("../../build/dart_host_sdk_toolchain.gni")
|
||||||
import("../application_snapshot.gni")
|
import("../application_snapshot.gni")
|
||||||
|
|
||||||
|
@ -23,18 +24,17 @@ copy("copy_kernel_service_snapshot") {
|
||||||
":kernel-service",
|
":kernel-service",
|
||||||
]
|
]
|
||||||
sources = [
|
sources = [
|
||||||
rebase_path("$root_gen_dir/kernel-service.dart.snapshot"),
|
"$root_gen_dir/kernel-service.dart.snapshot",
|
||||||
]
|
]
|
||||||
outputs = [
|
outputs = [
|
||||||
"$root_out_dir/kernel-service.dart.snapshot",
|
"$root_out_dir/kernel-service.dart.snapshot",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
compiled_action("kernel_service_dill") {
|
dart_action("kernel_service_dill") {
|
||||||
deps = [
|
deps = [
|
||||||
"../../runtime/vm:vm_legacy_platform",
|
"../../runtime/vm:vm_legacy_platform",
|
||||||
]
|
]
|
||||||
tool = "../../runtime/bin:dart_bootstrap"
|
|
||||||
kernel_service_script = "../../pkg/vm/bin/kernel_service.dart"
|
kernel_service_script = "../../pkg/vm/bin/kernel_service.dart"
|
||||||
gen_kernel_script = "../../pkg/vm/bin/gen_kernel.dart"
|
gen_kernel_script = "../../pkg/vm/bin/gen_kernel.dart"
|
||||||
|
|
||||||
|
@ -47,11 +47,12 @@ compiled_action("kernel_service_dill") {
|
||||||
"$root_gen_dir/kernel_service.dill",
|
"$root_gen_dir/kernel_service.dill",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
script = gen_kernel_script
|
||||||
|
|
||||||
# TODO: Switch over to vm_platform_strong.dill and remove the
|
# TODO: Switch over to vm_platform_strong.dill and remove the
|
||||||
# flags --no-strong-mode once https://github.com/dart-lang/sdk/issues/31623
|
# flags --no-strong-mode once https://github.com/dart-lang/sdk/issues/31623
|
||||||
# is fixed.
|
# is fixed.
|
||||||
args = [
|
args = [
|
||||||
rebase_path(gen_kernel_script),
|
|
||||||
"--packages=file:///" + rebase_path("../../.packages"),
|
"--packages=file:///" + rebase_path("../../.packages"),
|
||||||
"--platform=file:///" + rebase_path("$root_out_dir/vm_platform.dill"),
|
"--platform=file:///" + rebase_path("$root_out_dir/vm_platform.dill"),
|
||||||
"--no-aot",
|
"--no-aot",
|
||||||
|
|
Loading…
Reference in a new issue