[web] Change --web-renderer default from auto to canvaskit (#149773)

- When `--web-renderer` is omitted, keep the value `null` until it later materializes to either `canvaskit` or `skwasm`.
- No more hardcoded defaults anywhere. We use `WebRendererMode.defaultForJs/defaultForWasm` instead.
- When in `--wasm` mode, the JS fallback is now `canvaskit` instead of `auto`.
- Add test for defaulting to `skwasm` when `--wasm` is enabled.

Fixes https://github.com/flutter/flutter/issues/149826
This commit is contained in:
Mouad Debbar 2024-06-10 12:38:09 -04:00 committed by GitHub
parent 4e6e61dfd5
commit ee10d2fc3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 111 additions and 62 deletions

View File

@ -142,9 +142,14 @@ class BuildWebCommand extends BuildSubCommand {
? int.parse(dart2jsOptimizationLevelValue.substring(1)) ? int.parse(dart2jsOptimizationLevelValue.substring(1))
: optimizationLevel; : optimizationLevel;
final String? webRendererString = stringArg(FlutterOptions.kWebRendererFlag);
final WebRendererMode? webRenderer = webRendererString == null
? null
: WebRendererMode.values.byName(webRendererString);
final List<WebCompilerConfig> compilerConfigs; final List<WebCompilerConfig> compilerConfigs;
if (boolArg('wasm')) { if (boolArg(FlutterOptions.kWebWasmFlag)) {
if (stringArg(FlutterOptions.kWebRendererFlag) != argParser.defaultFor(FlutterOptions.kWebRendererFlag)) { if (webRenderer != null) {
throwToolExit('"--${FlutterOptions.kWebRendererFlag}" cannot be combined with "--${FlutterOptions.kWebWasmFlag}"'); throwToolExit('"--${FlutterOptions.kWebRendererFlag}" cannot be combined with "--${FlutterOptions.kWebWasmFlag}"');
} }
globals.logger.printBox( globals.logger.printBox(
@ -158,7 +163,6 @@ class BuildWebCommand extends BuildSubCommand {
WasmCompilerConfig( WasmCompilerConfig(
optimizationLevel: optimizationLevel, optimizationLevel: optimizationLevel,
stripWasm: boolArg('strip-wasm'), stripWasm: boolArg('strip-wasm'),
renderer: WebRendererMode.skwasm,
), ),
JsCompilerConfig( JsCompilerConfig(
csp: boolArg('csp'), csp: boolArg('csp'),
@ -167,13 +171,8 @@ class BuildWebCommand extends BuildSubCommand {
nativeNullAssertions: boolArg('native-null-assertions'), nativeNullAssertions: boolArg('native-null-assertions'),
noFrequencyBasedMinification: boolArg('no-frequency-based-minification'), noFrequencyBasedMinification: boolArg('no-frequency-based-minification'),
sourceMaps: boolArg('source-maps'), sourceMaps: boolArg('source-maps'),
renderer: WebRendererMode.canvaskit,
)]; )];
} else { } else {
WebRendererMode webRenderer = WebRendererMode.auto;
if (argParser.options.containsKey(FlutterOptions.kWebRendererFlag)) {
webRenderer = WebRendererMode.values.byName(stringArg(FlutterOptions.kWebRendererFlag)!);
}
compilerConfigs = <WebCompilerConfig>[JsCompilerConfig( compilerConfigs = <WebCompilerConfig>[JsCompilerConfig(
csp: boolArg('csp'), csp: boolArg('csp'),
optimizationLevel: jsOptimizationLevel, optimizationLevel: jsOptimizationLevel,
@ -181,7 +180,7 @@ class BuildWebCommand extends BuildSubCommand {
nativeNullAssertions: boolArg('native-null-assertions'), nativeNullAssertions: boolArg('native-null-assertions'),
noFrequencyBasedMinification: boolArg('no-frequency-based-minification'), noFrequencyBasedMinification: boolArg('no-frequency-based-minification'),
sourceMaps: boolArg('source-maps'), sourceMaps: boolArg('source-maps'),
renderer: webRenderer, renderer: webRenderer ?? WebRendererMode.defaultForJs,
)]; )];
} }

View File

@ -992,7 +992,7 @@ class DebuggingOptions {
this.webEnableExpressionEvaluation = false, this.webEnableExpressionEvaluation = false,
this.webHeaders = const <String, String>{}, this.webHeaders = const <String, String>{},
this.webLaunchUrl, this.webLaunchUrl,
this.webRenderer = WebRendererMode.auto, WebRendererMode? webRenderer,
this.webUseWasm = false, this.webUseWasm = false,
this.vmserviceOutFile, this.vmserviceOutFile,
this.fastStart = false, this.fastStart = false,
@ -1006,7 +1006,8 @@ class DebuggingOptions {
this.enableEmbedderApi = false, this.enableEmbedderApi = false,
this.usingCISystem = false, this.usingCISystem = false,
this.debugLogsDirectoryPath, this.debugLogsDirectoryPath,
}) : debuggingEnabled = true; }) : debuggingEnabled = true,
webRenderer = webRenderer ?? WebRendererMode.getDefault(useWasm: webUseWasm);
DebuggingOptions.disabled(this.buildInfo, { DebuggingOptions.disabled(this.buildInfo, {
this.dartEntrypointArgs = const <String>[], this.dartEntrypointArgs = const <String>[],
@ -1023,7 +1024,7 @@ class DebuggingOptions {
this.webBrowserFlags = const <String>[], this.webBrowserFlags = const <String>[],
this.webLaunchUrl, this.webLaunchUrl,
this.webHeaders = const <String, String>{}, this.webHeaders = const <String, String>{},
this.webRenderer = WebRendererMode.auto, WebRendererMode? webRenderer,
this.webUseWasm = false, this.webUseWasm = false,
this.cacheSkSL = false, this.cacheSkSL = false,
this.traceAllowlist, this.traceAllowlist,
@ -1061,7 +1062,8 @@ class DebuggingOptions {
webEnableExpressionEvaluation = false, webEnableExpressionEvaluation = false,
nullAssertions = false, nullAssertions = false,
nativeNullAssertions = false, nativeNullAssertions = false,
serveObservatory = false; serveObservatory = false,
webRenderer = webRenderer ?? WebRendererMode.getDefault(useWasm: webUseWasm);
DebuggingOptions._({ DebuggingOptions._({
required this.buildInfo, required this.buildInfo,

View File

@ -711,7 +711,6 @@ abstract class FlutterCommand extends Command<void> {
void usesWebRendererOption() { void usesWebRendererOption() {
argParser.addOption( argParser.addOption(
FlutterOptions.kWebRendererFlag, FlutterOptions.kWebRendererFlag,
defaultsTo: WebRendererMode.auto.name,
allowed: WebRendererMode.values.map((WebRendererMode e) => e.name), 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: CliEnum.allowedHelp(WebRendererMode.values) allowedHelp: CliEnum.allowedHelp(WebRendererMode.values)

View File

@ -185,16 +185,19 @@ enum WebRendererMode implements CliEnum {
skwasm; skwasm;
factory WebRendererMode.fromCliOption(String? webRendererString, {required bool useWasm}) { factory WebRendererMode.fromCliOption(String? webRendererString, {required bool useWasm}) {
final WebRendererMode mode = webRendererString != null if (webRendererString == null) {
? WebRendererMode.values.byName(webRendererString) return getDefault(useWasm: useWasm);
: WebRendererMode.auto;
if (mode == WebRendererMode.auto && useWasm) {
// Wasm defaults to skwasm
return WebRendererMode.skwasm;
} }
return mode; return WebRendererMode.values.byName(webRendererString);
} }
static WebRendererMode getDefault({required bool useWasm}) {
return useWasm ? defaultForWasm : defaultForJs;
}
static const WebRendererMode defaultForJs = WebRendererMode.canvaskit;
static const WebRendererMode defaultForWasm = WebRendererMode.skwasm;
@override @override
String get cliName => kebabCase(name); String get cliName => kebabCase(name);
@ -210,22 +213,22 @@ enum WebRendererMode implements CliEnum {
}; };
Iterable<String> get dartDefines => switch (this) { Iterable<String> get dartDefines => switch (this) {
WebRendererMode.auto => <String>[ auto => <String>[
'FLUTTER_WEB_AUTO_DETECT=true', 'FLUTTER_WEB_AUTO_DETECT=true',
], ],
WebRendererMode.canvaskit => <String>[ canvaskit => <String>[
'FLUTTER_WEB_AUTO_DETECT=false', 'FLUTTER_WEB_AUTO_DETECT=false',
'FLUTTER_WEB_USE_SKIA=true', 'FLUTTER_WEB_USE_SKIA=true',
], ],
WebRendererMode.html => <String>[ html => <String>[
'FLUTTER_WEB_AUTO_DETECT=false', 'FLUTTER_WEB_AUTO_DETECT=false',
'FLUTTER_WEB_USE_SKIA=false', 'FLUTTER_WEB_USE_SKIA=false',
], ],
WebRendererMode.skwasm => <String>[ skwasm => <String>[
'FLUTTER_WEB_AUTO_DETECT=false', 'FLUTTER_WEB_AUTO_DETECT=false',
'FLUTTER_WEB_USE_SKIA=false', 'FLUTTER_WEB_USE_SKIA=false',
'FLUTTER_WEB_USE_SKWASM=true', 'FLUTTER_WEB_USE_SKWASM=true',
] ],
}; };
List<String> updateDartDefines(List<String> inputDefines) { List<String> updateDartDefines(List<String> inputDefines) {

View File

@ -51,7 +51,7 @@ class JsCompilerConfig extends WebCompilerConfig {
super.optimizationLevel = WebCompilerConfig.kDefaultOptimizationLevel, super.optimizationLevel = WebCompilerConfig.kDefaultOptimizationLevel,
this.noFrequencyBasedMinification = false, this.noFrequencyBasedMinification = false,
this.sourceMaps = true, this.sourceMaps = true,
super.renderer = WebRendererMode.auto, super.renderer = WebRendererMode.defaultForJs,
}); });
/// Instantiates [JsCompilerConfig] suitable for the `flutter run` command. /// Instantiates [JsCompilerConfig] suitable for the `flutter run` command.
@ -136,7 +136,7 @@ class WasmCompilerConfig extends WebCompilerConfig {
const WasmCompilerConfig({ const WasmCompilerConfig({
super.optimizationLevel = WebCompilerConfig.kDefaultOptimizationLevel, super.optimizationLevel = WebCompilerConfig.kDefaultOptimizationLevel,
this.stripWasm = true, this.stripWasm = true,
super.renderer = WebRendererMode.auto, super.renderer = WebRendererMode.defaultForWasm,
}); });
/// Build environment for [stripWasm]. /// Build environment for [stripWasm].

View File

@ -274,7 +274,7 @@ void main() {
ProcessManager: () => processManager, ProcessManager: () => processManager,
}); });
testUsingContext('Defaults to web renderer auto mode when no option is specified', () async { testUsingContext('Defaults to web renderer canvaskit mode when no option is specified', () async {
final TestWebBuildCommand buildCommand = TestWebBuildCommand(fileSystem: fileSystem); final TestWebBuildCommand buildCommand = TestWebBuildCommand(fileSystem: fileSystem);
final CommandRunner<void> runner = createTestCommandRunner(buildCommand); final CommandRunner<void> runner = createTestCommandRunner(buildCommand);
setupFileSystemForEndToEndTest(fileSystem); setupFileSystemForEndToEndTest(fileSystem);
@ -288,7 +288,28 @@ void main() {
expect(target, isA<WebServiceWorker>()); expect(target, isA<WebServiceWorker>());
final List<WebCompilerConfig> configs = (target as WebServiceWorker).compileConfigs; final List<WebCompilerConfig> configs = (target as WebServiceWorker).compileConfigs;
expect(configs.length, 1); expect(configs.length, 1);
expect(configs.first.renderer, WebRendererMode.auto); expect(configs.first.renderer, WebRendererMode.canvaskit);
}),
});
testUsingContext('Defaults to web renderer skwasm mode for wasm when no option is specified', () async {
final TestWebBuildCommand buildCommand = TestWebBuildCommand(fileSystem: fileSystem);
final CommandRunner<void> runner = createTestCommandRunner(buildCommand);
setupFileSystemForEndToEndTest(fileSystem);
await runner.run(<String>['build', 'web', '--no-pub', '--wasm']);
}, overrides: <Type, Generator>{
Platform: () => fakePlatform,
FileSystem: () => fileSystem,
FeatureFlags: () => TestFeatureFlags(isWebEnabled: true),
ProcessManager: () => processManager,
BuildSystem: () => TestBuildSystem.all(BuildResult(success: true), (Target target, Environment environment) {
expect(target, isA<WebServiceWorker>());
final List<WebCompilerConfig> configs = (target as WebServiceWorker).compileConfigs;
expect(configs.length, 2);
expect(configs[0].renderer, WebRendererMode.skwasm);
expect(configs[0].compileTarget, CompileTarget.wasm);
expect(configs[1].renderer, WebRendererMode.canvaskit);
expect(configs[1].compileTarget, CompileTarget.js);
}), }),
}); });

View File

@ -35,13 +35,13 @@ void main() {
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=true']); expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=true']);
}); });
test('canvaskit web-renderer with no dart-defines', () { test('canvaskit web-renderer with existing dart-defines', () {
dartDefines = <String>['FLUTTER_WEB_USE_SKIA=false']; dartDefines = <String>['FLUTTER_WEB_USE_SKIA=false'];
dartDefines = WebRendererMode.canvaskit.updateDartDefines(dartDefines); dartDefines = WebRendererMode.canvaskit.updateDartDefines(dartDefines);
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=false','FLUTTER_WEB_USE_SKIA=true']); expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=false','FLUTTER_WEB_USE_SKIA=true']);
}); });
test('html web-renderer with no dart-defines', () { test('html web-renderer with existing dart-defines', () {
dartDefines = <String>['FLUTTER_WEB_USE_SKIA=true']; dartDefines = <String>['FLUTTER_WEB_USE_SKIA=true'];
dartDefines = WebRendererMode.html.updateDartDefines(dartDefines); dartDefines = WebRendererMode.html.updateDartDefines(dartDefines);
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=false','FLUTTER_WEB_USE_SKIA=false']); expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=false','FLUTTER_WEB_USE_SKIA=false']);

View File

@ -376,7 +376,8 @@ void main() {
command: <String>[ command: <String>[
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'-Ddart.vm.profile=true', '-Ddart.vm.profile=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-source-maps', '--no-source-maps',
'-o', '-o',
environment.buildDir.childFile('app.dill').absolute.path, environment.buildDir.childFile('app.dill').absolute.path,
@ -389,7 +390,8 @@ void main() {
command: <String>[ command: <String>[
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'-Ddart.vm.profile=true', '-Ddart.vm.profile=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-minify', '--no-minify',
'--no-source-maps', '--no-source-maps',
'-O4', '-O4',
@ -417,7 +419,8 @@ void main() {
command: <String>[ command: <String>[
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'-Ddart.vm.profile=true', '-Ddart.vm.profile=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-source-maps', '--no-source-maps',
'-o', '-o',
environment.buildDir.childFile('app.dill').absolute.path, environment.buildDir.childFile('app.dill').absolute.path,
@ -430,7 +433,8 @@ void main() {
command: <String>[ command: <String>[
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'-Ddart.vm.profile=true', '-Ddart.vm.profile=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-minify', '--no-minify',
'--no-source-maps', '--no-source-maps',
'-O4', '-O4',
@ -457,7 +461,8 @@ void main() {
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'--enable-experiment=non-nullable', '--enable-experiment=non-nullable',
'-Ddart.vm.profile=true', '-Ddart.vm.profile=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-source-maps', '--no-source-maps',
'-o', '-o',
environment.buildDir.childFile('app.dill').absolute.path, environment.buildDir.childFile('app.dill').absolute.path,
@ -471,7 +476,8 @@ void main() {
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'--enable-experiment=non-nullable', '--enable-experiment=non-nullable',
'-Ddart.vm.profile=true', '-Ddart.vm.profile=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-minify', '--no-minify',
'--no-source-maps', '--no-source-maps',
'-O4', '-O4',
@ -496,7 +502,8 @@ void main() {
command: <String>[ command: <String>[
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'-Ddart.vm.profile=true', '-Ddart.vm.profile=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-source-maps', '--no-source-maps',
'-o', '-o',
environment.buildDir.childFile('app.dill').absolute.path, environment.buildDir.childFile('app.dill').absolute.path,
@ -509,7 +516,8 @@ void main() {
command: <String>[ command: <String>[
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'-Ddart.vm.profile=true', '-Ddart.vm.profile=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-minify', '--no-minify',
'--no-source-maps', '--no-source-maps',
'-O4', '-O4',
@ -534,7 +542,8 @@ void main() {
command: <String>[ command: <String>[
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'-Ddart.vm.product=true', '-Ddart.vm.product=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-source-maps', '--no-source-maps',
'-o', '-o',
environment.buildDir.childFile('app.dill').absolute.path, environment.buildDir.childFile('app.dill').absolute.path,
@ -547,7 +556,8 @@ void main() {
command: <String>[ command: <String>[
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'-Ddart.vm.product=true', '-Ddart.vm.product=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-source-maps', '--no-source-maps',
'-O4', '-O4',
'-o', '-o',
@ -572,7 +582,8 @@ void main() {
command: <String>[ command: <String>[
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'-Ddart.vm.product=true', '-Ddart.vm.product=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--native-null-assertions', '--native-null-assertions',
'--no-source-maps', '--no-source-maps',
'-o', '-o',
@ -586,7 +597,8 @@ void main() {
command: <String>[ command: <String>[
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'-Ddart.vm.product=true', '-Ddart.vm.product=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--native-null-assertions', '--native-null-assertions',
'--no-source-maps', '--no-source-maps',
'-O4', '-O4',
@ -612,7 +624,8 @@ void main() {
command: <String>[ command: <String>[
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'-Ddart.vm.product=true', '-Ddart.vm.product=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-source-maps', '--no-source-maps',
'-o', '-o',
environment.buildDir.childFile('app.dill').absolute.path, environment.buildDir.childFile('app.dill').absolute.path,
@ -625,7 +638,8 @@ void main() {
command: <String>[ command: <String>[
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'-Ddart.vm.product=true', '-Ddart.vm.product=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-source-maps', '--no-source-maps',
'-O3', '-O3',
'-o', '-o',
@ -650,7 +664,8 @@ void main() {
command: <String>[ command: <String>[
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'-Ddart.vm.product=true', '-Ddart.vm.product=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-source-maps', '--no-source-maps',
'-o', '-o',
environment.buildDir.childFile('app.dill').absolute.path, environment.buildDir.childFile('app.dill').absolute.path,
@ -666,7 +681,8 @@ void main() {
command: <String>[ command: <String>[
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'-Ddart.vm.product=true', '-Ddart.vm.product=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-source-maps', '--no-source-maps',
'-O4', '-O4',
'-o', '-o',
@ -700,7 +716,8 @@ void main() {
'-Ddart.vm.product=true', '-Ddart.vm.product=true',
'-DFOO=bar', '-DFOO=bar',
'-DBAZ=qux', '-DBAZ=qux',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-source-maps', '--no-source-maps',
'-o', '-o',
environment.buildDir.childFile('app.dill').absolute.path, environment.buildDir.childFile('app.dill').absolute.path,
@ -715,7 +732,8 @@ void main() {
'-Ddart.vm.product=true', '-Ddart.vm.product=true',
'-DFOO=bar', '-DFOO=bar',
'-DBAZ=qux', '-DBAZ=qux',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-source-maps', '--no-source-maps',
'-O4', '-O4',
'-o', '-o',
@ -740,7 +758,8 @@ void main() {
command: <String>[ command: <String>[
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'-Ddart.vm.product=true', '-Ddart.vm.product=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'-o', '-o',
environment.buildDir.childFile('app.dill').absolute.path, environment.buildDir.childFile('app.dill').absolute.path,
'--packages=.dart_tool/package_config.json', '--packages=.dart_tool/package_config.json',
@ -752,7 +771,8 @@ void main() {
command: <String>[ command: <String>[
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'-Ddart.vm.product=true', '-Ddart.vm.product=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'-O4', '-O4',
'-o', '-o',
environment.buildDir.childFile('main.dart.js').absolute.path, environment.buildDir.childFile('main.dart.js').absolute.path,
@ -777,7 +797,8 @@ void main() {
'-Ddart.vm.profile=true', '-Ddart.vm.profile=true',
'-DFOO=bar', '-DFOO=bar',
'-DBAZ=qux', '-DBAZ=qux',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-source-maps', '--no-source-maps',
'-o', '-o',
environment.buildDir.childFile('app.dill').absolute.path, environment.buildDir.childFile('app.dill').absolute.path,
@ -792,7 +813,8 @@ void main() {
'-Ddart.vm.profile=true', '-Ddart.vm.profile=true',
'-DFOO=bar', '-DFOO=bar',
'-DBAZ=qux', '-DBAZ=qux',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-minify', '--no-minify',
'--no-source-maps', '--no-source-maps',
'-O4', '-O4',
@ -818,7 +840,8 @@ void main() {
command: <String>[ command: <String>[
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'-Ddart.vm.profile=true', '-Ddart.vm.profile=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-source-maps', '--no-source-maps',
'-o', '-o',
environment.buildDir.childFile('app.dill').absolute.path, environment.buildDir.childFile('app.dill').absolute.path,
@ -831,7 +854,8 @@ void main() {
command: <String>[ command: <String>[
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'-Ddart.vm.profile=true', '-Ddart.vm.profile=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-minify', '--no-minify',
'--no-source-maps', '--no-source-maps',
'-O4', '-O4',
@ -859,7 +883,8 @@ void main() {
command: <String>[ command: <String>[
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'-Ddart.vm.profile=true', '-Ddart.vm.profile=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-source-maps', '--no-source-maps',
'-o', '-o',
environment.buildDir.childFile('app.dill').absolute.path, environment.buildDir.childFile('app.dill').absolute.path,
@ -872,7 +897,8 @@ void main() {
command: <String>[ command: <String>[
..._kDart2jsLinuxArgs, ..._kDart2jsLinuxArgs,
'-Ddart.vm.profile=true', '-Ddart.vm.profile=true',
'-DFLUTTER_WEB_AUTO_DETECT=true', '-DFLUTTER_WEB_AUTO_DETECT=false',
'-DFLUTTER_WEB_USE_SKIA=true',
'--no-minify', '--no-minify',
'--no-source-maps', '--no-source-maps',
'-O4', '-O4',
@ -963,7 +989,7 @@ void main() {
JsCompilerConfig(optimizationLevel: 0), JsCompilerConfig(optimizationLevel: 0),
JsCompilerConfig(noFrequencyBasedMinification: true), JsCompilerConfig(noFrequencyBasedMinification: true),
JsCompilerConfig(sourceMaps: false), JsCompilerConfig(sourceMaps: false),
JsCompilerConfig(renderer: WebRendererMode.canvaskit), JsCompilerConfig(renderer: WebRendererMode.html),
// All properties non-default // All properties non-default
JsCompilerConfig( JsCompilerConfig(
@ -973,7 +999,7 @@ void main() {
optimizationLevel: 0, optimizationLevel: 0,
noFrequencyBasedMinification: true, noFrequencyBasedMinification: true,
sourceMaps: false, sourceMaps: false,
renderer: WebRendererMode.canvaskit, renderer: WebRendererMode.html,
), ),
]; ];

View File

@ -76,7 +76,6 @@ void main() {
const WasmCompilerConfig( const WasmCompilerConfig(
optimizationLevel: 0, optimizationLevel: 0,
stripWasm: false, stripWasm: false,
renderer: WebRendererMode.skwasm,
), ),
const JsCompilerConfig.run( const JsCompilerConfig.run(
nativeNullAssertions: true, nativeNullAssertions: true,
@ -165,7 +164,7 @@ void main() {
BuildInfo.debug, BuildInfo.debug,
ServiceWorkerStrategy.offlineFirst, ServiceWorkerStrategy.offlineFirst,
compilerConfigs: <WebCompilerConfig>[ compilerConfigs: <WebCompilerConfig>[
const JsCompilerConfig.run(nativeNullAssertions: true, renderer: WebRendererMode.auto), const JsCompilerConfig.run(nativeNullAssertions: true, renderer: WebRendererMode.canvaskit),
] ]
), ),
throwsToolExit(message: 'Failed to compile application for the Web.')); throwsToolExit(message: 'Failed to compile application for the Web.'));