Skip to content

Commit

Permalink
Fix snapshot paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
a-siva committed Feb 21, 2025
1 parent 35bfa78 commit 6fdf399
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
15 changes: 13 additions & 2 deletions dwds/lib/src/utilities/sdk_configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class SdkLayout {

final String sdkDirectory;
final String summaryPath;
final String dartdevcJitSnapshotPath;
final String dartdevcSnapshotPath;

@Deprecated('Only sound null safety is supported as of Dart 3.0')
Expand All @@ -62,19 +63,26 @@ class SdkLayout {
'_internal',
'ddc_outline.dill',
),
dartdevcSnapshotPath: p.join(
dartdevcJitSnapshotPath: p.join(
sdkDirectory,
'bin',
'snapshots',
'dartdevc.dart.snapshot',
),
dartdevcSnapshotPath: p.join(
sdkDirectory,
'bin',
'snapshots',
'dartdevc.aot.dart.snapshot',
),
);

const SdkLayout({
required this.sdkDirectory,
required this.summaryPath,
this.soundSummaryPath = '',
this.weakSummaryPath = '',
required this.dartdevcJitSnapshotPath,
required this.dartdevcSnapshotPath,
});
}
Expand Down Expand Up @@ -113,7 +121,10 @@ class SdkConfiguration {
: this(
sdkDirectory: sdkLayout.sdkDirectory,
sdkSummaryPath: sdkLayout.summaryPath,
compilerWorkerPath: sdkLayout.dartdevcSnapshotPath,
// This compiler path is used to spawn the expression compiler
// in a new isolate and hence it needs to be a JIT snapshot
// until dwds itself can run in AOT mode.
compilerWorkerPath: sdkLayout.dartdevcJitSnapshotPath,
);

static Uri? _toUri(String? path) => path == null ? null : p.toUri(path);
Expand Down
2 changes: 1 addition & 1 deletion dwds/test/sdk_configuration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void main() {
final sdkLayout = SdkLayout.createDefault(sdkDirectory);
final sdkConfiguration = SdkConfiguration.fromSdkLayout(sdkLayout);
final sdkSummaryPath = sdkLayout.summaryPath;
final compilerWorkerPath = sdkLayout.dartdevcSnapshotPath;
final compilerWorkerPath = sdkLayout.dartdevcJitSnapshotPath;

setUp(() async {
fs = MemoryFileSystem();
Expand Down
5 changes: 4 additions & 1 deletion test_common/lib/test_sdk_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class TestSdkLayout {
'snapshots',
'frontend_server_aot.dart.snapshot',
),
dartdevcSnapshotPath: sdkLayout.dartdevcJitSnapshotPath,
dartdevcSnapshotPath: sdkLayout.dartdevcSnapshotPath,
kernelWorkerSnapshotPath: p.join(
sdkLayout.sdkDirectory,
Expand Down Expand Up @@ -141,6 +142,7 @@ class TestSdkLayout {
final String dartPath;
final String dartAotRuntimePath;
final String frontendServerSnapshotPath;
final String dartdevcJitSnapshotPath;
final String dartdevcSnapshotPath;
final String kernelWorkerSnapshotPath;
final String devToolsDirectory;
Expand All @@ -159,6 +161,7 @@ class TestSdkLayout {
required this.dartPath,
required this.dartAotRuntimePath,
required this.frontendServerSnapshotPath,
required this.dartdevcJitSnapshotPath,
required this.dartdevcSnapshotPath,
required this.kernelWorkerSnapshotPath,
required this.devToolsDirectory,
Expand All @@ -169,7 +172,7 @@ class TestSdkLayout {
SdkConfiguration(
sdkDirectory: sdkLayout.sdkDirectory,
sdkSummaryPath: sdkLayout.summaryPath,
compilerWorkerPath: sdkLayout.dartdevcSnapshotPath,
compilerWorkerPath: sdkLayout.dartdevcJitSnapshotPath,
);
}

Expand Down
2 changes: 1 addition & 1 deletion test_common/test/sdk_asset_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void main() {
final copySdkLayout = TestSdkLayout.createDefault(sdkDirectory);

sdkSummaryPath = copySdkLayout.summaryPath;
compilerWorkerPath = copySdkLayout.dartdevcSnapshotPath;
compilerWorkerPath = copySdkLayout.dartdevcJitSnapshotPath;

// Copy the SDK directory into a temp directory.
await copyDirectory(TestSdkLayout.defaultSdkDirectory, sdkDirectory);
Expand Down

0 comments on commit 6fdf399

Please sign in to comment.