[Reland] [dartdev] Convert gen_kernel.dart.snapshot into an AOT snapshot

Convert gen_kernel to use an AOT snapshot in the
dart compile exe
command.

TEST=ci

Change-Id: I3024bdd20f40ef562936821aa936eec74662373e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/327711
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
This commit is contained in:
asiva 2023-09-26 21:46:58 +00:00 committed by Commit Queue
parent 627aaabfb6
commit 409eb5ba7e
3 changed files with 15 additions and 17 deletions

View file

@ -13,7 +13,7 @@ final String executableSuffix = Platform.isWindows ? '.exe' : '';
final String dartaotruntime =
path.join(binDir.path, 'dartaotruntime$executableSuffix');
final String genKernel =
path.join(binDir.path, 'snapshots', 'gen_kernel.dart.snapshot');
path.join(binDir.path, 'snapshots', 'gen_kernel_aot.dart.snapshot');
final String genSnapshot =
path.join(binDir.path, 'utils', 'gen_snapshot$executableSuffix');
final String productPlatformDill = path.join(
@ -63,7 +63,7 @@ Future<void> generateNative({
final String kernelFile = path.join(tempDir.path, 'kernel.dill');
final kernelResult = await generateAotKernel(
Platform.executable,
dartaotruntime,
genKernel,
productPlatformDill,
sourcePath,

View file

@ -49,7 +49,7 @@ declare_args() {
# ........dds_aot.dart.snapshot (AOT snapshot) or dds.dart.snapshot (ia32)
# ........frontend_server_aot.dart.snapshot (AOT snapshot, if not on ia32)
# ........frontend_server.dart.snapshot
# ........gen_kernel.dart.snapshot (if not on ia32)
# ........gen_kernel_aot.dart.snapshot (if not on ia32)
# ........kernel-service.dart.snapshot
# ........kernel_worker.dart.snapshot
# ......resources/
@ -365,7 +365,7 @@ copy("copy_vm_platform_strong_product") {
copy("copy_gen_kernel_snapshot") {
visibility = [ ":group_dart2native" ]
deps = [ "../utils/gen_kernel" ]
sources = [ "$root_gen_dir/gen_kernel.dart.snapshot" ]
sources = [ "$root_gen_dir/gen_kernel_aot.dart.snapshot" ]
outputs =
[ "$root_out_dir/$dart_sdk_output/bin/snapshots/{{source_file_part}}" ]
}

View file

@ -3,6 +3,7 @@
# BSD-style license that can be found in the LICENSE file.
import("../../build/dart/dart_action.gni")
import("../../runtime/runtime_args.gni")
import("../../sdk_args.gni")
_dart_root = get_path_info("../..", "abspath")
@ -39,21 +40,18 @@ prebuilt_dart_action("bootstrap_gen_kernel") {
args = []
}
import("../application_snapshot.gni")
import("../aot_snapshot.gni")
application_snapshot("gen_kernel") {
aot_snapshot("gen_kernel") {
main_dart = "../../pkg/vm/bin/gen_kernel.dart"
deps = [ "../../runtime/vm:vm_platform" ]
output = "$root_gen_dir/gen_kernel_aot.dart.snapshot"
# NOTE: The output filename must be kept in sync with the output of the
# vm_platform rule.
vm_platform_out =
get_label_info("../../runtime/vm:vm_platform", "root_out_dir")
vm_platform = "$vm_platform_out/vm_platform_strong.dill"
training_args = [
"--platform",
rebase_path(vm_platform, root_build_dir),
rebase_path("../../pkg/vm/bin/gen_kernel.dart", root_build_dir),
"-o -",
]
# dartaotruntime has dart_product_config applied to it,
# so it is built in # product mode in both release and
# product builds, and is only built in debug mode in debug
# builds. The following line ensures that the dartaotruntime
# and gen_kernel_aot snapshot in an SDK build are
# always compatible with each other.
force_product_mode = !dart_debug
}