Skip to content

Commit a1639be

Browse files
author
Casey Hillers
authored
Revert "Switch flutter_tools to run frontend server from AOT snapshot" (flutter#135537)
Reverts flutter#135255 This broke Google Testing, and requires an internal patch before relanding.
1 parent eae421e commit a1639be

File tree

8 files changed

+46
-70
lines changed

8 files changed

+46
-70
lines changed

packages/flutter_tools/lib/src/artifacts.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ String? _artifactToFileName(Artifact artifact, Platform hostPlatform, [ BuildMod
190190
case Artifact.wasmOptBinary:
191191
return 'wasm-opt$exe';
192192
case Artifact.frontendServerSnapshotForEngineDartSdk:
193-
return 'frontend_server_aot.dart.snapshot';
193+
return 'frontend_server.dart.snapshot';
194194
case Artifact.linuxDesktopPath:
195195
return '';
196196
case Artifact.linuxHeaders:

packages/flutter_tools/lib/src/build_system/targets/common.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ class KernelSnapshot extends Target {
132132
Source.pattern('{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/common.dart'),
133133
Source.artifact(Artifact.platformKernelDill),
134134
Source.artifact(Artifact.engineDartBinary),
135-
Source.artifact(Artifact.engineDartAotRuntime),
136135
Source.artifact(Artifact.frontendServerSnapshotForEngineDartSdk),
137136
];
138137

packages/flutter_tools/lib/src/compile.dart

Lines changed: 24 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,20 @@ class KernelCompiler {
244244
String? nativeAssets,
245245
}) async {
246246
final TargetPlatform? platform = targetModel == TargetModel.dartdevc ? TargetPlatform.web_javascript : null;
247+
final String frontendServer = (frontendServerStarterPath == null || frontendServerStarterPath.isEmpty)
248+
? _artifacts.getArtifactPath(
249+
Artifact.frontendServerSnapshotForEngineDartSdk,
250+
platform: platform,
251+
)
252+
: frontendServerStarterPath;
247253
// This is a URI, not a file path, so the forward slash is correct even on Windows.
248254
if (!sdkRoot.endsWith('/')) {
249255
sdkRoot = '$sdkRoot/';
250256
}
257+
final String engineDartPath = _artifacts.getArtifactPath(Artifact.engineDartBinary, platform: platform);
258+
if (!_processManager.canRun(engineDartPath)) {
259+
throwToolExit('Unable to find Dart binary at $engineDartPath');
260+
}
251261
String? mainUri;
252262
final File mainFile = _fileSystem.file(mainPath);
253263
final Uri mainFileUri = mainFile.uri;
@@ -272,33 +282,10 @@ class KernelCompiler {
272282
toMultiRootPath(dartPluginRegistrantFileUri, _fileSystemScheme, _fileSystemRoots, _fileSystem.path.separator == r'\');
273283
}
274284

275-
final List<String> commandToStartFrontendServer;
276-
if (frontendServerStarterPath != null && frontendServerStarterPath.isNotEmpty) {
277-
final String engineDartPath = _artifacts.getArtifactPath(Artifact.engineDartBinary, platform: platform);
278-
if (!_processManager.canRun(engineDartPath)) {
279-
throwToolExit('Unable to find Dart binary at $engineDartPath');
280-
}
281-
commandToStartFrontendServer = <String>[
282-
engineDartPath,
283-
'--disable-dart-dev',
284-
frontendServerStarterPath,
285-
];
286-
} else {
287-
final String engineDartAotRuntimePath = _artifacts.getArtifactPath(Artifact.engineDartAotRuntime, platform: platform);
288-
if (!_processManager.canRun(engineDartAotRuntimePath)) {
289-
throwToolExit('Unable to find dartaotruntime binary at $engineDartAotRuntimePath');
290-
}
291-
commandToStartFrontendServer = <String>[
292-
engineDartAotRuntimePath,
293-
'--disable-dart-dev',
294-
_artifacts.getArtifactPath(
295-
Artifact.frontendServerSnapshotForEngineDartSdk,
296-
platform: platform,
297-
),
298-
];
299-
}
300-
301-
final List<String> command = commandToStartFrontendServer + <String>[
285+
final List<String> command = <String>[
286+
engineDartPath,
287+
'--disable-dart-dev',
288+
frontendServer,
302289
'--sdk-root',
303290
sdkRoot,
304291
'--target=$targetModel',
@@ -790,25 +777,16 @@ class DefaultResidentCompiler implements ResidentCompiler {
790777
String? nativeAssetsUri,
791778
}) async {
792779
final TargetPlatform? platform = (targetModel == TargetModel.dartdevc) ? TargetPlatform.web_javascript : null;
793-
late final List<String> commandToStartFrontendServer;
794-
if (frontendServerStarterPath != null && frontendServerStarterPath!.isNotEmpty) {
795-
commandToStartFrontendServer = <String>[
796-
artifacts.getArtifactPath(Artifact.engineDartBinary, platform: platform),
797-
'--disable-dart-dev',
798-
frontendServerStarterPath!,
799-
];
800-
} else {
801-
commandToStartFrontendServer = <String>[
802-
artifacts.getArtifactPath(Artifact.engineDartAotRuntime, platform: platform),
803-
'--disable-dart-dev',
804-
artifacts.getArtifactPath(
805-
Artifact.frontendServerSnapshotForEngineDartSdk,
806-
platform: platform,
807-
),
808-
];
809-
}
810-
811-
final List<String> command = commandToStartFrontendServer + <String>[
780+
final String frontendServer = (frontendServerStarterPath == null || frontendServerStarterPath!.isEmpty)
781+
? artifacts.getArtifactPath(
782+
Artifact.frontendServerSnapshotForEngineDartSdk,
783+
platform: platform,
784+
)
785+
: frontendServerStarterPath!;
786+
final List<String> command = <String>[
787+
artifacts.getArtifactPath(Artifact.engineDartBinary, platform: platform),
788+
'--disable-dart-dev',
789+
frontendServer,
812790
'--sdk-root',
813791
sdkRoot,
814792
'--incremental',

packages/flutter_tools/test/general.shard/artifacts_test.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ void main() {
143143
);
144144
expect(
145145
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
146-
fileSystem.path.join('root', 'bin', 'cache', 'dart-sdk', 'bin',
147-
'snapshots', 'frontend_server_aot.dart.snapshot')
146+
fileSystem.path.join('root', 'bin', 'cache', 'dart-sdk', 'bin', 'snapshots', 'frontend_server.dart.snapshot')
148147
);
149148
});
150149

@@ -326,7 +325,7 @@ void main() {
326325
expect(
327326
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
328327
fileSystem.path.join('/out', 'host_debug_unopt', 'dart-sdk', 'bin',
329-
'snapshots', 'frontend_server_aot.dart.snapshot')
328+
'snapshots', 'frontend_server.dart.snapshot')
330329
);
331330

332331

@@ -398,7 +397,7 @@ void main() {
398397
Artifact.frontendServerSnapshotForEngineDartSdk,
399398
platform: TargetPlatform.web_javascript),
400399
fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk', 'bin',
401-
'snapshots', 'frontend_server_aot.dart.snapshot'),
400+
'snapshots', 'frontend_server.dart.snapshot'),
402401
);
403402
expect(
404403
artifacts.getArtifactPath(

packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ native-assets: {}
9494
);
9595
processManager.addCommands(<FakeCommand>[
9696
FakeCommand(command: <String>[
97-
artifacts.getArtifactPath(Artifact.engineDartAotRuntime),
97+
artifacts.getArtifactPath(Artifact.engineDartBinary),
9898
'--disable-dart-dev',
9999
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
100100
'--sdk-root',
@@ -139,7 +139,7 @@ native-assets: {}
139139
);
140140
processManager.addCommands(<FakeCommand>[
141141
FakeCommand(command: <String>[
142-
artifacts.getArtifactPath(Artifact.engineDartAotRuntime),
142+
artifacts.getArtifactPath(Artifact.engineDartBinary),
143143
'--disable-dart-dev',
144144
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
145145
'--sdk-root',
@@ -185,7 +185,7 @@ native-assets: {}
185185
);
186186
processManager.addCommands(<FakeCommand>[
187187
FakeCommand(command: <String>[
188-
artifacts.getArtifactPath(Artifact.engineDartAotRuntime),
188+
artifacts.getArtifactPath(Artifact.engineDartBinary),
189189
'--disable-dart-dev',
190190
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
191191
'--sdk-root',
@@ -279,7 +279,7 @@ native-assets: {}
279279
);
280280
processManager.addCommands(<FakeCommand>[
281281
FakeCommand(command: <String>[
282-
artifacts.getArtifactPath(Artifact.engineDartAotRuntime),
282+
artifacts.getArtifactPath(Artifact.engineDartBinary),
283283
'--disable-dart-dev',
284284
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
285285
'--sdk-root',
@@ -328,7 +328,7 @@ native-assets: {}
328328
);
329329
processManager.addCommands(<FakeCommand>[
330330
FakeCommand(command: <String>[
331-
artifacts.getArtifactPath(Artifact.engineDartAotRuntime),
331+
artifacts.getArtifactPath(Artifact.engineDartBinary),
332332
'--disable-dart-dev',
333333
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
334334
'--sdk-root',
@@ -375,7 +375,7 @@ native-assets: {}
375375
);
376376
processManager.addCommands(<FakeCommand>[
377377
FakeCommand(command: <String>[
378-
artifacts.getArtifactPath(Artifact.engineDartAotRuntime),
378+
artifacts.getArtifactPath(Artifact.engineDartBinary),
379379
'--disable-dart-dev',
380380
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
381381
'--sdk-root',
@@ -434,7 +434,7 @@ native-assets: {}
434434
);
435435
processManager.addCommands(<FakeCommand>[
436436
FakeCommand(command: <String>[
437-
artifacts.getArtifactPath(Artifact.engineDartAotRuntime),
437+
artifacts.getArtifactPath(Artifact.engineDartBinary),
438438
'--disable-dart-dev',
439439
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
440440
'--sdk-root',

packages/flutter_tools/test/general.shard/compile_batch_test.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void main() {
5353
logger: logger,
5454
processManager: FakeProcessManager.list(<FakeCommand>[
5555
FakeCommand(command: const <String>[
56-
'Artifact.engineDartAotRuntime',
56+
'Artifact.engineDartBinary',
5757
'--disable-dart-dev',
5858
'Artifact.frontendServerSnapshotForEngineDartSdk',
5959
'--sdk-root',
@@ -99,7 +99,7 @@ void main() {
9999
logger: logger,
100100
processManager: FakeProcessManager.list(<FakeCommand>[
101101
FakeCommand(command: const <String>[
102-
'Artifact.engineDartAotRuntime',
102+
'Artifact.engineDartBinary',
103103
'--disable-dart-dev',
104104
'Artifact.frontendServerSnapshotForEngineDartSdk',
105105
'--sdk-root',
@@ -145,7 +145,7 @@ void main() {
145145
logger: logger,
146146
processManager: FakeProcessManager.list(<FakeCommand>[
147147
FakeCommand(command: const <String>[
148-
'Artifact.engineDartAotRuntime',
148+
'Artifact.engineDartBinary',
149149
'--disable-dart-dev',
150150
'Artifact.frontendServerSnapshotForEngineDartSdk',
151151
'--sdk-root',
@@ -191,7 +191,7 @@ void main() {
191191
logger: logger,
192192
processManager: FakeProcessManager.list(<FakeCommand>[
193193
FakeCommand(command: const <String>[
194-
'Artifact.engineDartAotRuntime',
194+
'Artifact.engineDartBinary',
195195
'--disable-dart-dev',
196196
'Artifact.frontendServerSnapshotForEngineDartSdk',
197197
'--sdk-root',
@@ -239,7 +239,7 @@ void main() {
239239
logger: logger,
240240
processManager: FakeProcessManager.list(<FakeCommand>[
241241
FakeCommand(command: const <String>[
242-
'Artifact.engineDartAotRuntime',
242+
'Artifact.engineDartBinary',
243243
'--disable-dart-dev',
244244
'Artifact.frontendServerSnapshotForEngineDartSdk',
245245
'--sdk-root',
@@ -287,7 +287,7 @@ void main() {
287287
logger: logger,
288288
processManager: FakeProcessManager.list(<FakeCommand>[
289289
FakeCommand(command: const <String>[
290-
'Artifact.engineDartAotRuntime',
290+
'Artifact.engineDartBinary',
291291
'--disable-dart-dev',
292292
'Artifact.frontendServerSnapshotForEngineDartSdk',
293293
'--sdk-root',
@@ -339,7 +339,7 @@ void main() {
339339
logger: logger,
340340
processManager: FakeProcessManager.list(<FakeCommand>[
341341
FakeCommand(command: const <String>[
342-
'Artifact.engineDartAotRuntime',
342+
'Artifact.engineDartBinary',
343343
'--disable-dart-dev',
344344
'Artifact.frontendServerSnapshotForEngineDartSdk',
345345
'--sdk-root',
@@ -389,7 +389,7 @@ void main() {
389389
logger: logger,
390390
processManager: FakeProcessManager.list(<FakeCommand>[
391391
FakeCommand(command: const <String>[
392-
'Artifact.engineDartAotRuntime',
392+
'Artifact.engineDartBinary',
393393
'--disable-dart-dev',
394394
'Artifact.frontendServerSnapshotForEngineDartSdk',
395395
'--sdk-root',
@@ -449,7 +449,7 @@ void main() {
449449
logger: logger,
450450
processManager: FakeProcessManager.list(<FakeCommand>[
451451
FakeCommand(command: const <String>[
452-
'Artifact.engineDartAotRuntime',
452+
'Artifact.engineDartBinary',
453453
'--disable-dart-dev',
454454
'Artifact.frontendServerSnapshotForEngineDartSdk',
455455
'--sdk-root',

packages/flutter_tools/test/general.shard/compile_incremental_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void main() {
3030
late FakeProcessManager fakeProcessManager;
3131

3232
const List<String> frontendServerCommand = <String>[
33-
'Artifact.engineDartAotRuntime',
33+
'Artifact.engineDartBinary',
3434
'--disable-dart-dev',
3535
'Artifact.frontendServerSnapshotForEngineDartSdk',
3636
'--sdk-root',

packages/flutter_tools/test/general.shard/test/web_test_compiler_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void main() {
3636
);
3737
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
3838
FakeCommand(command: <Pattern>[
39-
'Artifact.engineDartAotRuntime.TargetPlatform.web_javascript',
39+
'Artifact.engineDartBinary.TargetPlatform.web_javascript',
4040
'--disable-dart-dev',
4141
'Artifact.frontendServerSnapshotForEngineDartSdk.TargetPlatform.web_javascript',
4242
'--sdk-root',

0 commit comments

Comments
 (0)