Unverified Commit f3e8ae7d authored by Kevin Moore's avatar Kevin Moore Committed by GitHub

flutter tool: add experimental output during wasm build (#124166)

parent 667220c9
......@@ -11,7 +11,7 @@ import '../globals.dart' as globals;
import '../html_utils.dart';
import '../project.dart';
import '../runner/flutter_command.dart'
show DevelopmentArtifact, FlutterCommandResult;
show DevelopmentArtifact, FlutterCommandResult, FlutterOptions;
import '../web/compile.dart';
import 'build.dart';
......@@ -98,14 +98,14 @@ class BuildWebCommand extends BuildSubCommand {
if (featureFlags.isFlutterWebWasmEnabled) {
argParser.addSeparator('Experimental options');
argParser.addFlag(
'wasm',
help: 'Compile to WebAssembly rather than JavaScript.',
FlutterOptions.kWebWasmFlag,
help: 'Compile to WebAssembly rather than JavaScript.\nSee $kWasmPreviewUri for more information.',
negatable: false,
);
} else {
// Add the flag as hidden. Will give a helpful error message in [runCommand] below.
argParser.addFlag(
'wasm',
FlutterOptions.kWebWasmFlag,
hide: true,
);
}
......@@ -134,7 +134,7 @@ class BuildWebCommand extends BuildSubCommand {
throwToolExit('"build web" is not currently supported. To enable, run "flutter config --enable-web".');
}
final bool wasmRequested = boolArg('wasm');
final bool wasmRequested = boolArg(FlutterOptions.kWebWasmFlag);
if (wasmRequested && !featureFlags.isFlutterWebWasmEnabled) {
throwToolExit('Compiling to WebAssembly (wasm) is only available on the master channel.');
}
......
......@@ -126,6 +126,7 @@ class FlutterOptions {
static const String kWebBrowserFlag = 'web-browser-flag';
static const String kWebRendererFlag = 'web-renderer';
static const String kWebResourcesCdnFlag = 'web-resources-cdn';
static const String kWebWasmFlag = 'wasm';
}
/// flutter command categories for usage.
......
......@@ -56,6 +56,15 @@ class WebBuilder {
bool noFrequencyBasedMinification = false,
String? outputDirectoryPath,
}) async {
if (isWasm) {
globals.logger.printBox(
title: 'Experimental feature',
'''
WebAssembly compilation is experimental.
See $kWasmPreviewUri for more information.''',
);
}
final bool hasWebPlugins =
(await findPlugins(flutterProject)).any((Plugin p) => p.platforms.containsKey(WebPlugin.kConfigKey));
final Directory outputDirectory = outputDirectoryPath == null
......@@ -165,3 +174,5 @@ const Map<WebRendererMode, Map<NullSafetyMode, HostArtifact>> kDartSdkJsMapArtif
NullSafetyMode.unsound: HostArtifact.webPrecompiledSdkSourcemaps,
},
};
const String kWasmPreviewUri = 'https://flutter.dev/wasm';
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