2016-09-29 20:23:00 +00:00
|
|
|
# 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.
|
|
|
|
|
2018-05-03 21:07:13 +00:00
|
|
|
import("../build/dart/dart_action.gni")
|
2018-08-21 20:28:06 +00:00
|
|
|
import("../runtime/runtime_args.gni")
|
2019-12-13 20:13:20 +00:00
|
|
|
import("../sdk_args.gni")
|
2016-09-29 20:23:00 +00:00
|
|
|
|
2017-05-01 22:58:34 +00:00
|
|
|
_dart_root = get_path_info("..", "abspath")
|
2016-09-29 20:23:00 +00:00
|
|
|
|
2017-05-08 20:06:05 +00:00
|
|
|
declare_args() {
|
|
|
|
# Default to building app-jit snapshots. The simulator and cross builds
|
|
|
|
# override this to script snapshots to cut down on build time.
|
2017-06-13 15:48:53 +00:00
|
|
|
if (target_cpu != host_cpu) {
|
2018-09-26 22:49:27 +00:00
|
|
|
dart_snapshot_kind = "kernel"
|
2018-08-21 20:28:06 +00:00
|
|
|
} else {
|
|
|
|
dart_snapshot_kind = "app-jit"
|
2017-06-13 15:48:53 +00:00
|
|
|
}
|
2017-05-08 20:06:05 +00:00
|
|
|
}
|
|
|
|
|
2018-05-22 17:47:16 +00:00
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
# vm_args (optional):
|
2018-08-21 20:28:06 +00:00
|
|
|
# Additional arguments to the Dart VM.
|
2018-05-22 17:47:16 +00:00
|
|
|
#
|
|
|
|
# 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.
|
2018-08-21 20:28:06 +00:00
|
|
|
template("_application_snapshot") {
|
2016-09-29 20:23:00 +00:00
|
|
|
assert(defined(invoker.main_dart), "Must specify 'main_dart'")
|
2016-10-22 00:40:21 +00:00
|
|
|
assert(defined(invoker.training_args), "Must specify 'training_args'")
|
2020-08-10 22:26:24 +00:00
|
|
|
if (defined(invoker.dart_snapshot_kind)) {
|
|
|
|
dart_snapshot_kind = invoker.dart_snapshot_kind
|
|
|
|
}
|
2018-05-03 21:07:13 +00:00
|
|
|
snapshot_vm_args = []
|
2018-01-16 19:52:22 +00:00
|
|
|
if (defined(invoker.vm_args)) {
|
2018-05-03 21:07:13 +00:00
|
|
|
snapshot_vm_args = invoker.vm_args
|
2018-01-16 19:52:22 +00:00
|
|
|
}
|
2016-09-29 20:23:00 +00:00
|
|
|
main_dart = invoker.main_dart
|
2016-10-22 00:40:21 +00:00
|
|
|
training_args = invoker.training_args
|
2016-09-29 20:23:00 +00:00
|
|
|
name = target_name
|
|
|
|
if (defined(invoker.name)) {
|
|
|
|
name = invoker.name
|
|
|
|
}
|
|
|
|
extra_deps = []
|
|
|
|
if (defined(invoker.deps)) {
|
|
|
|
extra_deps += invoker.deps
|
|
|
|
}
|
2017-06-13 15:48:53 +00:00
|
|
|
extra_inputs = [ main_dart ]
|
2016-09-29 20:23:00 +00:00
|
|
|
if (defined(invoker.inputs)) {
|
|
|
|
extra_inputs += invoker.inputs
|
|
|
|
}
|
2017-08-15 23:10:17 +00:00
|
|
|
if (defined(invoker.dot_packages)) {
|
|
|
|
dot_packages = invoker.dot_packages
|
|
|
|
} else {
|
|
|
|
dot_packages = rebase_path("$_dart_root/.packages")
|
|
|
|
}
|
2018-03-01 22:39:39 +00:00
|
|
|
output = "$root_gen_dir/$name.dart.snapshot"
|
|
|
|
if (defined(invoker.output)) {
|
|
|
|
output = invoker.output
|
|
|
|
}
|
2019-09-18 02:53:44 +00:00
|
|
|
|
|
|
|
# Build the kernel file using the prebuilt VM to speed up the debug and
|
|
|
|
# simulator builds.
|
|
|
|
prebuilt_dart_action(target_name + "_dill") {
|
2019-09-27 21:14:11 +00:00
|
|
|
deps = extra_deps + [
|
|
|
|
"$_dart_root/runtime/vm:kernel_platform_files($host_toolchain)",
|
|
|
|
"$_dart_root/runtime/vm:vm_platform",
|
2021-04-27 17:22:54 +00:00
|
|
|
"$_dart_root/utils/gen_kernel:bootstrap_gen_kernel",
|
2019-09-27 21:14:11 +00:00
|
|
|
]
|
2021-04-27 17:22:54 +00:00
|
|
|
gen_kernel_kernel =
|
|
|
|
get_label_info("$_dart_root/utils/gen_kernel:bootstrap_gen_kernel",
|
|
|
|
"target_gen_dir") + "/bootstrap_gen_kernel.dill"
|
2019-09-18 02:53:44 +00:00
|
|
|
platform_dill = "$root_out_dir/vm_platform_strong.dill"
|
|
|
|
|
|
|
|
inputs = extra_inputs + [
|
2021-04-27 17:22:54 +00:00
|
|
|
gen_kernel_kernel,
|
2019-09-18 02:53:44 +00:00
|
|
|
platform_dill,
|
|
|
|
main_dart,
|
|
|
|
dot_packages,
|
|
|
|
]
|
|
|
|
output = "$target_gen_dir/$name.dart.dill"
|
2020-03-10 21:56:11 +00:00
|
|
|
outputs = [ output ]
|
2019-09-18 02:53:44 +00:00
|
|
|
|
|
|
|
depfile = "$output.d"
|
2020-07-07 06:08:20 +00:00
|
|
|
|
2019-09-18 02:53:44 +00:00
|
|
|
vm_args = [
|
2020-07-16 18:43:24 +00:00
|
|
|
# Ensure gen_kernel.dart will use this SDK hash when consuming/producing kernel.
|
2020-07-07 06:08:20 +00:00
|
|
|
"-Dsdk_hash=$sdk_hash",
|
2019-09-18 02:53:44 +00:00
|
|
|
]
|
|
|
|
|
2021-04-27 17:22:54 +00:00
|
|
|
script = gen_kernel_kernel
|
2019-09-18 02:53:44 +00:00
|
|
|
|
|
|
|
args = [
|
|
|
|
"--packages=" + rebase_path(dot_packages),
|
|
|
|
"--platform=" + rebase_path(platform_dill),
|
|
|
|
"--no-aot",
|
|
|
|
"--no-embed-sources",
|
|
|
|
"--no-link-platform",
|
2021-04-27 17:22:54 +00:00
|
|
|
"--output=" + rebase_path(output, root_build_dir),
|
|
|
|
"--depfile=" + rebase_path(depfile),
|
2020-07-16 18:43:24 +00:00
|
|
|
|
|
|
|
# Ensure the compiled appliation (e.g. kernel-service, frontend-server,
|
|
|
|
# ...) will use this SDK hash when consuming/producing kernel.
|
|
|
|
#
|
|
|
|
# (Instead of ensuring every user of the "application_snapshot" /
|
|
|
|
# "kernel_snapshot" passes this if needed, we always pass it)
|
|
|
|
"-Dsdk_hash=$sdk_hash",
|
2019-09-18 02:53:44 +00:00
|
|
|
]
|
|
|
|
args += [ rebase_path(main_dart) ]
|
|
|
|
}
|
|
|
|
|
[SDK] Fix VM/kernel version mix in build.
Several people have experienced build issues traced back to
target `//utils/dartanalyzer:generate_summary_strong`.
The issue is triggered by the sdk_hash changing with an old
kernel-service snapshot in the out/ folder.
`generate_summary_strong` uses but does not explicitly depend on
the kernel-service, causing the outdated dependency.
This then causes 'Unexpected Kernel SDK Version' when the new dart
binary tried to load the old kernel-service snapshot.
Tested:
1. Clean build of create_sdk at HEAD.
2. Empty `git commit --amend` to modify commit and thus sdk hash.
3. Rebuild of create_sdk (which failed before).
Cq-Include-Trybots: dart/try:analyzer-analysis-server-linux-try,analyzer-linux-release-try,analyzer-mac-release-try,analyzer-nnbd-linux-release-try,analyzer-win-release-try,benchmark-linux-try,dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,dart-sdk-win-try,flutter-analyze-try,front-end-linux-release-x64-try,pkg-linux-release-try,vm-kernel-linux-release-x64-try
Change-Id: Iba07e9d0c5daa7a93870fb501d9bb57682c88a5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156913
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-08-05 11:46:28 +00:00
|
|
|
# Create a snapshot from kernel built above.
|
2018-05-03 21:07:13 +00:00
|
|
|
dart_action(target_name) {
|
2019-09-18 02:53:44 +00:00
|
|
|
deps = extra_deps + [ ":${target_name}_dill" ]
|
2018-03-01 22:39:39 +00:00
|
|
|
depfile = "$output.d"
|
2016-09-29 20:23:00 +00:00
|
|
|
|
2019-09-18 02:53:44 +00:00
|
|
|
script = "$target_gen_dir/$name.dart.dill"
|
2017-12-05 17:09:52 +00:00
|
|
|
|
2018-05-03 21:07:13 +00:00
|
|
|
inputs = extra_inputs
|
2016-09-29 20:23:00 +00:00
|
|
|
|
2020-03-10 21:56:11 +00:00
|
|
|
outputs = [ output ]
|
2016-09-29 20:23:00 +00:00
|
|
|
|
[SDK] Fix VM/kernel version mix in build.
Several people have experienced build issues traced back to
target `//utils/dartanalyzer:generate_summary_strong`.
The issue is triggered by the sdk_hash changing with an old
kernel-service snapshot in the out/ folder.
`generate_summary_strong` uses but does not explicitly depend on
the kernel-service, causing the outdated dependency.
This then causes 'Unexpected Kernel SDK Version' when the new dart
binary tried to load the old kernel-service snapshot.
Tested:
1. Clean build of create_sdk at HEAD.
2. Empty `git commit --amend` to modify commit and thus sdk hash.
3. Rebuild of create_sdk (which failed before).
Cq-Include-Trybots: dart/try:analyzer-analysis-server-linux-try,analyzer-linux-release-try,analyzer-mac-release-try,analyzer-nnbd-linux-release-try,analyzer-win-release-try,benchmark-linux-try,dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,dart-sdk-win-try,flutter-analyze-try,front-end-linux-release-x64-try,pkg-linux-release-try,vm-kernel-linux-release-x64-try
Change-Id: Iba07e9d0c5daa7a93870fb501d9bb57682c88a5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156913
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-08-05 11:46:28 +00:00
|
|
|
# Explicitly set DFE so Dart doesn't implicitly depend on the kernel service
|
|
|
|
# snapshot (creating a circular dep. for kernel-service_snapshot).
|
2021-06-30 00:41:02 +00:00
|
|
|
dfe = "NEVER LOADED"
|
[SDK] Fix VM/kernel version mix in build.
Several people have experienced build issues traced back to
target `//utils/dartanalyzer:generate_summary_strong`.
The issue is triggered by the sdk_hash changing with an old
kernel-service snapshot in the out/ folder.
`generate_summary_strong` uses but does not explicitly depend on
the kernel-service, causing the outdated dependency.
This then causes 'Unexpected Kernel SDK Version' when the new dart
binary tried to load the old kernel-service snapshot.
Tested:
1. Clean build of create_sdk at HEAD.
2. Empty `git commit --amend` to modify commit and thus sdk hash.
3. Rebuild of create_sdk (which failed before).
Cq-Include-Trybots: dart/try:analyzer-analysis-server-linux-try,analyzer-linux-release-try,analyzer-mac-release-try,analyzer-nnbd-linux-release-try,analyzer-win-release-try,benchmark-linux-try,dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,dart-sdk-win-try,flutter-analyze-try,front-end-linux-release-x64-try,pkg-linux-release-try,vm-kernel-linux-release-x64-try
Change-Id: Iba07e9d0c5daa7a93870fb501d9bb57682c88a5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156913
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-08-05 11:46:28 +00:00
|
|
|
|
2017-12-05 17:09:52 +00:00
|
|
|
abs_depfile = rebase_path(depfile)
|
2021-05-21 11:52:02 +00:00
|
|
|
abs_output = rebase_path(output)
|
|
|
|
rel_output = rebase_path(output, root_build_dir)
|
2016-09-29 20:23:00 +00:00
|
|
|
|
2018-05-03 21:07:13 +00:00
|
|
|
vm_args = [
|
2019-09-18 02:53:44 +00:00
|
|
|
"--deterministic",
|
|
|
|
"--packages=$dot_packages",
|
|
|
|
"--snapshot=$abs_output",
|
|
|
|
"--snapshot-depfile=$abs_depfile",
|
2021-05-21 11:52:02 +00:00
|
|
|
"--depfile-output-filename=$rel_output",
|
2019-09-18 02:53:44 +00:00
|
|
|
] + snapshot_vm_args
|
2017-05-08 20:06:05 +00:00
|
|
|
|
2018-09-26 22:49:27 +00:00
|
|
|
if (dart_snapshot_kind == "kernel") {
|
2019-09-18 02:53:44 +00:00
|
|
|
vm_args += [ "--snapshot-kind=kernel" ]
|
2017-05-08 20:06:05 +00:00
|
|
|
assert(training_args != "", "Ignoring unused argument")
|
2018-05-03 21:07:13 +00:00
|
|
|
args = []
|
2017-05-08 20:06:05 +00:00
|
|
|
} else if (dart_snapshot_kind == "app-jit") {
|
2018-05-03 21:07:13 +00:00
|
|
|
vm_args += [ "--snapshot-kind=app-jit" ]
|
|
|
|
args = training_args
|
2017-05-08 20:06:05 +00:00
|
|
|
} else {
|
|
|
|
assert(false, "Bad dart_snapshot_kind: $dart_snapshot_kind")
|
|
|
|
}
|
2016-09-29 20:23:00 +00:00
|
|
|
}
|
|
|
|
}
|
2018-04-11 18:31:36 +00:00
|
|
|
|
2018-08-21 20:28:06 +00:00
|
|
|
# Creates an app-jit snapshot for a Dart2 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.
|
|
|
|
#
|
|
|
|
# vm_args (optional):
|
2018-09-19 22:23:33 +00:00
|
|
|
# Additional arguments to the Dart VM.
|
2018-08-21 20:28:06 +00:00
|
|
|
#
|
|
|
|
# name (optional):
|
|
|
|
# The name of the snapshot if different from the target name. The output
|
|
|
|
# will be in $root_gen_dir/$name.dart.snapshot.
|
|
|
|
#
|
|
|
|
# deps (optional):
|
|
|
|
# Any build dependencies.
|
|
|
|
#
|
|
|
|
# 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") {
|
|
|
|
_application_snapshot(target_name) {
|
|
|
|
forward_variables_from(invoker, "*")
|
|
|
|
if (!defined(invoker.deps)) {
|
|
|
|
deps = []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Creates an app-jit snapshot for the common FE 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.
|
|
|
|
#
|
|
|
|
# vm_args (optional):
|
2018-09-19 22:23:33 +00:00
|
|
|
# Additional arguments to the Dart VM.
|
2018-08-21 20:28:06 +00:00
|
|
|
#
|
|
|
|
# name (optional):
|
|
|
|
# The name of the snapshot if different from the target name. The output
|
|
|
|
# will be in $root_gen_dir/$name.dart.snapshot.
|
|
|
|
#
|
|
|
|
# deps (optional):
|
|
|
|
# Any build dependencies.
|
|
|
|
#
|
|
|
|
# dot_packages (optional):
|
|
|
|
# The .packages file for the app. Defaults to the $_dart_root/.packages.
|
|
|
|
#
|
|
|
|
# output (optional):
|
|
|
|
# Overrides the full output path.
|
|
|
|
template("kernel_application_snapshot") {
|
|
|
|
_application_snapshot(target_name) {
|
|
|
|
forward_variables_from(invoker, "*")
|
|
|
|
}
|
|
|
|
}
|