mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 11:31:57 +00:00
a4dd314c9e
When iterating on core library changes or changes in the AOT compiler
many seconds are wasted waiting on gen_kernel/compile_platform to
parse Dart code. This happens because we are running these tools
from sources on prebuilt Dart SDK.
This CL allows SDK developer to opt-in into AOT compiling these
tools by adding `precompile_tools=true` to their DART_GN_ARGS.
AOT compilation is performed using prebuilt SDK - so these
executables do not need to be recompiled if core libraries or
VM changes reducing iteration cycles.
pkg/vm/tool/precompiler2 is tweaked to detect when DART_GN_ARGS
contains `precompile_tools=true` and use precompiled
gen_kernel.exe instead of running it from source.
Using precompiled compile_platform takes vm_platform_strong.dill
build from 20 seconds to 3 seconds.
Using precompiled gen_kernel takes small benchmark build from
~10 seconds to 2 seconds.
This relands 5cda2a871c
with fixes
for Flutter build.
TEST=manually tested
Change-Id: I552861c80c152890655e41baaf6ea3fb3b03a57e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367961
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
60 lines
1.8 KiB
Plaintext
60 lines
1.8 KiB
Plaintext
# Copyright (c) 2024, 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("../build/dart/dart_action.gni")
|
|
import("../sdk_args.gni")
|
|
|
|
_dart_root = get_path_info("..", "abspath")
|
|
|
|
template("aot_compile_using_prebuilt_sdk") {
|
|
action(target_name) {
|
|
forward_variables_from(invoker,
|
|
[
|
|
"deps",
|
|
"pool",
|
|
"testonly",
|
|
"visibility",
|
|
])
|
|
|
|
script = "$_dart_root/build/gn_dart_compile_exe.py"
|
|
|
|
inputs = [
|
|
invoker.entry_point,
|
|
invoker.package_config,
|
|
]
|
|
|
|
outputs = [ invoker.output ]
|
|
|
|
depfile = invoker.output + ".d"
|
|
|
|
# TODO(vegorov): support RBE by using rewrapper script.
|
|
args = [
|
|
"--dart-sdk",
|
|
rebase_path("$_dart_root/tools/sdks/dart-sdk", root_build_dir),
|
|
"--sdk-hash",
|
|
"$sdk_hash",
|
|
"--entry-point",
|
|
rebase_path(invoker.entry_point, root_build_dir),
|
|
"--output",
|
|
rebase_path(invoker.output, root_build_dir),
|
|
"--packages",
|
|
rebase_path(invoker.package_config, root_build_dir),
|
|
"--depfile",
|
|
rebase_path(depfile, root_build_dir),
|
|
]
|
|
}
|
|
}
|
|
|
|
aot_compile_using_prebuilt_sdk("compile_platform.exe") {
|
|
entry_point = "$_dart_root/pkg/front_end/tool/_fasta/compile_platform.dart"
|
|
output = "$root_out_dir/compile_platform.exe"
|
|
package_config = "$_dart_root/.dart_tool/package_config.json"
|
|
}
|
|
|
|
aot_compile_using_prebuilt_sdk("gen_kernel.exe") {
|
|
entry_point = "$_dart_root/pkg/vm/bin/gen_kernel.dart"
|
|
output = "$root_out_dir/gen_kernel.exe"
|
|
package_config = "$_dart_root/.dart_tool/package_config.json"
|
|
}
|