mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 12:48:10 +00:00
[GN] Hack around Dart 2 application_snapshot deps issue
For Dart 2 snapshots, application_snapshots() hardcodes a deps on //utils/kernel-service:copy_kernel_service_snapshot related #33167 Change-Id: I9a598e83a3e8ebb9a27bfe83132f3a957f2fea0e Reviewed-on: https://dart-review.googlesource.com/56161 Reviewed-by: Nate Bosch <nbosch@google.com> Commit-Queue: Zach Anderson <zra@google.com>
This commit is contained in:
parent
298129c3a4
commit
a9ab8f4e7d
|
@ -15,6 +15,37 @@ declare_args() {
|
|||
}
|
||||
}
|
||||
|
||||
# Creates an app-jit snapshot for a Dart program based on a training run.
|
||||
#
|
||||
# Parameters:
|
||||
# main_dart (required):
|
||||
# The entrypoint to the Dart application.
|
||||
#
|
||||
# training_args (required):
|
||||
# Arguments to pass to the Dart application for the training run.
|
||||
#
|
||||
# dart_version (optional):
|
||||
# Must be 1 or 2. Defaults to 1.
|
||||
#
|
||||
# vm_args (optional):
|
||||
# Additional arguments to the Dart VM. Do not put --preview-dart-2 here.
|
||||
# Instead set dart_version = 2.
|
||||
#
|
||||
# name (optional):
|
||||
# The name of the snapshot if different from the target name. The output
|
||||
# will be in $root_gen_dir/$name.dart.snapshot.
|
||||
#
|
||||
# extra_deps (optional):
|
||||
# Any additional build dependencies.
|
||||
#
|
||||
# extra_inputs (optional):
|
||||
# Any extra build inputs.
|
||||
#
|
||||
# dot_packages (optional):
|
||||
# The .packages file for the app. Defaults to the $_dart_root/.packages.
|
||||
#
|
||||
# output (optional):
|
||||
# Overrides the full output path.
|
||||
template("application_snapshot") {
|
||||
assert(defined(invoker.main_dart), "Must specify 'main_dart'")
|
||||
assert(defined(invoker.training_args), "Must specify 'training_args'")
|
||||
|
@ -45,8 +76,25 @@ template("application_snapshot") {
|
|||
if (defined(invoker.output)) {
|
||||
output = invoker.output
|
||||
}
|
||||
dart_version = 1
|
||||
if (defined(invoker.dart_version)) {
|
||||
dart_version = invoker.dart_version
|
||||
}
|
||||
assert(dart_version == 1 || dart_version == 2,
|
||||
"For $target_name, dart_version must be 1 or 2")
|
||||
dart_action(target_name) {
|
||||
deps = extra_deps
|
||||
|
||||
if (dart_version == 2) {
|
||||
# HACK: When creating app-jit snapshots for Dart 2 apps, the standalone
|
||||
# Dart VM binary requires the app-jit snapshot for the kernel service to
|
||||
# be adjacent to it. This deps ensures that it is there, but a different
|
||||
# approach will be needed when the kernel service itself switches to
|
||||
# Dart 2 to avoid creating a circular dependence.
|
||||
deps += [ "$_dart_root/utils/kernel-service:copy_kernel_service_snapshot"]
|
||||
snapshot_vm_args += [ "--preview-dart-2" ]
|
||||
}
|
||||
|
||||
depfile = "$output.d"
|
||||
|
||||
script = main_dart
|
||||
|
|
|
@ -21,9 +21,7 @@ analyzer_files = exec_script("../../tools/list_dart_files.py",
|
|||
"list lines")
|
||||
|
||||
application_snapshot("generate_dartanalyzer_snapshot") {
|
||||
vm_args = [
|
||||
"--preview-dart-2",
|
||||
]
|
||||
dart_version = 2
|
||||
main_dart = "../../pkg/analyzer_cli/bin/analyzer.dart"
|
||||
training_args = [
|
||||
"--dart-sdk=" + rebase_path("../../sdk"),
|
||||
|
|
|
@ -11,9 +11,7 @@ sdk_summary = "$target_gen_dir/ddc_sdk.sum"
|
|||
sdk_dill = "$target_gen_dir/kernel/ddc_sdk.dill"
|
||||
|
||||
application_snapshot("dartdevc") {
|
||||
vm_args = [
|
||||
"--preview-dart-2",
|
||||
]
|
||||
dart_version = 2
|
||||
|
||||
main_dart = "../../pkg/dev_compiler/bin/dartdevc.dart"
|
||||
|
||||
|
|
|
@ -10,9 +10,7 @@ application_snapshot("pub") {
|
|||
}
|
||||
|
||||
application_snapshot("pub2") {
|
||||
dart_version = 2
|
||||
main_dart = "../../third_party/pkg/pub/bin/pub.dart"
|
||||
training_args = [ "--help" ]
|
||||
vm_args = [
|
||||
"--preview-dart-2",
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue