Platform binaries reland (#115502)
You can now specify a --local-web-sdk flag to point to a wasm_release folder. This will make it so that only artifacts that pertain to the web sdk are overridden to point to the wasm_release folder. Other artifacts (such as impellerc) will pull from the cache, or from the --local-engine path if that is specified. This also uses precompiled platform kernel files for both ddc and dart2js
This commit is contained in:
@@ -92,7 +92,7 @@ void main() {
|
||||
);
|
||||
|
||||
final AnalysisServer server = AnalysisServer(
|
||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartSdkPath).path,
|
||||
globals.artifacts!.getArtifactPath(Artifact.engineDartSdkPath),
|
||||
<String>[tempDir.path],
|
||||
fileSystem: fileSystem,
|
||||
platform: platform,
|
||||
@@ -132,7 +132,7 @@ void main() {
|
||||
);
|
||||
|
||||
final AnalysisServer server = AnalysisServer(
|
||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartSdkPath).path,
|
||||
globals.artifacts!.getArtifactPath(Artifact.engineDartSdkPath),
|
||||
<String>[tempDir.path],
|
||||
fileSystem: fileSystem,
|
||||
platform: platform,
|
||||
@@ -159,7 +159,7 @@ void main() {
|
||||
const String contents = "StringBuffer bar = StringBuffer('baz');";
|
||||
tempDir.childFile('main.dart').writeAsStringSync(contents);
|
||||
final AnalysisServer server = AnalysisServer(
|
||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartSdkPath).path,
|
||||
globals.artifacts!.getArtifactPath(Artifact.engineDartSdkPath),
|
||||
<String>[tempDir.path],
|
||||
fileSystem: fileSystem,
|
||||
platform: platform,
|
||||
@@ -185,13 +185,13 @@ void main() {
|
||||
<FakeCommand>[
|
||||
FakeCommand(
|
||||
command: const <String>[
|
||||
'HostArtifact.engineDartSdkPath/bin/dart',
|
||||
'Artifact.engineDartSdkPath/bin/dart',
|
||||
'--disable-dart-dev',
|
||||
'HostArtifact.engineDartSdkPath/bin/snapshots/analysis_server.dart.snapshot',
|
||||
'Artifact.engineDartSdkPath/bin/snapshots/analysis_server.dart.snapshot',
|
||||
'--disable-server-feature-completion',
|
||||
'--disable-server-feature-search',
|
||||
'--sdk',
|
||||
'HostArtifact.engineDartSdkPath',
|
||||
'Artifact.engineDartSdkPath',
|
||||
],
|
||||
stdin: IOSink(stdin.sink),
|
||||
),
|
||||
@@ -228,13 +228,13 @@ void main() {
|
||||
<FakeCommand>[
|
||||
FakeCommand(
|
||||
command: const <String>[
|
||||
'HostArtifact.engineDartSdkPath/bin/dart',
|
||||
'Artifact.engineDartSdkPath/bin/dart',
|
||||
'--disable-dart-dev',
|
||||
'HostArtifact.engineDartSdkPath/bin/snapshots/analysis_server.dart.snapshot',
|
||||
'Artifact.engineDartSdkPath/bin/snapshots/analysis_server.dart.snapshot',
|
||||
'--disable-server-feature-completion',
|
||||
'--disable-server-feature-search',
|
||||
'--sdk',
|
||||
'HostArtifact.engineDartSdkPath',
|
||||
'Artifact.engineDartSdkPath',
|
||||
],
|
||||
stdin: IOSink(stdin.sink),
|
||||
stdout: '''
|
||||
@@ -281,13 +281,13 @@ void main() {
|
||||
<FakeCommand>[
|
||||
FakeCommand(
|
||||
command: const <String>[
|
||||
'HostArtifact.engineDartSdkPath/bin/dart',
|
||||
'Artifact.engineDartSdkPath/bin/dart',
|
||||
'--disable-dart-dev',
|
||||
'HostArtifact.engineDartSdkPath/bin/snapshots/analysis_server.dart.snapshot',
|
||||
'Artifact.engineDartSdkPath/bin/snapshots/analysis_server.dart.snapshot',
|
||||
'--disable-server-feature-completion',
|
||||
'--disable-server-feature-search',
|
||||
'--sdk',
|
||||
'HostArtifact.engineDartSdkPath',
|
||||
'Artifact.engineDartSdkPath',
|
||||
],
|
||||
stdin: IOSink(stdin.sink),
|
||||
stdout: '''
|
||||
|
||||
@@ -88,13 +88,13 @@ void main() {
|
||||
const FakeCommand(
|
||||
// artifact paths are from Artifacts.test() and stable
|
||||
command: <String>[
|
||||
'HostArtifact.engineDartSdkPath/bin/dart',
|
||||
'Artifact.engineDartSdkPath/bin/dart',
|
||||
'--disable-dart-dev',
|
||||
'HostArtifact.engineDartSdkPath/bin/snapshots/analysis_server.dart.snapshot',
|
||||
'Artifact.engineDartSdkPath/bin/snapshots/analysis_server.dart.snapshot',
|
||||
'--disable-server-feature-completion',
|
||||
'--disable-server-feature-search',
|
||||
'--sdk',
|
||||
'HostArtifact.engineDartSdkPath',
|
||||
'Artifact.engineDartSdkPath',
|
||||
],
|
||||
exitCode: SIGABRT,
|
||||
stderr: stderr,
|
||||
|
||||
@@ -195,7 +195,7 @@ void main() {
|
||||
processManager.addCommand(
|
||||
const FakeCommand(
|
||||
command: <String>[
|
||||
'HostArtifact.engineDartBinary',
|
||||
'Artifact.engineDartBinary',
|
||||
'format',
|
||||
'/.dart_tool/flutter_gen/gen_l10n/app_localizations_en.dart',
|
||||
'/.dart_tool/flutter_gen/gen_l10n/app_localizations.dart',
|
||||
@@ -241,7 +241,7 @@ format: true
|
||||
processManager.addCommand(
|
||||
const FakeCommand(
|
||||
command: <String>[
|
||||
'HostArtifact.engineDartBinary',
|
||||
'Artifact.engineDartBinary',
|
||||
'format',
|
||||
'/.dart_tool/flutter_gen/gen_l10n/app_localizations_en.dart',
|
||||
'/.dart_tool/flutter_gen/gen_l10n/app_localizations.dart',
|
||||
|
||||
@@ -29,6 +29,7 @@ import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||
import 'package:flutter_tools/src/resident_runner.dart';
|
||||
import 'package:flutter_tools/src/runner/flutter_command.dart';
|
||||
import 'package:flutter_tools/src/vmservice.dart';
|
||||
import 'package:flutter_tools/src/web/compile.dart';
|
||||
import 'package:test/fake.dart';
|
||||
import 'package:vm_service/vm_service.dart';
|
||||
|
||||
@@ -673,35 +674,35 @@ void main() {
|
||||
});
|
||||
|
||||
test('auto web-renderer with no dart-defines', () {
|
||||
dartDefines = FlutterCommand.updateDartDefines(dartDefines, 'auto');
|
||||
dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.autoDetect);
|
||||
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=true']);
|
||||
});
|
||||
|
||||
test('canvaskit web-renderer with no dart-defines', () {
|
||||
dartDefines = FlutterCommand.updateDartDefines(dartDefines, 'canvaskit');
|
||||
dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.canvaskit);
|
||||
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=false','FLUTTER_WEB_USE_SKIA=true']);
|
||||
});
|
||||
|
||||
test('html web-renderer with no dart-defines', () {
|
||||
dartDefines = FlutterCommand.updateDartDefines(dartDefines, 'html');
|
||||
dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.html);
|
||||
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=false','FLUTTER_WEB_USE_SKIA=false']);
|
||||
});
|
||||
|
||||
test('auto web-renderer with existing dart-defines', () {
|
||||
dartDefines = <String>['FLUTTER_WEB_USE_SKIA=false'];
|
||||
dartDefines = FlutterCommand.updateDartDefines(dartDefines, 'auto');
|
||||
dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.autoDetect);
|
||||
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=true']);
|
||||
});
|
||||
|
||||
test('canvaskit web-renderer with no dart-defines', () {
|
||||
dartDefines = <String>['FLUTTER_WEB_USE_SKIA=false'];
|
||||
dartDefines = FlutterCommand.updateDartDefines(dartDefines, 'canvaskit');
|
||||
dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.canvaskit);
|
||||
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=false','FLUTTER_WEB_USE_SKIA=true']);
|
||||
});
|
||||
|
||||
test('html web-renderer with no dart-defines', () {
|
||||
dartDefines = <String>['FLUTTER_WEB_USE_SKIA=true'];
|
||||
dartDefines = FlutterCommand.updateDartDefines(dartDefines, 'html');
|
||||
dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.html);
|
||||
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=false','FLUTTER_WEB_USE_SKIA=false']);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1180,7 +1180,7 @@ void main() {
|
||||
final String original = file.readAsStringSync();
|
||||
|
||||
final Process process = await Process.start(
|
||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartBinary).path,
|
||||
globals.artifacts!.getArtifactPath(Artifact.engineDartBinary),
|
||||
<String>['format', '--output=show', file.path],
|
||||
workingDirectory: projectDir.path,
|
||||
);
|
||||
@@ -1277,7 +1277,7 @@ void main() {
|
||||
final String original = file.readAsStringSync();
|
||||
|
||||
final Process process = await Process.start(
|
||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartBinary).path,
|
||||
globals.artifacts!.getArtifactPath(Artifact.engineDartBinary),
|
||||
<String>['format', '--output=show', file.path],
|
||||
workingDirectory: projectDir.path,
|
||||
);
|
||||
@@ -3138,7 +3138,7 @@ Future<void> _analyzeProject(String workingDir, { List<String> expectedFailures
|
||||
];
|
||||
|
||||
final ProcessResult exec = await Process.run(
|
||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartBinary).path,
|
||||
globals.artifacts!.getArtifactPath(Artifact.engineDartBinary),
|
||||
args,
|
||||
workingDirectory: workingDir,
|
||||
);
|
||||
@@ -3195,7 +3195,7 @@ Future<void> _getPackages(Directory workingDir) async {
|
||||
// While flutter test does get packages, it doesn't write version
|
||||
// files anymore.
|
||||
await Process.run(
|
||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartBinary).path,
|
||||
globals.artifacts!.getArtifactPath(Artifact.engineDartBinary),
|
||||
<String>[
|
||||
flutterToolsSnapshotPath,
|
||||
'packages',
|
||||
@@ -3224,7 +3224,7 @@ Future<void> _runFlutterTest(Directory workingDir, { String? target }) async {
|
||||
];
|
||||
|
||||
final ProcessResult exec = await Process.run(
|
||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartBinary).path,
|
||||
globals.artifacts!.getArtifactPath(Artifact.engineDartBinary),
|
||||
args,
|
||||
workingDirectory: workingDir.path,
|
||||
);
|
||||
|
||||
@@ -199,7 +199,7 @@ void main() {
|
||||
});
|
||||
|
||||
group('LocalEngineArtifacts', () {
|
||||
late LocalEngineArtifacts artifacts;
|
||||
late Artifacts artifacts;
|
||||
late Cache cache;
|
||||
late FileSystem fileSystem;
|
||||
late Platform platform;
|
||||
@@ -217,15 +217,20 @@ void main() {
|
||||
osUtils: FakeOperatingSystemUtils(),
|
||||
artifacts: <ArtifactSet>[],
|
||||
);
|
||||
artifacts = LocalEngineArtifacts(
|
||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
||||
cache: cache,
|
||||
artifacts = CachedLocalWebSdkArtifacts(
|
||||
parent: CachedLocalEngineArtifacts(
|
||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
||||
engineOutPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
||||
cache: cache,
|
||||
fileSystem: fileSystem,
|
||||
platform: platform,
|
||||
processManager: FakeProcessManager.any(),
|
||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||
),
|
||||
webSdkPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'wasm_release'),
|
||||
fileSystem: fileSystem,
|
||||
platform: platform,
|
||||
processManager: FakeProcessManager.any(),
|
||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||
);
|
||||
operatingSystemUtils: FakeOperatingSystemUtils());
|
||||
});
|
||||
|
||||
testWithoutContext('getArtifactPath', () {
|
||||
@@ -314,7 +319,7 @@ void main() {
|
||||
fileSystem.path.join('/out', 'android_debug_unopt', 'flutter_tester'),
|
||||
);
|
||||
expect(
|
||||
artifacts.getHostArtifact(HostArtifact.engineDartSdkPath).path,
|
||||
artifacts.getArtifactPath(Artifact.engineDartSdkPath),
|
||||
fileSystem.path.join('/out', 'host_debug_unopt', 'dart-sdk'),
|
||||
);
|
||||
expect(
|
||||
@@ -350,34 +355,32 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('falls back to prebuilt dart sdk', () {
|
||||
final String failureMessage = 'Unable to find a built dart sdk at:'
|
||||
' "${fileSystem.path.join('/out', 'host_debug_unopt', 'dart-sdk')}"'
|
||||
' or a prebuilt dart sdk at:'
|
||||
testWithoutContext('uses prebuilt dart sdk for web platform', () {
|
||||
final String failureMessage = 'Unable to find a prebuilt dart sdk at:'
|
||||
' "${fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk')}"';
|
||||
|
||||
expect(
|
||||
() => artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
||||
() => artifacts.getArtifactPath(
|
||||
Artifact.frontendServerSnapshotForEngineDartSdk,
|
||||
platform: TargetPlatform.web_javascript),
|
||||
throwsToolExit(message: failureMessage),
|
||||
);
|
||||
expect(
|
||||
() => artifacts.getHostArtifact(HostArtifact.engineDartSdkPath),
|
||||
() => artifacts.getArtifactPath(
|
||||
Artifact.engineDartSdkPath,
|
||||
platform: TargetPlatform.web_javascript),
|
||||
throwsToolExit(message: failureMessage),
|
||||
);
|
||||
expect(
|
||||
() => artifacts.getHostArtifact(HostArtifact.engineDartBinary),
|
||||
() => artifacts.getArtifactPath(
|
||||
Artifact.engineDartBinary,
|
||||
platform: TargetPlatform.web_javascript),
|
||||
throwsToolExit(message: failureMessage),
|
||||
);
|
||||
expect(
|
||||
() => artifacts.getHostArtifact(HostArtifact.dart2jsSnapshot),
|
||||
throwsToolExit(message: failureMessage),
|
||||
);
|
||||
expect(
|
||||
() => artifacts.getHostArtifact(HostArtifact.dartdevcSnapshot),
|
||||
throwsToolExit(message: failureMessage),
|
||||
);
|
||||
expect(
|
||||
() => artifacts.getHostArtifact(HostArtifact.kernelWorkerSnapshot),
|
||||
() => artifacts.getArtifactPath(
|
||||
Artifact.dart2jsSnapshot,
|
||||
platform: TargetPlatform.web_javascript),
|
||||
throwsToolExit(message: failureMessage),
|
||||
);
|
||||
|
||||
@@ -390,33 +393,31 @@ void main() {
|
||||
.createSync(recursive: true);
|
||||
|
||||
expect(
|
||||
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
||||
artifacts.getArtifactPath(
|
||||
Artifact.frontendServerSnapshotForEngineDartSdk,
|
||||
platform: TargetPlatform.web_javascript),
|
||||
fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk', 'bin',
|
||||
'snapshots', 'frontend_server.dart.snapshot'),
|
||||
);
|
||||
expect(
|
||||
artifacts.getHostArtifact(HostArtifact.engineDartSdkPath).path,
|
||||
artifacts.getArtifactPath(
|
||||
Artifact.engineDartSdkPath,
|
||||
platform: TargetPlatform.web_javascript),
|
||||
fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk'),
|
||||
);
|
||||
expect(
|
||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
||||
artifacts.getArtifactPath(
|
||||
Artifact.engineDartBinary,
|
||||
platform: TargetPlatform.web_javascript),
|
||||
fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk', 'bin', 'dart'),
|
||||
);
|
||||
expect(
|
||||
artifacts.getHostArtifact(HostArtifact.dart2jsSnapshot).path,
|
||||
artifacts.getArtifactPath(
|
||||
Artifact.dart2jsSnapshot,
|
||||
platform: TargetPlatform.web_javascript),
|
||||
fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk',
|
||||
'bin', 'snapshots', 'dart2js.dart.snapshot'),
|
||||
);
|
||||
expect(
|
||||
artifacts.getHostArtifact(HostArtifact.dartdevcSnapshot).path,
|
||||
fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk',
|
||||
'bin', 'snapshots', 'dartdevc.dart.snapshot'),
|
||||
);
|
||||
expect(
|
||||
artifacts.getHostArtifact(HostArtifact.kernelWorkerSnapshot).path,
|
||||
fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk',
|
||||
'bin', 'snapshots', 'kernel_worker.dart.snapshot'),
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('getEngineType', () {
|
||||
@@ -435,15 +436,20 @@ void main() {
|
||||
});
|
||||
|
||||
testWithoutContext('Looks up dart.exe on windows platforms', () async {
|
||||
artifacts = LocalEngineArtifacts(
|
||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
||||
cache: cache,
|
||||
artifacts = CachedLocalWebSdkArtifacts(
|
||||
parent: CachedLocalEngineArtifacts(
|
||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
||||
engineOutPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
||||
cache: cache,
|
||||
fileSystem: fileSystem,
|
||||
platform: FakePlatform(operatingSystem: 'windows'),
|
||||
processManager: FakeProcessManager.any(),
|
||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||
),
|
||||
webSdkPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'wasm_release'),
|
||||
fileSystem: fileSystem,
|
||||
platform: FakePlatform(operatingSystem: 'windows'),
|
||||
processManager: FakeProcessManager.any(),
|
||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||
);
|
||||
operatingSystemUtils: FakeOperatingSystemUtils());
|
||||
|
||||
fileSystem
|
||||
.directory('out')
|
||||
@@ -453,7 +459,7 @@ void main() {
|
||||
.createSync(recursive: true);
|
||||
|
||||
expect(
|
||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
||||
artifacts.getArtifactPath(Artifact.engineDartBinary),
|
||||
fileSystem.path.join('/out', 'host_debug_unopt', 'dart-sdk', 'bin', 'dart.exe'),
|
||||
);
|
||||
});
|
||||
@@ -467,21 +473,26 @@ void main() {
|
||||
.createSync(recursive: true);
|
||||
|
||||
expect(
|
||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
||||
artifacts.getArtifactPath(Artifact.engineDartBinary),
|
||||
fileSystem.path.join('/out', 'host_debug_unopt', 'dart-sdk', 'bin', 'dart'),
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('Finds dart-sdk in windows prebuilts', () async {
|
||||
artifacts = LocalEngineArtifacts(
|
||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
||||
cache: cache,
|
||||
testWithoutContext('Finds dart-sdk in windows prebuilts for web platform', () async {
|
||||
artifacts = CachedLocalWebSdkArtifacts(
|
||||
parent: CachedLocalEngineArtifacts(
|
||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
||||
engineOutPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
||||
cache: cache,
|
||||
fileSystem: fileSystem,
|
||||
platform: FakePlatform(operatingSystem: 'windows'),
|
||||
processManager: FakeProcessManager.any(),
|
||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||
),
|
||||
webSdkPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'wasm_release'),
|
||||
fileSystem: fileSystem,
|
||||
platform: FakePlatform(operatingSystem: 'windows'),
|
||||
processManager: FakeProcessManager.any(),
|
||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||
);
|
||||
operatingSystemUtils: FakeOperatingSystemUtils());
|
||||
|
||||
fileSystem
|
||||
.directory('/flutter')
|
||||
@@ -492,21 +503,26 @@ void main() {
|
||||
.createSync(recursive: true);
|
||||
|
||||
expect(
|
||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
||||
artifacts.getArtifactPath(Artifact.engineDartBinary, platform: TargetPlatform.web_javascript),
|
||||
fileSystem.path.join('/flutter', 'prebuilts', 'windows-x64', 'dart-sdk', 'bin', 'dart.exe'),
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('Finds dart-sdk in macos prebuilts', () async {
|
||||
artifacts = LocalEngineArtifacts(
|
||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
||||
cache: cache,
|
||||
testWithoutContext('Finds dart-sdk in macos prebuilts for web platform', () async {
|
||||
artifacts = CachedLocalWebSdkArtifacts(
|
||||
parent: CachedLocalEngineArtifacts(
|
||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
||||
engineOutPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
||||
cache: cache,
|
||||
fileSystem: fileSystem,
|
||||
platform: FakePlatform(operatingSystem: 'macos'),
|
||||
processManager: FakeProcessManager.any(),
|
||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||
),
|
||||
webSdkPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'wasm_release'),
|
||||
fileSystem: fileSystem,
|
||||
platform: FakePlatform(operatingSystem: 'macos'),
|
||||
processManager: FakeProcessManager.any(),
|
||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||
);
|
||||
operatingSystemUtils: FakeOperatingSystemUtils());
|
||||
|
||||
fileSystem
|
||||
.directory('/flutter')
|
||||
@@ -517,7 +533,7 @@ void main() {
|
||||
.createSync(recursive: true);
|
||||
|
||||
expect(
|
||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
||||
artifacts.getArtifactPath(Artifact.engineDartBinary, platform: TargetPlatform.web_javascript),
|
||||
fileSystem.path.join('/flutter', 'prebuilts', 'macos-x64', 'dart-sdk', 'bin', 'dart'),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -83,7 +83,7 @@ void main() {
|
||||
);
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
FakeCommand(command: <String>[
|
||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
||||
artifacts.getArtifactPath(Artifact.engineDartBinary),
|
||||
'--disable-dart-dev',
|
||||
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
||||
'--sdk-root',
|
||||
@@ -121,7 +121,7 @@ void main() {
|
||||
);
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
FakeCommand(command: <String>[
|
||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
||||
artifacts.getArtifactPath(Artifact.engineDartBinary),
|
||||
'--disable-dart-dev',
|
||||
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
||||
'--sdk-root',
|
||||
@@ -160,7 +160,7 @@ void main() {
|
||||
);
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
FakeCommand(command: <String>[
|
||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
||||
artifacts.getArtifactPath(Artifact.engineDartBinary),
|
||||
'--disable-dart-dev',
|
||||
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
||||
'--sdk-root',
|
||||
@@ -200,7 +200,7 @@ void main() {
|
||||
);
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
FakeCommand(command: <String>[
|
||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
||||
artifacts.getArtifactPath(Artifact.engineDartBinary),
|
||||
'--disable-dart-dev',
|
||||
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
||||
'--sdk-root',
|
||||
@@ -242,7 +242,7 @@ void main() {
|
||||
);
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
FakeCommand(command: <String>[
|
||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
||||
artifacts.getArtifactPath(Artifact.engineDartBinary),
|
||||
'--disable-dart-dev',
|
||||
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
||||
'--sdk-root',
|
||||
@@ -284,7 +284,7 @@ void main() {
|
||||
);
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
FakeCommand(command: <String>[
|
||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
||||
artifacts.getArtifactPath(Artifact.engineDartBinary),
|
||||
'--disable-dart-dev',
|
||||
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
||||
'--sdk-root',
|
||||
@@ -338,7 +338,7 @@ void main() {
|
||||
);
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
FakeCommand(command: <String>[
|
||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
||||
artifacts.getArtifactPath(Artifact.engineDartBinary),
|
||||
'--disable-dart-dev',
|
||||
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
||||
'--sdk-root',
|
||||
|
||||
@@ -79,7 +79,7 @@ void main() {
|
||||
artifacts = Artifacts.test();
|
||||
fileSystem = MemoryFileSystem.test();
|
||||
logger = BufferLogger.test();
|
||||
dartPath = artifacts.getHostArtifact(HostArtifact.engineDartBinary).path;
|
||||
dartPath = artifacts.getArtifactPath(Artifact.engineDartBinary);
|
||||
constFinderPath = artifacts.getArtifactPath(Artifact.constFinder);
|
||||
fontSubsetPath = artifacts.getArtifactPath(Artifact.fontSubset);
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import 'package:flutter_tools/src/build_system/depfile.dart';
|
||||
import 'package:flutter_tools/src/build_system/targets/web.dart';
|
||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
||||
import 'package:flutter_tools/src/isolated/mustache_template.dart';
|
||||
import 'package:flutter_tools/src/web/compile.dart';
|
||||
import 'package:flutter_tools/src/web/file_generators/flutter_js.dart' as flutter_js;
|
||||
import 'package:flutter_tools/src/web/file_generators/flutter_service_worker_js.dart';
|
||||
|
||||
@@ -24,7 +25,6 @@ const List<String> kDart2jsLinuxArgs = <String>[
|
||||
'bin/cache/dart-sdk/bin/dart',
|
||||
'--disable-dart-dev',
|
||||
'bin/cache/dart-sdk/bin/snapshots/dart2js.dart.snapshot',
|
||||
'--libraries-spec=bin/cache/flutter_web_sdk/libraries.json',
|
||||
];
|
||||
|
||||
void main() {
|
||||
@@ -100,7 +100,7 @@ void main() {
|
||||
webResources.childFile('index.html')
|
||||
.createSync(recursive: true);
|
||||
environment.buildDir.childFile('main.dart.js').createSync();
|
||||
await const WebReleaseBundle().build(environment);
|
||||
await const WebReleaseBundle(WebRendererMode.autoDetect).build(environment);
|
||||
|
||||
expect(environment.outputDir.childFile('version.json'), exists);
|
||||
}));
|
||||
@@ -112,7 +112,7 @@ void main() {
|
||||
final Directory webResources = environment.projectDir.childDirectory('web');
|
||||
webResources.childFile('index.html').createSync(recursive: true);
|
||||
environment.buildDir.childFile('main.dart.js').createSync();
|
||||
await const WebReleaseBundle().build(environment);
|
||||
await const WebReleaseBundle(WebRendererMode.autoDetect).build(environment);
|
||||
|
||||
final String versionFile = environment.outputDir
|
||||
.childFile('version.json')
|
||||
@@ -130,7 +130,7 @@ void main() {
|
||||
<!DOCTYPE html><html><base href="$kBaseHrefPlaceholder"><head></head></html>
|
||||
''');
|
||||
environment.buildDir.childFile('main.dart.js').createSync();
|
||||
await const WebReleaseBundle().build(environment);
|
||||
await const WebReleaseBundle(WebRendererMode.autoDetect).build(environment);
|
||||
|
||||
expect(environment.outputDir.childFile('index.html').readAsStringSync(), contains('/basehreftest/'));
|
||||
}));
|
||||
@@ -143,7 +143,7 @@ void main() {
|
||||
<!DOCTYPE html><html><head><base href='/basehreftest/'></head></html>
|
||||
''');
|
||||
environment.buildDir.childFile('main.dart.js').createSync();
|
||||
await const WebReleaseBundle().build(environment);
|
||||
await const WebReleaseBundle(WebRendererMode.autoDetect).build(environment);
|
||||
|
||||
expect(environment.outputDir.childFile('index.html').readAsStringSync(), contains('/basehreftest/'));
|
||||
}));
|
||||
@@ -165,7 +165,7 @@ void main() {
|
||||
.writeAsStringSync('A');
|
||||
environment.buildDir.childFile('main.dart.js').createSync();
|
||||
|
||||
await const WebReleaseBundle().build(environment);
|
||||
await const WebReleaseBundle(WebRendererMode.autoDetect).build(environment);
|
||||
|
||||
expect(environment.outputDir.childFile('foo.txt')
|
||||
.readAsStringSync(), 'A');
|
||||
@@ -177,7 +177,7 @@ void main() {
|
||||
// Update to arbitrary resource file triggers rebuild.
|
||||
webResources.childFile('foo.txt').writeAsStringSync('B');
|
||||
|
||||
await const WebReleaseBundle().build(environment);
|
||||
await const WebReleaseBundle(WebRendererMode.autoDetect).build(environment);
|
||||
|
||||
expect(environment.outputDir.childFile('foo.txt')
|
||||
.readAsStringSync(), 'B');
|
||||
@@ -333,6 +333,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'-Ddart.vm.profile=true',
|
||||
'--no-source-maps',
|
||||
'-o',
|
||||
@@ -345,6 +346,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'-Ddart.vm.profile=true',
|
||||
'--no-source-maps',
|
||||
'-O4',
|
||||
@@ -356,7 +358,7 @@ void main() {
|
||||
]
|
||||
));
|
||||
|
||||
await const Dart2JSTarget().build(environment);
|
||||
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => processManager,
|
||||
}));
|
||||
@@ -368,6 +370,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'--enable-experiment=non-nullable',
|
||||
'-Ddart.vm.profile=true',
|
||||
'--no-source-maps',
|
||||
@@ -381,6 +384,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'--enable-experiment=non-nullable',
|
||||
'-Ddart.vm.profile=true',
|
||||
'--no-source-maps',
|
||||
@@ -392,7 +396,7 @@ void main() {
|
||||
]
|
||||
));
|
||||
|
||||
await const Dart2JSTarget().build(environment);
|
||||
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => processManager,
|
||||
}));
|
||||
@@ -402,6 +406,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'-Ddart.vm.profile=true',
|
||||
'--no-source-maps',
|
||||
'-o',
|
||||
@@ -414,6 +419,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'-Ddart.vm.profile=true',
|
||||
'--no-source-maps',
|
||||
'-O4',
|
||||
@@ -424,7 +430,7 @@ void main() {
|
||||
]
|
||||
));
|
||||
|
||||
await const Dart2JSTarget().build(environment);
|
||||
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => processManager,
|
||||
}));
|
||||
@@ -434,6 +440,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'-Ddart.vm.product=true',
|
||||
'--no-source-maps',
|
||||
'-o',
|
||||
@@ -446,6 +453,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'-Ddart.vm.product=true',
|
||||
'--no-source-maps',
|
||||
'-O4',
|
||||
@@ -455,7 +463,7 @@ void main() {
|
||||
]
|
||||
));
|
||||
|
||||
await const Dart2JSTarget().build(environment);
|
||||
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => processManager,
|
||||
}));
|
||||
@@ -466,6 +474,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'--native-null-assertions',
|
||||
'-Ddart.vm.product=true',
|
||||
'--no-source-maps',
|
||||
@@ -479,6 +488,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'--native-null-assertions',
|
||||
'-Ddart.vm.product=true',
|
||||
'--no-source-maps',
|
||||
@@ -489,7 +499,7 @@ void main() {
|
||||
]
|
||||
));
|
||||
|
||||
await const Dart2JSTarget().build(environment);
|
||||
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => processManager,
|
||||
}));
|
||||
@@ -500,6 +510,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'-Ddart.vm.product=true',
|
||||
'--no-source-maps',
|
||||
'-o',
|
||||
@@ -512,6 +523,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'-Ddart.vm.product=true',
|
||||
'--no-source-maps',
|
||||
'-O3',
|
||||
@@ -521,7 +533,7 @@ void main() {
|
||||
]
|
||||
));
|
||||
|
||||
await const Dart2JSTarget().build(environment);
|
||||
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => processManager,
|
||||
}));
|
||||
@@ -531,6 +543,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'-Ddart.vm.product=true',
|
||||
'--no-source-maps',
|
||||
'-o',
|
||||
@@ -543,7 +556,7 @@ void main() {
|
||||
.writeAsStringSync('file:///a.dart');
|
||||
},
|
||||
));
|
||||
await const Dart2JSTarget().build(environment);
|
||||
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
||||
|
||||
expect(environment.buildDir.childFile('dart2js.d'), exists);
|
||||
final Depfile depfile = depfileService.parse(environment.buildDir.childFile('dart2js.d'));
|
||||
@@ -561,6 +574,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'-Ddart.vm.product=true',
|
||||
'-DFOO=bar',
|
||||
'-DBAZ=qux',
|
||||
@@ -575,6 +589,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'-Ddart.vm.product=true',
|
||||
'-DFOO=bar',
|
||||
'-DBAZ=qux',
|
||||
@@ -586,7 +601,7 @@ void main() {
|
||||
]
|
||||
));
|
||||
|
||||
await const Dart2JSTarget().build(environment);
|
||||
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => processManager,
|
||||
}));
|
||||
@@ -597,6 +612,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'-Ddart.vm.product=true',
|
||||
'-o',
|
||||
environment.buildDir.childFile('app.dill').absolute.path,
|
||||
@@ -608,6 +624,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'-Ddart.vm.product=true',
|
||||
'-O4',
|
||||
'-o',
|
||||
@@ -616,7 +633,7 @@ void main() {
|
||||
]
|
||||
));
|
||||
|
||||
await const Dart2JSTarget().build(environment);
|
||||
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => processManager,
|
||||
}));
|
||||
@@ -628,6 +645,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'-Ddart.vm.profile=true',
|
||||
'-DFOO=bar',
|
||||
'-DBAZ=qux',
|
||||
@@ -642,6 +660,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'-Ddart.vm.profile=true',
|
||||
'-DFOO=bar',
|
||||
'-DBAZ=qux',
|
||||
@@ -654,7 +673,7 @@ void main() {
|
||||
]
|
||||
));
|
||||
|
||||
await const Dart2JSTarget().build(environment);
|
||||
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => processManager,
|
||||
}));
|
||||
@@ -665,6 +684,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'-Ddart.vm.profile=true',
|
||||
'--no-source-maps',
|
||||
'-o',
|
||||
@@ -677,6 +697,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'-Ddart.vm.profile=true',
|
||||
'--no-source-maps',
|
||||
'-O4',
|
||||
@@ -688,7 +709,7 @@ void main() {
|
||||
]
|
||||
));
|
||||
|
||||
await const Dart2JSTarget().build(environment);
|
||||
await const Dart2JSTarget(WebRendererMode.canvaskit).build(environment);
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => processManager,
|
||||
}));
|
||||
@@ -699,6 +720,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'-Ddart.vm.profile=true',
|
||||
'--no-source-maps',
|
||||
'-o',
|
||||
@@ -711,6 +733,7 @@ void main() {
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
...kDart2jsLinuxArgs,
|
||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||
'-Ddart.vm.profile=true',
|
||||
'--no-source-maps',
|
||||
'-O4',
|
||||
@@ -722,7 +745,7 @@ void main() {
|
||||
]
|
||||
));
|
||||
|
||||
await const Dart2JSTarget().build(environment);
|
||||
await const Dart2JSTarget(WebRendererMode.canvaskit).build(environment);
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => processManager,
|
||||
}));
|
||||
@@ -749,7 +772,7 @@ void main() {
|
||||
environment.outputDir.childDirectory('a').childFile('a.txt')
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('A');
|
||||
await WebServiceWorker(globals.fs, globals.cache).build(environment);
|
||||
await WebServiceWorker(globals.fs, globals.cache, WebRendererMode.autoDetect).build(environment);
|
||||
|
||||
expect(environment.outputDir.childFile('flutter_service_worker.js'), exists);
|
||||
// Contains file hash.
|
||||
@@ -768,7 +791,7 @@ void main() {
|
||||
environment.outputDir
|
||||
.childFile('index.html')
|
||||
.createSync(recursive: true);
|
||||
await WebServiceWorker(globals.fs, globals.cache).build(environment);
|
||||
await WebServiceWorker(globals.fs, globals.cache, WebRendererMode.autoDetect).build(environment);
|
||||
|
||||
expect(environment.outputDir.childFile('flutter_service_worker.js'), exists);
|
||||
// Contains file hash for both `/` and index.html.
|
||||
@@ -786,7 +809,7 @@ void main() {
|
||||
environment.outputDir
|
||||
.childFile('main.dart.js.map')
|
||||
.createSync(recursive: true);
|
||||
await WebServiceWorker(globals.fs, globals.cache).build(environment);
|
||||
await WebServiceWorker(globals.fs, globals.cache, WebRendererMode.autoDetect).build(environment);
|
||||
|
||||
// No caching of source maps.
|
||||
expect(environment.outputDir.childFile('flutter_service_worker.js').readAsStringSync(),
|
||||
|
||||
@@ -53,7 +53,7 @@ void main() {
|
||||
logger: logger,
|
||||
processManager: FakeProcessManager.list(<FakeCommand>[
|
||||
FakeCommand(command: const <String>[
|
||||
'HostArtifact.engineDartBinary',
|
||||
'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>[
|
||||
'HostArtifact.engineDartBinary',
|
||||
'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>[
|
||||
'HostArtifact.engineDartBinary',
|
||||
'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>[
|
||||
'HostArtifact.engineDartBinary',
|
||||
'Artifact.engineDartBinary',
|
||||
'--disable-dart-dev',
|
||||
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
||||
'--sdk-root',
|
||||
@@ -240,7 +240,7 @@ void main() {
|
||||
logger: logger,
|
||||
processManager: FakeProcessManager.list(<FakeCommand>[
|
||||
FakeCommand(command: const <String>[
|
||||
'HostArtifact.engineDartBinary',
|
||||
'Artifact.engineDartBinary',
|
||||
'--disable-dart-dev',
|
||||
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
||||
'--sdk-root',
|
||||
@@ -289,7 +289,7 @@ void main() {
|
||||
logger: logger,
|
||||
processManager: FakeProcessManager.list(<FakeCommand>[
|
||||
FakeCommand(command: const <String>[
|
||||
'HostArtifact.engineDartBinary',
|
||||
'Artifact.engineDartBinary',
|
||||
'--disable-dart-dev',
|
||||
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
||||
'--sdk-root',
|
||||
@@ -341,7 +341,7 @@ void main() {
|
||||
logger: logger,
|
||||
processManager: FakeProcessManager.list(<FakeCommand>[
|
||||
FakeCommand(command: const <String>[
|
||||
'HostArtifact.engineDartBinary',
|
||||
'Artifact.engineDartBinary',
|
||||
'--disable-dart-dev',
|
||||
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
||||
'--sdk-root',
|
||||
@@ -391,7 +391,7 @@ void main() {
|
||||
logger: logger,
|
||||
processManager: FakeProcessManager.list(<FakeCommand>[
|
||||
FakeCommand(command: const <String>[
|
||||
'HostArtifact.engineDartBinary',
|
||||
'Artifact.engineDartBinary',
|
||||
'--disable-dart-dev',
|
||||
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
||||
'--sdk-root',
|
||||
|
||||
@@ -30,7 +30,7 @@ void main() {
|
||||
late FakeProcessManager fakeProcessManager;
|
||||
|
||||
const List<String> frontendServerCommand = <String>[
|
||||
'HostArtifact.engineDartBinary',
|
||||
'Artifact.engineDartBinary',
|
||||
'--disable-dart-dev',
|
||||
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
||||
'--sdk-root',
|
||||
|
||||
@@ -1943,7 +1943,7 @@ flutter:
|
||||
expect(residentCompiler.targetModel, TargetModel.dartdevc);
|
||||
expect(residentCompiler.sdkRoot,
|
||||
'${globals.artifacts!.getHostArtifact(HostArtifact.flutterWebSdk).path}/');
|
||||
expect(residentCompiler.platformDill, 'file:///HostArtifact.webPlatformKernelDill');
|
||||
expect(residentCompiler.platformDill, 'file:///HostArtifact.webPlatformKernelFolder/ddc_outline.dill');
|
||||
}, overrides: <Type, Generator>{
|
||||
Artifacts: () => Artifacts.test(),
|
||||
FileSystem: () => MemoryFileSystem.test(),
|
||||
@@ -1974,7 +1974,7 @@ flutter:
|
||||
expect(residentCompiler.targetModel, TargetModel.dartdevc);
|
||||
expect(residentCompiler.sdkRoot,
|
||||
'${globals.artifacts!.getHostArtifact(HostArtifact.flutterWebSdk).path}/');
|
||||
expect(residentCompiler.platformDill, 'file:///HostArtifact.webPlatformSoundKernelDill');
|
||||
expect(residentCompiler.platformDill, 'file:///HostArtifact.webPlatformKernelFolder/ddc_outline_sound.dill');
|
||||
}, overrides: <Type, Generator>{
|
||||
Artifacts: () => Artifacts.test(),
|
||||
FileSystem: () => MemoryFileSystem.test(),
|
||||
|
||||
@@ -43,7 +43,7 @@ void main() {
|
||||
);
|
||||
|
||||
expect(
|
||||
await localEngineLocator.findEnginePath(null, 'ios_debug', null),
|
||||
await localEngineLocator.findEnginePath(localEngine: 'ios_debug'),
|
||||
matchesEngineBuildPaths(
|
||||
hostEngine: '/arbitrary/engine/src/out/host_debug',
|
||||
targetEngine: '/arbitrary/engine/src/out/ios_debug',
|
||||
@@ -58,7 +58,7 @@ void main() {
|
||||
.writeAsStringSync('sky_engine:file:///symlink/src/out/ios_debug/gen/dart-pkg/sky_engine/lib/');
|
||||
|
||||
expect(
|
||||
await localEngineLocator.findEnginePath(null, 'ios_debug', null),
|
||||
await localEngineLocator.findEnginePath(localEngine: 'ios_debug'),
|
||||
matchesEngineBuildPaths(
|
||||
hostEngine: '/symlink/src/out/host_debug',
|
||||
targetEngine: '/symlink/src/out/ios_debug',
|
||||
@@ -84,7 +84,7 @@ void main() {
|
||||
);
|
||||
|
||||
expect(
|
||||
await localEngineLocator.findEnginePath('$kArbitraryEngineRoot/src', 'ios_debug', null),
|
||||
await localEngineLocator.findEnginePath(engineSourcePath: '$kArbitraryEngineRoot/src', localEngine: 'ios_debug'),
|
||||
matchesEngineBuildPaths(
|
||||
hostEngine: '/arbitrary/engine/src/out/host_debug',
|
||||
targetEngine: '/arbitrary/engine/src/out/ios_debug',
|
||||
@@ -111,7 +111,7 @@ void main() {
|
||||
);
|
||||
|
||||
expect(
|
||||
await localEngineLocator.findEnginePath(null, localEngine.path, null),
|
||||
await localEngineLocator.findEnginePath(localEngine: localEngine.path),
|
||||
matchesEngineBuildPaths(
|
||||
hostEngine: '/arbitrary/engine/src/out/host_debug',
|
||||
targetEngine: '/arbitrary/engine/src/out/ios_debug',
|
||||
@@ -137,7 +137,7 @@ void main() {
|
||||
);
|
||||
|
||||
expect(
|
||||
await localEngineLocator.findEnginePath(null, localEngine.path, null),
|
||||
await localEngineLocator.findEnginePath(localEngine: localEngine.path),
|
||||
matchesEngineBuildPaths(
|
||||
hostEngine: '/arbitrary/engine/src/out/host_debug',
|
||||
targetEngine: '/arbitrary/engine/src/out/host_debug',
|
||||
@@ -162,7 +162,7 @@ void main() {
|
||||
);
|
||||
|
||||
expect(
|
||||
await localEngineLocator.findEnginePath(null, localEngine.path, null),
|
||||
await localEngineLocator.findEnginePath(localEngine: localEngine.path),
|
||||
matchesEngineBuildPaths(
|
||||
hostEngine: '/arbitrary/engine/src/out/host_debug_unopt_arm64',
|
||||
targetEngine: '/arbitrary/engine/src/out/host_debug_unopt_arm64',
|
||||
@@ -185,7 +185,7 @@ void main() {
|
||||
);
|
||||
|
||||
await expectToolExitLater(
|
||||
localEngineLocator.findEnginePath(null, localEngine.path, null),
|
||||
localEngineLocator.findEnginePath(localEngine: localEngine.path),
|
||||
contains('No Flutter engine build found at /arbitrary/engine/src/out/host_debug'),
|
||||
);
|
||||
});
|
||||
@@ -214,7 +214,7 @@ void main() {
|
||||
);
|
||||
|
||||
expect(
|
||||
await localEngineLocator.findEnginePath(null, 'ios_debug', null),
|
||||
await localEngineLocator.findEnginePath(localEngine: 'ios_debug'),
|
||||
matchesEngineBuildPaths(
|
||||
hostEngine: 'flutter/engine/src/out/host_debug',
|
||||
targetEngine: 'flutter/engine/src/out/ios_debug',
|
||||
@@ -236,7 +236,7 @@ void main() {
|
||||
);
|
||||
|
||||
await expectToolExitLater(
|
||||
localEngineLocator.findEnginePath(null, '/path/to/nothing', null),
|
||||
localEngineLocator.findEnginePath(localEngine: '/path/to/nothing'),
|
||||
contains('Unable to detect local Flutter engine src directory'),
|
||||
);
|
||||
});
|
||||
@@ -260,7 +260,7 @@ void main() {
|
||||
);
|
||||
|
||||
expect(
|
||||
await localWasmEngineLocator.findEnginePath(null, localWasmEngine.path, null),
|
||||
await localWasmEngineLocator.findEnginePath(localEngine: localWasmEngine.path),
|
||||
matchesEngineBuildPaths(
|
||||
hostEngine: '/arbitrary/engine/src/out/wasm_whatever',
|
||||
targetEngine: '/arbitrary/engine/src/out/wasm_whatever',
|
||||
@@ -278,7 +278,7 @@ void main() {
|
||||
);
|
||||
|
||||
expect(
|
||||
await localWebEngineLocator.findEnginePath(null, localWebEngine.path, null),
|
||||
await localWebEngineLocator.findEnginePath(localEngine: localWebEngine.path),
|
||||
matchesEngineBuildPaths(
|
||||
hostEngine: '/arbitrary/engine/src/out/web_whatever',
|
||||
targetEngine: '/arbitrary/engine/src/out/web_whatever',
|
||||
@@ -286,6 +286,34 @@ void main() {
|
||||
);
|
||||
expect(webLogger.traceText, contains('Local engine source at /arbitrary/engine/src'));
|
||||
});
|
||||
|
||||
test('returns null without throwing if nothing is specified', () async {
|
||||
final LocalEngineLocator localWebEngineLocator = LocalEngineLocator(
|
||||
fileSystem: MemoryFileSystem.test(),
|
||||
flutterRoot: 'flutter/flutter',
|
||||
logger: BufferLogger.test(),
|
||||
userMessages: UserMessages(),
|
||||
platform: FakePlatform(environment: <String, String>{}),
|
||||
);
|
||||
|
||||
final EngineBuildPaths? paths = await localWebEngineLocator.findEnginePath();
|
||||
expect(paths, isNull);
|
||||
});
|
||||
|
||||
test('throws if nothing is specified but the FLUTTER_ENGINE environment variable is set', () async {
|
||||
final LocalEngineLocator localWebEngineLocator = LocalEngineLocator(
|
||||
fileSystem: MemoryFileSystem.test(),
|
||||
flutterRoot: 'flutter/flutter',
|
||||
logger: BufferLogger.test(),
|
||||
userMessages: UserMessages(),
|
||||
platform: FakePlatform(environment: <String, String>{'FLUTTER_ENGINE': 'blah'}),
|
||||
);
|
||||
|
||||
await expectToolExitLater(
|
||||
localWebEngineLocator.findEnginePath(),
|
||||
contains('Unable to detect a Flutter engine build directory in blah'),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Matcher matchesEngineBuildPaths({
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'package:file_testing/file_testing.dart';
|
||||
import 'package:flutter_tools/src/artifacts.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/base/io.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/cache.dart';
|
||||
import 'package:flutter_tools/src/commands/create.dart';
|
||||
import 'package:flutter_tools/src/dart/pub.dart';
|
||||
@@ -412,7 +413,7 @@ Future<void> _analyzeEntity(FileSystemEntity target) async {
|
||||
];
|
||||
|
||||
final ProcessResult exec = await Process.run(
|
||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartBinary).path,
|
||||
globals.artifacts!.getArtifactPath(Artifact.engineDartBinary, platform: TargetPlatform.web_javascript),
|
||||
args,
|
||||
workingDirectory: target is Directory ? target.path : target.dirname,
|
||||
);
|
||||
@@ -451,7 +452,7 @@ Future<void> _runFlutterSnapshot(List<String> flutterCommandArgs, Directory work
|
||||
];
|
||||
|
||||
final ProcessResult exec = await Process.run(
|
||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartBinary).path,
|
||||
globals.artifacts!.getArtifactPath(Artifact.engineDartBinary, platform: TargetPlatform.web_javascript),
|
||||
args,
|
||||
workingDirectory: workingDir.path,
|
||||
);
|
||||
|
||||
@@ -19,8 +19,8 @@ void main() {
|
||||
setUp(() async {
|
||||
fileSystem = MemoryFileSystem.test();
|
||||
fileSystem.directory('HostArtifact.flutterWebSdk').createSync();
|
||||
fileSystem.file('HostArtifact.webPlatformKernelDill').createSync();
|
||||
fileSystem.file('HostArtifact.webPlatformSoundKernelDill').createSync();
|
||||
fileSystem.file('HostArtifact.webPlatformDDCKernelDill').createSync();
|
||||
fileSystem.file('HostArtifact.webPlatformDDCSoundKernelDill').createSync();
|
||||
fileSystem.file('HostArtifact.flutterWebLibrariesJson').createSync();
|
||||
|
||||
final SdkWebConfigurationProvider provider =
|
||||
@@ -34,8 +34,8 @@ void main() {
|
||||
|
||||
testWithoutContext('is correct', () {
|
||||
expect(configuration.sdkDirectory, 'HostArtifact.flutterWebSdk');
|
||||
expect(configuration.unsoundSdkSummaryPath, 'HostArtifact.webPlatformKernelDill');
|
||||
expect(configuration.soundSdkSummaryPath, 'HostArtifact.webPlatformSoundKernelDill');
|
||||
expect(configuration.unsoundSdkSummaryPath, 'HostArtifact.webPlatformDDCKernelDill');
|
||||
expect(configuration.soundSdkSummaryPath, 'HostArtifact.webPlatformDDCSoundKernelDill');
|
||||
expect(configuration.librariesPath, 'HostArtifact.flutterWebLibrariesJson');
|
||||
expect(configuration.compilerWorkerPath, isNull);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user