Reland "[ DDS ] Fix DDS AOT snapshot build rules"

This is a reland of commit 0a393f1b69

The problem was that the checks for whether or not dartaotruntime
existed were always returning false on Windows because the ".exe" suffix
wasn't being taken into account. Patchset 2 addresses this.

Original change's description:
> [ DDS ] Fix DDS AOT snapshot build rules
>
> dds_aot.dart.snapshot was not being generated for runtime build targets,
> and dds.dart.snapshot was being built regardless of whether or not we
> were building for an IA32 target.
>
> This change also adds a check for IA32 in 'dart run' so the "Could not
> find dds_aot.dart.snapshot. Have you built the full Dart SDK?" message
> isn't printed when we fall back to using dds.dart.snapshot.
>
> This change also reverts 2cc08595a6, which
> failed to fix the issue it was attempting to fix.
>
> TEST=pkg/vm_service tests
>
> Change-Id: Ic990082c25b0d022093ad66600332dfb2878709f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341760
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>

TEST=pkg-win-release-try, pkg-win-release-arm64-try, and pkg/vm_service
tests

Change-Id: Ieab41edcb6bffca3be6bf628e357871f28949323
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342640
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
This commit is contained in:
Derek Xu 2023-12-19 21:17:15 +00:00 committed by Commit Queue
parent 8791b441a7
commit cd5d399e2b
5 changed files with 31 additions and 11 deletions

View file

@ -50,7 +50,6 @@ group("runtime") {
"runtime/vm:kernel_platform_files($host_toolchain)",
"samples/ffi/http:fake_http",
"utils/dartdev:dartdev",
"utils/dds:dds",
"utils/kernel-service:kernel-service",
]

View file

@ -397,10 +397,15 @@ class _DebuggingSession {
? sdk.ddsAotSnapshot
: absolute(sdkDir, 'dds_aot.dart.snapshot');
String execName = sdk.dartAotRuntime;
if (!Sdk.checkArtifactExists(snapshotName)) {
// An AOT snapshot of dds is not available, we could
// be running on the ia32 platform so check for a regular
// kernel file being present.
// Check to see if the AOT snapshot and dartaotruntime are available.
// If not, fall back to running from the AppJIT snapshot.
//
// This can happen if:
// - The SDK is built for IA32 which doesn't support AOT compilation
// - We only have artifacts available from the 'runtime' build
// configuration, which the VM SDK build bots frequently run from
if (!Sdk.checkArtifactExists(snapshotName, logError: false) ||
!Sdk.checkArtifactExists(sdk.dartAotRuntime, logError: false)) {
snapshotName =
fullSdk ? sdk.ddsSnapshot : absolute(sdkDir, 'dds.dart.snapshot');
if (!Sdk.checkArtifactExists(snapshotName)) {

View file

@ -29,7 +29,11 @@ class Sdk {
// if the SDK isn't completely built.
String get dart => Platform.resolvedExecutable;
String get dartAotRuntime => path.join(sdkPath, 'bin', 'dartaotruntime');
String get dartAotRuntime => path.join(
sdkPath,
'bin',
'dartaotruntime${Platform.isWindows ? '.exe' : ''}',
);
String get analysisServerSnapshot => path.absolute(
sdkPath,
@ -80,10 +84,13 @@ class Sdk {
'devtools',
);
static bool checkArtifactExists(String path) {
static bool checkArtifactExists(String path, {bool logError = true}) {
if (!File(path).existsSync()) {
log.stderr('Could not find $path. Have you built the full '
'Dart SDK?');
if (logError) {
log.stderr(
'Could not find $path. Have you built the full Dart SDK?',
);
}
return false;
}
return true;

View file

@ -83,7 +83,9 @@ class _DebuggingSession {
final dartAotPath = [
dartDir,
fullSdk ? 'dartaotruntime' : 'dart_precompiled_runtime_product',
fullSdk
? 'dartaotruntime${Platform.isWindows ? '.exe' : ''}'
: 'dart_precompiled_runtime_product${Platform.isWindows ? '.exe' : ''}',
].join('/');
String snapshotName = [
dartDir,
@ -91,7 +93,7 @@ class _DebuggingSession {
'dds_aot.dart.snapshot',
].join('/');
String execName = dartAotPath;
if (!File(snapshotName).existsSync()) {
if (!File(snapshotName).existsSync() || !File(dartAotPath).existsSync()) {
snapshotName = [
dartDir,
fullSdk ? 'snapshots' : 'gen',

View file

@ -22,7 +22,14 @@ copy("copy_dartdev_snapshot") {
application_snapshot("generate_dartdev_snapshot") {
main_dart = "../../pkg/dartdev/bin/dartdev.dart"
training_args = [ "--help" ]
deps = [ "../dds:dds" ]
# DDS should be run from AOT snapshot on all architectures except IA32/X86.
if (dart_target_arch != "ia32" && dart_target_arch != "x86") {
deps += [ "../dds:dds_aot" ]
}
vm_args = [ "--sound-null-safety" ]
output = "$root_gen_dir/dartdev.dart.snapshot"
}