diff --git a/pkg/dart2native/lib/generate.dart b/pkg/dart2native/lib/generate.dart index c0f01fdaeae..0ef3f4b4844 100644 --- a/pkg/dart2native/lib/generate.dart +++ b/pkg/dart2native/lib/generate.dart @@ -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 generateNative({ final String kernelFile = path.join(tempDir.path, 'kernel.dill'); final kernelResult = await generateAotKernel( - Platform.executable, + dartaotruntime, genKernel, productPlatformDill, sourcePath, diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn index 79722f65212..e8ab581e248 100644 --- a/sdk/BUILD.gn +++ b/sdk/BUILD.gn @@ -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}}" ] } diff --git a/utils/gen_kernel/BUILD.gn b/utils/gen_kernel/BUILD.gn index 04bbf71a790..d9d03c16e31 100644 --- a/utils/gen_kernel/BUILD.gn +++ b/utils/gen_kernel/BUILD.gn @@ -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 }