Unverified Commit a1639be4 authored by Casey Hillers's avatar Casey Hillers Committed by GitHub

Revert "Switch flutter_tools to run frontend server from AOT snapshot" (#135537)

Reverts flutter/flutter#135255

This broke Google Testing, and requires an internal patch before relanding.
parent eae421e4
......@@ -190,7 +190,7 @@ String? _artifactToFileName(Artifact artifact, Platform hostPlatform, [ BuildMod
case Artifact.wasmOptBinary:
return 'wasm-opt$exe';
case Artifact.frontendServerSnapshotForEngineDartSdk:
return 'frontend_server_aot.dart.snapshot';
return 'frontend_server.dart.snapshot';
case Artifact.linuxDesktopPath:
return '';
case Artifact.linuxHeaders:
......
......@@ -132,7 +132,6 @@ class KernelSnapshot extends Target {
Source.pattern('{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/common.dart'),
Source.artifact(Artifact.platformKernelDill),
Source.artifact(Artifact.engineDartBinary),
Source.artifact(Artifact.engineDartAotRuntime),
Source.artifact(Artifact.frontendServerSnapshotForEngineDartSdk),
];
......
......@@ -244,10 +244,20 @@ class KernelCompiler {
String? nativeAssets,
}) async {
final TargetPlatform? platform = targetModel == TargetModel.dartdevc ? TargetPlatform.web_javascript : null;
final String frontendServer = (frontendServerStarterPath == null || frontendServerStarterPath.isEmpty)
? _artifacts.getArtifactPath(
Artifact.frontendServerSnapshotForEngineDartSdk,
platform: platform,
)
: frontendServerStarterPath;
// This is a URI, not a file path, so the forward slash is correct even on Windows.
if (!sdkRoot.endsWith('/')) {
sdkRoot = '$sdkRoot/';
}
final String engineDartPath = _artifacts.getArtifactPath(Artifact.engineDartBinary, platform: platform);
if (!_processManager.canRun(engineDartPath)) {
throwToolExit('Unable to find Dart binary at $engineDartPath');
}
String? mainUri;
final File mainFile = _fileSystem.file(mainPath);
final Uri mainFileUri = mainFile.uri;
......@@ -272,33 +282,10 @@ class KernelCompiler {
toMultiRootPath(dartPluginRegistrantFileUri, _fileSystemScheme, _fileSystemRoots, _fileSystem.path.separator == r'\');
}
final List<String> commandToStartFrontendServer;
if (frontendServerStarterPath != null && frontendServerStarterPath.isNotEmpty) {
final String engineDartPath = _artifacts.getArtifactPath(Artifact.engineDartBinary, platform: platform);
if (!_processManager.canRun(engineDartPath)) {
throwToolExit('Unable to find Dart binary at $engineDartPath');
}
commandToStartFrontendServer = <String>[
engineDartPath,
'--disable-dart-dev',
frontendServerStarterPath,
];
} else {
final String engineDartAotRuntimePath = _artifacts.getArtifactPath(Artifact.engineDartAotRuntime, platform: platform);
if (!_processManager.canRun(engineDartAotRuntimePath)) {
throwToolExit('Unable to find dartaotruntime binary at $engineDartAotRuntimePath');
}
commandToStartFrontendServer = <String>[
engineDartAotRuntimePath,
'--disable-dart-dev',
_artifacts.getArtifactPath(
Artifact.frontendServerSnapshotForEngineDartSdk,
platform: platform,
),
];
}
final List<String> command = commandToStartFrontendServer + <String>[
final List<String> command = <String>[
engineDartPath,
'--disable-dart-dev',
frontendServer,
'--sdk-root',
sdkRoot,
'--target=$targetModel',
......@@ -790,25 +777,16 @@ class DefaultResidentCompiler implements ResidentCompiler {
String? nativeAssetsUri,
}) async {
final TargetPlatform? platform = (targetModel == TargetModel.dartdevc) ? TargetPlatform.web_javascript : null;
late final List<String> commandToStartFrontendServer;
if (frontendServerStarterPath != null && frontendServerStarterPath!.isNotEmpty) {
commandToStartFrontendServer = <String>[
artifacts.getArtifactPath(Artifact.engineDartBinary, platform: platform),
'--disable-dart-dev',
frontendServerStarterPath!,
];
} else {
commandToStartFrontendServer = <String>[
artifacts.getArtifactPath(Artifact.engineDartAotRuntime, platform: platform),
'--disable-dart-dev',
artifacts.getArtifactPath(
Artifact.frontendServerSnapshotForEngineDartSdk,
platform: platform,
),
];
}
final List<String> command = commandToStartFrontendServer + <String>[
final String frontendServer = (frontendServerStarterPath == null || frontendServerStarterPath!.isEmpty)
? artifacts.getArtifactPath(
Artifact.frontendServerSnapshotForEngineDartSdk,
platform: platform,
)
: frontendServerStarterPath!;
final List<String> command = <String>[
artifacts.getArtifactPath(Artifact.engineDartBinary, platform: platform),
'--disable-dart-dev',
frontendServer,
'--sdk-root',
sdkRoot,
'--incremental',
......
......@@ -143,8 +143,7 @@ void main() {
);
expect(
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
fileSystem.path.join('root', 'bin', 'cache', 'dart-sdk', 'bin',
'snapshots', 'frontend_server_aot.dart.snapshot')
fileSystem.path.join('root', 'bin', 'cache', 'dart-sdk', 'bin', 'snapshots', 'frontend_server.dart.snapshot')
);
});
......@@ -326,7 +325,7 @@ void main() {
expect(
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
fileSystem.path.join('/out', 'host_debug_unopt', 'dart-sdk', 'bin',
'snapshots', 'frontend_server_aot.dart.snapshot')
'snapshots', 'frontend_server.dart.snapshot')
);
......@@ -398,7 +397,7 @@ void main() {
Artifact.frontendServerSnapshotForEngineDartSdk,
platform: TargetPlatform.web_javascript),
fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk', 'bin',
'snapshots', 'frontend_server_aot.dart.snapshot'),
'snapshots', 'frontend_server.dart.snapshot'),
);
expect(
artifacts.getArtifactPath(
......
......@@ -94,7 +94,7 @@ native-assets: {}
);
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
artifacts.getArtifactPath(Artifact.engineDartAotRuntime),
artifacts.getArtifactPath(Artifact.engineDartBinary),
'--disable-dart-dev',
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
'--sdk-root',
......@@ -139,7 +139,7 @@ native-assets: {}
);
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
artifacts.getArtifactPath(Artifact.engineDartAotRuntime),
artifacts.getArtifactPath(Artifact.engineDartBinary),
'--disable-dart-dev',
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
'--sdk-root',
......@@ -185,7 +185,7 @@ native-assets: {}
);
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
artifacts.getArtifactPath(Artifact.engineDartAotRuntime),
artifacts.getArtifactPath(Artifact.engineDartBinary),
'--disable-dart-dev',
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
'--sdk-root',
......@@ -279,7 +279,7 @@ native-assets: {}
);
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
artifacts.getArtifactPath(Artifact.engineDartAotRuntime),
artifacts.getArtifactPath(Artifact.engineDartBinary),
'--disable-dart-dev',
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
'--sdk-root',
......@@ -328,7 +328,7 @@ native-assets: {}
);
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
artifacts.getArtifactPath(Artifact.engineDartAotRuntime),
artifacts.getArtifactPath(Artifact.engineDartBinary),
'--disable-dart-dev',
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
'--sdk-root',
......@@ -375,7 +375,7 @@ native-assets: {}
);
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
artifacts.getArtifactPath(Artifact.engineDartAotRuntime),
artifacts.getArtifactPath(Artifact.engineDartBinary),
'--disable-dart-dev',
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
'--sdk-root',
......@@ -434,7 +434,7 @@ native-assets: {}
);
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
artifacts.getArtifactPath(Artifact.engineDartAotRuntime),
artifacts.getArtifactPath(Artifact.engineDartBinary),
'--disable-dart-dev',
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
'--sdk-root',
......
......@@ -53,7 +53,7 @@ void main() {
logger: logger,
processManager: FakeProcessManager.list(<FakeCommand>[
FakeCommand(command: const <String>[
'Artifact.engineDartAotRuntime',
'Artifact.engineDartBinary',
'--disable-dart-dev',
'Artifact.frontendServerSnapshotForEngineDartSdk',
'--sdk-root',
......@@ -99,7 +99,7 @@ void main() {
logger: logger,
processManager: FakeProcessManager.list(<FakeCommand>[
FakeCommand(command: const <String>[
'Artifact.engineDartAotRuntime',
'Artifact.engineDartBinary',
'--disable-dart-dev',
'Artifact.frontendServerSnapshotForEngineDartSdk',
'--sdk-root',
......@@ -145,7 +145,7 @@ void main() {
logger: logger,
processManager: FakeProcessManager.list(<FakeCommand>[
FakeCommand(command: const <String>[
'Artifact.engineDartAotRuntime',
'Artifact.engineDartBinary',
'--disable-dart-dev',
'Artifact.frontendServerSnapshotForEngineDartSdk',
'--sdk-root',
......@@ -191,7 +191,7 @@ void main() {
logger: logger,
processManager: FakeProcessManager.list(<FakeCommand>[
FakeCommand(command: const <String>[
'Artifact.engineDartAotRuntime',
'Artifact.engineDartBinary',
'--disable-dart-dev',
'Artifact.frontendServerSnapshotForEngineDartSdk',
'--sdk-root',
......@@ -239,7 +239,7 @@ void main() {
logger: logger,
processManager: FakeProcessManager.list(<FakeCommand>[
FakeCommand(command: const <String>[
'Artifact.engineDartAotRuntime',
'Artifact.engineDartBinary',
'--disable-dart-dev',
'Artifact.frontendServerSnapshotForEngineDartSdk',
'--sdk-root',
......@@ -287,7 +287,7 @@ void main() {
logger: logger,
processManager: FakeProcessManager.list(<FakeCommand>[
FakeCommand(command: const <String>[
'Artifact.engineDartAotRuntime',
'Artifact.engineDartBinary',
'--disable-dart-dev',
'Artifact.frontendServerSnapshotForEngineDartSdk',
'--sdk-root',
......@@ -339,7 +339,7 @@ void main() {
logger: logger,
processManager: FakeProcessManager.list(<FakeCommand>[
FakeCommand(command: const <String>[
'Artifact.engineDartAotRuntime',
'Artifact.engineDartBinary',
'--disable-dart-dev',
'Artifact.frontendServerSnapshotForEngineDartSdk',
'--sdk-root',
......@@ -389,7 +389,7 @@ void main() {
logger: logger,
processManager: FakeProcessManager.list(<FakeCommand>[
FakeCommand(command: const <String>[
'Artifact.engineDartAotRuntime',
'Artifact.engineDartBinary',
'--disable-dart-dev',
'Artifact.frontendServerSnapshotForEngineDartSdk',
'--sdk-root',
......@@ -449,7 +449,7 @@ void main() {
logger: logger,
processManager: FakeProcessManager.list(<FakeCommand>[
FakeCommand(command: const <String>[
'Artifact.engineDartAotRuntime',
'Artifact.engineDartBinary',
'--disable-dart-dev',
'Artifact.frontendServerSnapshotForEngineDartSdk',
'--sdk-root',
......
......@@ -30,7 +30,7 @@ void main() {
late FakeProcessManager fakeProcessManager;
const List<String> frontendServerCommand = <String>[
'Artifact.engineDartAotRuntime',
'Artifact.engineDartBinary',
'--disable-dart-dev',
'Artifact.frontendServerSnapshotForEngineDartSdk',
'--sdk-root',
......
......@@ -36,7 +36,7 @@ void main() {
);
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
FakeCommand(command: <Pattern>[
'Artifact.engineDartAotRuntime.TargetPlatform.web_javascript',
'Artifact.engineDartBinary.TargetPlatform.web_javascript',
'--disable-dart-dev',
'Artifact.frontendServerSnapshotForEngineDartSdk.TargetPlatform.web_javascript',
'--sdk-root',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment