Skip to content

Commit 59a8aa6

Browse files
authored
Account for the snapshot of dartdevc in the Dart SDK changing from a JIT snapshot to an AOT snapshot (#3742)
Dart SDK is in the process of changing snapshots in the SDK from JIT snapshots to AOT snapshots. This change ensures that the package will continue to work when that change happens.
1 parent 15ba22b commit 59a8aa6

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

build_web_compilers/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## 4.0.12-wip
22

33
- Bump the min sdk to 3.5.0.
4+
- Account for dartdevc snapshot in the Dart SDK changing to an AOT snapshot.
45

56
## 4.0.11
67

build_web_compilers/lib/src/sdk_js_compile_builder.dart

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,17 @@ Future<void> _createDevCompilerModule(
8686
try {
8787
// Use standalone process instead of the worker due to
8888
// https://github.com/dart-lang/sdk/issues/49441
89-
result = await Process.run(p.join(sdkDir, 'bin', 'dart'), [
90-
p.join(sdkDir, 'bin', 'snapshots', 'dartdevc.dart.snapshot'),
89+
var snapshotPath =
90+
p.join(sdkDir, 'bin', 'snapshots', 'dartdevc_aot.dart.snapshot');
91+
var execSuffix = Platform.isWindows ? '.exe' : '';
92+
var dartPath = p.join(sdkDir, 'bin', 'dartaotruntime$execSuffix');
93+
if (!File(snapshotPath).existsSync()) {
94+
snapshotPath =
95+
p.join(sdkDir, 'bin', 'snapshots', 'dartdevc.dart.snapshot');
96+
dartPath = p.join(sdkDir, 'bin', 'dart$execSuffix');
97+
}
98+
result = await Process.run(dartPath, [
99+
snapshotPath,
91100
'--multi-root-scheme=org-dartlang-sdk',
92101
'--modules=amd',
93102
if (canaryFeatures) '--canary',

0 commit comments

Comments
 (0)