Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend_server_client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- Update Dart SDK constraint to `^3.10.0`.
- Allow package_config `3.x.x`.
- Use `sdkRoot` to resolve Dart executable and frontend server snapshot locations when provided.

## 4.0.0

Expand Down
49 changes: 27 additions & 22 deletions frontend_server_client/lib/src/frontend_server_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,30 +94,51 @@ class FrontendServerClient {
for (final source in additionalSources) ...['--source', source],
if (nativeAssets != null) ...['--native-assets', nativeAssets],
];

final sdk = sdkRoot ?? sdkDir;
final dartExecutable = p.join(
sdk,
'bin',
Platform.isWindows ? 'dart.exe' : 'dart',
);
final dartAotRuntimePath = p.join(sdk, 'bin', 'dartaotruntime');
final feServerAppJitSnapshotPath = p.join(
sdk,
'bin',
'snapshots',
'frontend_server.dart.snapshot',
);
final feServerAotSnapshotPath = p.join(
sdk,
'bin',
'snapshots',
'frontend_server_aot.dart.snapshot',
);

late final Process feServer;
if (frontendServerPath != null) {
feServer = await Process.start(Platform.resolvedExecutable, <String>[
feServer = await Process.start(dartExecutable, <String>[
if (debug) '--observe',
frontendServerPath,
...commonArguments,
]);
} else if (File(_feServerAotSnapshotPath).existsSync()) {
} else if (File(feServerAotSnapshotPath).existsSync()) {
if (debug) {
throw ArgumentError(
'The debug argument cannot be set to true when the '
'frontendServerPath argument is omitted.',
);
}
feServer = await Process.start(_dartAotRuntimePath, <String>[
_feServerAotSnapshotPath,
feServer = await Process.start(dartAotRuntimePath, <String>[
feServerAotSnapshotPath,
...commonArguments,
]);
} else {
// AOT snapshots cannot be generated on IA32, so we need this fallback
// branch until support for IA32 is dropped (https://dartbug.com/49969).
feServer = await Process.start(Platform.resolvedExecutable, <String>[
feServer = await Process.start(dartExecutable, <String>[
if (debug) '--observe',
_feServerAppJitSnapshotPath,
feServerAppJitSnapshotPath,
...commonArguments,
]);
}
Expand Down Expand Up @@ -438,19 +459,3 @@ enum _CompileState { started, waitingForKey, gettingSourceDiffs, done }

/// Frontend server interaction states for a `reject` call.
enum _RejectState { started, waitingForKey, done }

final _dartAotRuntimePath = p.join(sdkDir, 'bin', 'dartaotruntime');

final _feServerAppJitSnapshotPath = p.join(
sdkDir,
'bin',
'snapshots',
'frontend_server.dart.snapshot',
);

final _feServerAotSnapshotPath = p.join(
sdkDir,
'bin',
'snapshots',
'frontend_server_aot.dart.snapshot',
);
Loading