Unverified Commit 895879c1 authored by Kevin Moore's avatar Kevin Moore Committed by GitHub

flutter_tools: Flutter Web CLI cleanup (#124564)

flutter_tools: Flutter Web CLI cleanup
parent 328635b3
...@@ -35,7 +35,7 @@ class BuildInfo { ...@@ -35,7 +35,7 @@ class BuildInfo {
List<String>? dartDefines, List<String>? dartDefines,
this.bundleSkSLPath, this.bundleSkSLPath,
List<String>? dartExperiments, List<String>? dartExperiments,
this.webRenderer = WebRendererMode.autoDetect, this.webRenderer = WebRendererMode.auto,
required this.treeShakeIcons, required this.treeShakeIcons,
this.performanceMeasurementFile, this.performanceMeasurementFile,
this.dartDefineConfigJsonMap, this.dartDefineConfigJsonMap,
......
...@@ -778,7 +778,7 @@ class WebDevFS implements DevFS { ...@@ -778,7 +778,7 @@ class WebDevFS implements DevFS {
final int selectedPort = webAssetServer.selectedPort; final int selectedPort = webAssetServer.selectedPort;
if (buildInfo.dartDefines.contains('FLUTTER_WEB_AUTO_DETECT=true')) { if (buildInfo.dartDefines.contains('FLUTTER_WEB_AUTO_DETECT=true')) {
webAssetServer.webRenderer = WebRendererMode.autoDetect; webAssetServer.webRenderer = WebRendererMode.auto;
} else if (buildInfo.dartDefines.contains('FLUTTER_WEB_USE_SKIA=true')) { } else if (buildInfo.dartDefines.contains('FLUTTER_WEB_USE_SKIA=true')) {
webAssetServer.webRenderer = WebRendererMode.canvaskit; webAssetServer.webRenderer = WebRendererMode.canvaskit;
} }
......
...@@ -157,36 +157,6 @@ abstract class FlutterCommand extends Command<void> { ...@@ -157,36 +157,6 @@ abstract class FlutterCommand extends Command<void> {
/// The flag name for whether or not to use ipv6. /// The flag name for whether or not to use ipv6.
static const String ipv6Flag = 'ipv6'; static const String ipv6Flag = 'ipv6';
/// Maps command line web renderer strings to the corresponding web renderer mode
static const Map<String, WebRendererMode> _webRendererModeMap =
<String, WebRendererMode> {
'auto': WebRendererMode.autoDetect,
'canvaskit': WebRendererMode.canvaskit,
'html': WebRendererMode.html,
'skwasm': WebRendererMode.skwasm,
};
/// The map used to convert web renderer mode to a List of dart-defines.
static const Map<WebRendererMode, Iterable<String>> _webRendererDartDefines =
<WebRendererMode, Iterable<String>> {
WebRendererMode.autoDetect: <String>[
'FLUTTER_WEB_AUTO_DETECT=true',
],
WebRendererMode.canvaskit: <String>[
'FLUTTER_WEB_AUTO_DETECT=false',
'FLUTTER_WEB_USE_SKIA=true',
],
WebRendererMode.html: <String>[
'FLUTTER_WEB_AUTO_DETECT=false',
'FLUTTER_WEB_USE_SKIA=false',
],
WebRendererMode.skwasm: <String>[
'FLUTTER_WEB_AUTO_DETECT=false',
'FLUTTER_WEB_USE_SKIA=false',
'FLUTTER_WEB_USE_SKWASM=true',
]
};
@override @override
ArgParser get argParser => _argParser; ArgParser get argParser => _argParser;
final ArgParser _argParser = ArgParser( final ArgParser _argParser = ArgParser(
...@@ -668,15 +638,10 @@ abstract class FlutterCommand extends Command<void> { ...@@ -668,15 +638,10 @@ abstract class FlutterCommand extends Command<void> {
void usesWebRendererOption() { void usesWebRendererOption() {
argParser.addOption( argParser.addOption(
FlutterOptions.kWebRendererFlag, FlutterOptions.kWebRendererFlag,
defaultsTo: 'auto', defaultsTo: WebRendererMode.auto.name,
allowed: <String>['auto', 'canvaskit', 'html', 'skwasm'], allowed: WebRendererMode.values.map((WebRendererMode e) => e.name),
help: 'The renderer implementation to use when building for the web.', help: 'The renderer implementation to use when building for the web.',
allowedHelp: <String, String>{ allowedHelp: Map<String, String>.fromEntries(WebRendererMode.values.map((WebRendererMode e) => MapEntry<String, String>(e.name, e.helpText)))
'html': 'Always use the HTML renderer. This renderer uses a combination of HTML, CSS, SVG, 2D Canvas, and WebGL.',
'canvaskit': 'Always use the CanvasKit renderer. This renderer uses WebGL and WebAssembly to render graphics.',
'auto': 'Use the HTML renderer on mobile devices, and CanvasKit on desktop devices.',
'skwasm': 'Always use the experimental skwasm renderer.',
}
); );
} }
...@@ -1236,12 +1201,9 @@ abstract class FlutterCommand extends Command<void> { ...@@ -1236,12 +1201,9 @@ abstract class FlutterCommand extends Command<void> {
final Map<String, Object>? defineConfigJsonMap = extractDartDefineConfigJsonMap(); final Map<String, Object>? defineConfigJsonMap = extractDartDefineConfigJsonMap();
List<String> dartDefines = extractDartDefines(defineConfigJsonMap: defineConfigJsonMap); List<String> dartDefines = extractDartDefines(defineConfigJsonMap: defineConfigJsonMap);
WebRendererMode webRenderer = WebRendererMode.autoDetect; WebRendererMode webRenderer = WebRendererMode.auto;
if (argParser.options.containsKey(FlutterOptions.kWebRendererFlag)) { if (argParser.options.containsKey(FlutterOptions.kWebRendererFlag)) {
final WebRendererMode? mappedMode = _webRendererModeMap[stringArg(FlutterOptions.kWebRendererFlag)!]; webRenderer = WebRendererMode.values.byName(stringArg(FlutterOptions.kWebRendererFlag)!);
if (mappedMode != null) {
webRenderer = mappedMode;
}
dartDefines = updateDartDefines(dartDefines, webRenderer); dartDefines = updateDartDefines(dartDefines, webRenderer);
} }
...@@ -1427,10 +1389,7 @@ abstract class FlutterCommand extends Command<void> { ...@@ -1427,10 +1389,7 @@ abstract class FlutterCommand extends Command<void> {
&& dartDefines.any((String d) => d.startsWith('FLUTTER_WEB_USE_SKIA='))) { && dartDefines.any((String d) => d.startsWith('FLUTTER_WEB_USE_SKIA='))) {
dartDefinesSet.removeWhere((String d) => d.startsWith('FLUTTER_WEB_USE_SKIA=')); dartDefinesSet.removeWhere((String d) => d.startsWith('FLUTTER_WEB_USE_SKIA='));
} }
final Iterable<String>? webRendererDefine = _webRendererDartDefines[webRenderer]; dartDefinesSet.addAll(webRenderer.dartDefines);
if (webRendererDefine != null) {
dartDefinesSet.addAll(webRendererDefine);
}
return dartDefinesSet.toList(); return dartDefinesSet.toList();
} }
......
...@@ -135,18 +135,50 @@ class WebBuilder { ...@@ -135,18 +135,50 @@ class WebBuilder {
/// Web rendering backend mode. /// Web rendering backend mode.
enum WebRendererMode { enum WebRendererMode {
/// Auto detects which rendering backend to use. /// Auto detects which rendering backend to use.
autoDetect, auto,
/// Always uses canvaskit. /// Always uses canvaskit.
canvaskit, canvaskit,
/// Always uses html. /// Always uses html.
html, html,
/// Always use skwasm. /// Always use skwasm.
skwasm, skwasm;
String get helpText => switch (this) {
auto =>
'Use the HTML renderer on mobile devices, and CanvasKit on desktop devices.',
canvaskit =>
'Always use the CanvasKit renderer. This renderer uses WebGL and WebAssembly to render graphics.',
html =>
'Always use the HTML renderer. This renderer uses a combination of HTML, CSS, SVG, 2D Canvas, and WebGL.',
skwasm => 'Always use the experimental skwasm renderer.'
};
Iterable<String> get dartDefines => switch (this) {
WebRendererMode.auto => <String>[
'FLUTTER_WEB_AUTO_DETECT=true',
],
WebRendererMode.canvaskit => <String>[
'FLUTTER_WEB_AUTO_DETECT=false',
'FLUTTER_WEB_USE_SKIA=true',
],
WebRendererMode.html => <String>[
'FLUTTER_WEB_AUTO_DETECT=false',
'FLUTTER_WEB_USE_SKIA=false',
],
WebRendererMode.skwasm => <String>[
'FLUTTER_WEB_AUTO_DETECT=false',
'FLUTTER_WEB_USE_SKIA=false',
'FLUTTER_WEB_USE_SKWASM=true',
]
};
} }
/// The correct precompiled artifact to use for each build and render mode. /// The correct precompiled artifact to use for each build and render mode.
const Map<WebRendererMode, Map<NullSafetyMode, HostArtifact>> kDartSdkJsArtifactMap = <WebRendererMode, Map<NullSafetyMode, HostArtifact>>{ const Map<WebRendererMode, Map<NullSafetyMode, HostArtifact>> kDartSdkJsArtifactMap = <WebRendererMode, Map<NullSafetyMode, HostArtifact>>{
WebRendererMode.autoDetect: <NullSafetyMode, HostArtifact> { WebRendererMode.auto: <NullSafetyMode, HostArtifact> {
NullSafetyMode.sound: HostArtifact.webPrecompiledCanvaskitAndHtmlSoundSdk, NullSafetyMode.sound: HostArtifact.webPrecompiledCanvaskitAndHtmlSoundSdk,
NullSafetyMode.unsound: HostArtifact.webPrecompiledCanvaskitAndHtmlSdk, NullSafetyMode.unsound: HostArtifact.webPrecompiledCanvaskitAndHtmlSdk,
}, },
...@@ -162,7 +194,7 @@ const Map<WebRendererMode, Map<NullSafetyMode, HostArtifact>> kDartSdkJsArtifact ...@@ -162,7 +194,7 @@ const Map<WebRendererMode, Map<NullSafetyMode, HostArtifact>> kDartSdkJsArtifact
/// The correct source map artifact to use for each build and render mode. /// The correct source map artifact to use for each build and render mode.
const Map<WebRendererMode, Map<NullSafetyMode, HostArtifact>> kDartSdkJsMapArtifactMap = <WebRendererMode, Map<NullSafetyMode, HostArtifact>>{ const Map<WebRendererMode, Map<NullSafetyMode, HostArtifact>> kDartSdkJsMapArtifactMap = <WebRendererMode, Map<NullSafetyMode, HostArtifact>>{
WebRendererMode.autoDetect: <NullSafetyMode, HostArtifact> { WebRendererMode.auto: <NullSafetyMode, HostArtifact> {
NullSafetyMode.sound: HostArtifact.webPrecompiledCanvaskitAndHtmlSoundSdkSourcemaps, NullSafetyMode.sound: HostArtifact.webPrecompiledCanvaskitAndHtmlSoundSdkSourcemaps,
NullSafetyMode.unsound: HostArtifact.webPrecompiledCanvaskitAndHtmlSdkSourcemaps, NullSafetyMode.unsound: HostArtifact.webPrecompiledCanvaskitAndHtmlSdkSourcemaps,
}, },
......
...@@ -929,7 +929,7 @@ void main() { ...@@ -929,7 +929,7 @@ void main() {
}); });
test('auto web-renderer with no dart-defines', () { test('auto web-renderer with no dart-defines', () {
dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.autoDetect); dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.auto);
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=true']); expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=true']);
}); });
...@@ -945,7 +945,7 @@ void main() { ...@@ -945,7 +945,7 @@ void main() {
test('auto web-renderer with existing dart-defines', () { test('auto web-renderer with existing dart-defines', () {
dartDefines = <String>['FLUTTER_WEB_USE_SKIA=false']; dartDefines = <String>['FLUTTER_WEB_USE_SKIA=false'];
dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.autoDetect); dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.auto);
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=true']); expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=true']);
}); });
......
...@@ -101,7 +101,7 @@ void main() { ...@@ -101,7 +101,7 @@ void main() {
webResources.childFile('index.html') webResources.childFile('index.html')
.createSync(recursive: true); .createSync(recursive: true);
environment.buildDir.childFile('main.dart.js').createSync(); environment.buildDir.childFile('main.dart.js').createSync();
await const WebReleaseBundle(WebRendererMode.autoDetect, isWasm: false).build(environment); await const WebReleaseBundle(WebRendererMode.auto, isWasm: false).build(environment);
expect(environment.outputDir.childFile('version.json'), exists); expect(environment.outputDir.childFile('version.json'), exists);
})); }));
...@@ -113,7 +113,7 @@ void main() { ...@@ -113,7 +113,7 @@ void main() {
final Directory webResources = environment.projectDir.childDirectory('web'); final Directory webResources = environment.projectDir.childDirectory('web');
webResources.childFile('index.html').createSync(recursive: true); webResources.childFile('index.html').createSync(recursive: true);
environment.buildDir.childFile('main.dart.js').createSync(); environment.buildDir.childFile('main.dart.js').createSync();
await const WebReleaseBundle(WebRendererMode.autoDetect, isWasm: false).build(environment); await const WebReleaseBundle(WebRendererMode.auto, isWasm: false).build(environment);
final String versionFile = environment.outputDir final String versionFile = environment.outputDir
.childFile('version.json') .childFile('version.json')
...@@ -131,7 +131,7 @@ void main() { ...@@ -131,7 +131,7 @@ void main() {
<!DOCTYPE html><html><base href="$kBaseHrefPlaceholder"><head></head></html> <!DOCTYPE html><html><base href="$kBaseHrefPlaceholder"><head></head></html>
'''); ''');
environment.buildDir.childFile('main.dart.js').createSync(); environment.buildDir.childFile('main.dart.js').createSync();
await const WebReleaseBundle(WebRendererMode.autoDetect, isWasm: false).build(environment); await const WebReleaseBundle(WebRendererMode.auto, isWasm: false).build(environment);
expect(environment.outputDir.childFile('index.html').readAsStringSync(), contains('/basehreftest/')); expect(environment.outputDir.childFile('index.html').readAsStringSync(), contains('/basehreftest/'));
})); }));
...@@ -144,7 +144,7 @@ void main() { ...@@ -144,7 +144,7 @@ void main() {
<!DOCTYPE html><html><head><base href='/basehreftest/'></head></html> <!DOCTYPE html><html><head><base href='/basehreftest/'></head></html>
'''); ''');
environment.buildDir.childFile('main.dart.js').createSync(); environment.buildDir.childFile('main.dart.js').createSync();
await const WebReleaseBundle(WebRendererMode.autoDetect, isWasm: false).build(environment); await const WebReleaseBundle(WebRendererMode.auto, isWasm: false).build(environment);
expect(environment.outputDir.childFile('index.html').readAsStringSync(), contains('/basehreftest/')); expect(environment.outputDir.childFile('index.html').readAsStringSync(), contains('/basehreftest/'));
})); }));
...@@ -166,7 +166,7 @@ void main() { ...@@ -166,7 +166,7 @@ void main() {
.writeAsStringSync('A'); .writeAsStringSync('A');
environment.buildDir.childFile('main.dart.js').createSync(); environment.buildDir.childFile('main.dart.js').createSync();
await const WebReleaseBundle(WebRendererMode.autoDetect, isWasm: false).build(environment); await const WebReleaseBundle(WebRendererMode.auto, isWasm: false).build(environment);
expect(environment.outputDir.childFile('foo.txt') expect(environment.outputDir.childFile('foo.txt')
.readAsStringSync(), 'A'); .readAsStringSync(), 'A');
...@@ -178,7 +178,7 @@ void main() { ...@@ -178,7 +178,7 @@ void main() {
// Update to arbitrary resource file triggers rebuild. // Update to arbitrary resource file triggers rebuild.
webResources.childFile('foo.txt').writeAsStringSync('B'); webResources.childFile('foo.txt').writeAsStringSync('B');
await const WebReleaseBundle(WebRendererMode.autoDetect, isWasm: false).build(environment); await const WebReleaseBundle(WebRendererMode.auto, isWasm: false).build(environment);
expect(environment.outputDir.childFile('foo.txt') expect(environment.outputDir.childFile('foo.txt')
.readAsStringSync(), 'B'); .readAsStringSync(), 'B');
...@@ -361,7 +361,7 @@ void main() { ...@@ -361,7 +361,7 @@ void main() {
] ]
)); ));
await Dart2JSTarget(WebRendererMode.autoDetect).build(environment); await Dart2JSTarget(WebRendererMode.auto).build(environment);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => processManager, ProcessManager: () => processManager,
})); }));
...@@ -401,7 +401,7 @@ void main() { ...@@ -401,7 +401,7 @@ void main() {
] ]
)); ));
await Dart2JSTarget(WebRendererMode.autoDetect).build(environment); await Dart2JSTarget(WebRendererMode.auto).build(environment);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => processManager, ProcessManager: () => processManager,
})); }));
...@@ -437,7 +437,7 @@ void main() { ...@@ -437,7 +437,7 @@ void main() {
] ]
)); ));
await Dart2JSTarget(WebRendererMode.autoDetect).build(environment); await Dart2JSTarget(WebRendererMode.auto).build(environment);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => processManager, ProcessManager: () => processManager,
})); }));
...@@ -472,7 +472,7 @@ void main() { ...@@ -472,7 +472,7 @@ void main() {
] ]
)); ));
await Dart2JSTarget(WebRendererMode.autoDetect).build(environment); await Dart2JSTarget(WebRendererMode.auto).build(environment);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => processManager, ProcessManager: () => processManager,
})); }));
...@@ -510,7 +510,7 @@ void main() { ...@@ -510,7 +510,7 @@ void main() {
] ]
)); ));
await Dart2JSTarget(WebRendererMode.autoDetect).build(environment); await Dart2JSTarget(WebRendererMode.auto).build(environment);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => processManager, ProcessManager: () => processManager,
})); }));
...@@ -546,7 +546,7 @@ void main() { ...@@ -546,7 +546,7 @@ void main() {
] ]
)); ));
await Dart2JSTarget(WebRendererMode.autoDetect).build(environment); await Dart2JSTarget(WebRendererMode.auto).build(environment);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => processManager, ProcessManager: () => processManager,
})); }));
...@@ -570,7 +570,7 @@ void main() { ...@@ -570,7 +570,7 @@ void main() {
.writeAsStringSync('file:///a.dart'); .writeAsStringSync('file:///a.dart');
}, },
)); ));
await Dart2JSTarget(WebRendererMode.autoDetect).build(environment); await Dart2JSTarget(WebRendererMode.auto).build(environment);
expect(environment.buildDir.childFile('dart2js.d'), exists); expect(environment.buildDir.childFile('dart2js.d'), exists);
final Depfile depfile = depfileService.parse(environment.buildDir.childFile('dart2js.d')); final Depfile depfile = depfileService.parse(environment.buildDir.childFile('dart2js.d'));
...@@ -617,7 +617,7 @@ void main() { ...@@ -617,7 +617,7 @@ void main() {
] ]
)); ));
await Dart2JSTarget(WebRendererMode.autoDetect).build(environment); await Dart2JSTarget(WebRendererMode.auto).build(environment);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => processManager, ProcessManager: () => processManager,
})); }));
...@@ -651,7 +651,7 @@ void main() { ...@@ -651,7 +651,7 @@ void main() {
] ]
)); ));
await Dart2JSTarget(WebRendererMode.autoDetect).build(environment); await Dart2JSTarget(WebRendererMode.auto).build(environment);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => processManager, ProcessManager: () => processManager,
})); }));
...@@ -693,7 +693,7 @@ void main() { ...@@ -693,7 +693,7 @@ void main() {
] ]
)); ));
await Dart2JSTarget(WebRendererMode.autoDetect).build(environment); await Dart2JSTarget(WebRendererMode.auto).build(environment);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => processManager, ProcessManager: () => processManager,
})); }));
...@@ -922,7 +922,7 @@ void main() { ...@@ -922,7 +922,7 @@ void main() {
environment.outputDir.childDirectory('a').childFile('a.txt') environment.outputDir.childDirectory('a').childFile('a.txt')
..createSync(recursive: true) ..createSync(recursive: true)
..writeAsStringSync('A'); ..writeAsStringSync('A');
await WebServiceWorker(globals.fs, WebRendererMode.autoDetect, isWasm: false).build(environment); await WebServiceWorker(globals.fs, WebRendererMode.auto, isWasm: false).build(environment);
expect(environment.outputDir.childFile('flutter_service_worker.js'), exists); expect(environment.outputDir.childFile('flutter_service_worker.js'), exists);
// Contains file hash. // Contains file hash.
...@@ -941,7 +941,7 @@ void main() { ...@@ -941,7 +941,7 @@ void main() {
environment.outputDir environment.outputDir
.childFile('index.html') .childFile('index.html')
.createSync(recursive: true); .createSync(recursive: true);
await WebServiceWorker(globals.fs, WebRendererMode.autoDetect, isWasm: false).build(environment); await WebServiceWorker(globals.fs, WebRendererMode.auto, isWasm: false).build(environment);
expect(environment.outputDir.childFile('flutter_service_worker.js'), exists); expect(environment.outputDir.childFile('flutter_service_worker.js'), exists);
// Contains file hash for both `/` and index.html. // Contains file hash for both `/` and index.html.
...@@ -959,7 +959,7 @@ void main() { ...@@ -959,7 +959,7 @@ void main() {
environment.outputDir environment.outputDir
.childFile('main.dart.js.map') .childFile('main.dart.js.map')
.createSync(recursive: true); .createSync(recursive: true);
await WebServiceWorker(globals.fs, WebRendererMode.autoDetect, isWasm: false).build(environment); await WebServiceWorker(globals.fs, WebRendererMode.auto, isWasm: false).build(environment);
// No caching of source maps. // No caching of source maps.
expect(environment.outputDir.childFile('flutter_service_worker.js').readAsStringSync(), expect(environment.outputDir.childFile('flutter_service_worker.js').readAsStringSync(),
...@@ -991,7 +991,7 @@ void main() { ...@@ -991,7 +991,7 @@ void main() {
..createSync(recursive: true) ..createSync(recursive: true)
..writeAsStringSync('OL'); ..writeAsStringSync('OL');
await WebBuiltInAssets(globals.fs, WebRendererMode.autoDetect, isWasm: false).build(environment); await WebBuiltInAssets(globals.fs, WebRendererMode.auto, isWasm: false).build(environment);
// No caching of source maps. // No caching of source maps.
final String fileGeneratorsPath = environment.artifacts final String fileGeneratorsPath = environment.artifacts
...@@ -1008,7 +1008,7 @@ void main() { ...@@ -1008,7 +1008,7 @@ void main() {
globals.fs.file('bin/cache/flutter_web_sdk/canvaskit/canvaskit.wasm') globals.fs.file('bin/cache/flutter_web_sdk/canvaskit/canvaskit.wasm')
.createSync(recursive: true); .createSync(recursive: true);
await WebBuiltInAssets(globals.fs, WebRendererMode.autoDetect, isWasm: true).build(environment); await WebBuiltInAssets(globals.fs, WebRendererMode.auto, isWasm: true).build(environment);
expect(environment.outputDir.childFile('main.dart.js').existsSync(), true); expect(environment.outputDir.childFile('main.dart.js').existsSync(), true);
expect(environment.outputDir.childDirectory('canvaskit') expect(environment.outputDir.childDirectory('canvaskit')
...@@ -1021,7 +1021,7 @@ void main() { ...@@ -1021,7 +1021,7 @@ void main() {
..createSync(recursive: true); ..createSync(recursive: true);
canvasKitInput.writeAsStringSync('foo', flush: true); canvasKitInput.writeAsStringSync('foo', flush: true);
await WebBuiltInAssets(globals.fs, WebRendererMode.autoDetect, isWasm: true).build(environment); await WebBuiltInAssets(globals.fs, WebRendererMode.auto, isWasm: true).build(environment);
final File canvasKitOutputBefore = environment.outputDir.childDirectory('canvaskit') final File canvasKitOutputBefore = environment.outputDir.childDirectory('canvaskit')
.childFile('canvaskit.wasm'); .childFile('canvaskit.wasm');
...@@ -1030,7 +1030,7 @@ void main() { ...@@ -1030,7 +1030,7 @@ void main() {
canvasKitInput.writeAsStringSync('bar', flush: true); canvasKitInput.writeAsStringSync('bar', flush: true);
await WebBuiltInAssets(globals.fs, WebRendererMode.autoDetect, isWasm: true).build(environment); await WebBuiltInAssets(globals.fs, WebRendererMode.auto, isWasm: true).build(environment);
final File canvasKitOutputAfter = environment.outputDir.childDirectory('canvaskit') final File canvasKitOutputAfter = environment.outputDir.childDirectory('canvaskit')
.childFile('canvaskit.wasm'); .childFile('canvaskit.wasm');
......
...@@ -39,7 +39,7 @@ void main() { ...@@ -39,7 +39,7 @@ void main() {
TestBuildSystem.all(BuildResult(success: true), (Target target, Environment environment) { TestBuildSystem.all(BuildResult(success: true), (Target target, Environment environment) {
final WebServiceWorker webServiceWorker = target as WebServiceWorker; final WebServiceWorker webServiceWorker = target as WebServiceWorker;
expect(webServiceWorker.isWasm, isTrue, reason: 'should be wasm'); expect(webServiceWorker.isWasm, isTrue, reason: 'should be wasm');
expect(webServiceWorker.webRenderer, WebRendererMode.autoDetect); expect(webServiceWorker.webRenderer, WebRendererMode.auto);
expect(environment.defines, <String, String>{ expect(environment.defines, <String, String>{
'TargetFile': 'target', 'TargetFile': 'target',
......
...@@ -1052,7 +1052,7 @@ void main() { ...@@ -1052,7 +1052,7 @@ void main() {
await webDevFS.create(); await webDevFS.create();
expect(webDevFS.webAssetServer.webRenderer, WebRendererMode.autoDetect); expect(webDevFS.webAssetServer.webRenderer, WebRendererMode.auto);
await webDevFS.destroy(); await webDevFS.destroy();
})); }));
......
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