Skip to content

Commit 388f321

Browse files
authored
[flutter_tools] Enable WebAssembly compilation everywhere, remove feature flag (#145562)
1 parent 55528ba commit 388f321

File tree

7 files changed

+4
-48
lines changed

7 files changed

+4
-48
lines changed

packages/flutter_tools/lib/src/commands/build_web.dart

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,22 +97,18 @@ class BuildWebCommand extends BuildSubCommand {
9797
);
9898

9999
//
100-
// Experimental options
100+
// WebAssembly compilation options
101101
//
102-
if (featureFlags.isFlutterWebWasmEnabled) {
103-
argParser.addSeparator('Experimental options');
104-
}
102+
argParser.addSeparator('WebAssembly compilation options');
105103
argParser.addFlag(
106104
FlutterOptions.kWebWasmFlag,
107105
help: 'Compile to WebAssembly rather than JavaScript.\n$kWasmMoreInfo',
108106
negatable: false,
109-
hide: !featureFlags.isFlutterWebWasmEnabled,
110107
);
111108
argParser.addFlag(
112109
'strip-wasm',
113110
help: 'Whether to strip the resulting wasm file of static symbol names.',
114111
defaultsTo: true,
115-
hide: !featureFlags.isFlutterWebWasmEnabled,
116112
);
117113
}
118114

@@ -148,16 +144,13 @@ class BuildWebCommand extends BuildSubCommand {
148144

149145
final List<WebCompilerConfig> compilerConfigs;
150146
if (boolArg('wasm')) {
151-
if (!featureFlags.isFlutterWebWasmEnabled) {
152-
throwToolExit('Compiling to WebAssembly (wasm) is only available on the beta and master channels.');
153-
}
154147
if (stringArg(FlutterOptions.kWebRendererFlag) != argParser.defaultFor(FlutterOptions.kWebRendererFlag)) {
155148
throwToolExit('"--${FlutterOptions.kWebRendererFlag}" cannot be combined with "--${FlutterOptions.kWebWasmFlag}"');
156149
}
157150
globals.logger.printBox(
158-
title: 'Experimental feature',
151+
title: 'New feature',
159152
'''
160-
WebAssembly compilation is experimental.
153+
WebAssembly compilation is new. Understand the details before deploying to production.
161154
$kWasmMoreInfo''',
162155
);
163156

packages/flutter_tools/lib/src/commands/test.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import '../build_info.dart';
1212
import '../bundle_builder.dart';
1313
import '../devfs.dart';
1414
import '../device.dart';
15-
import '../features.dart';
1615
import '../globals.dart' as globals;
1716
import '../native_assets.dart';
1817
import '../project.dart';
@@ -240,7 +239,6 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
240239
FlutterOptions.kWebWasmFlag,
241240
help: 'Compile to WebAssembly rather than JavaScript.\n$kWasmMoreInfo',
242241
negatable: false,
243-
hide: !featureFlags.isFlutterWebWasmEnabled,
244242
);
245243

246244
addDdsOptions(verboseHelp: verboseHelp);

packages/flutter_tools/lib/src/features.dart

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ abstract class FeatureFlags {
4242
/// Whether custom devices are enabled.
4343
bool get areCustomDevicesEnabled => false;
4444

45-
/// Whether WebAssembly compilation for Flutter Web is enabled.
46-
bool get isFlutterWebWasmEnabled => false;
47-
4845
/// Whether animations are used in the command line interface.
4946
bool get isCliAnimationEnabled => true;
5047

@@ -70,7 +67,6 @@ const List<Feature> allFeatures = <Feature>[
7067
flutterIOSFeature,
7168
flutterFuchsiaFeature,
7269
flutterCustomDevicesFeature,
73-
flutterWebWasm,
7470
cliAnimation,
7571
nativeAssets,
7672
previewDevice,
@@ -146,20 +142,6 @@ const Feature flutterCustomDevicesFeature = Feature(
146142
),
147143
);
148144

149-
/// Enabling WebAssembly compilation from `flutter build web`
150-
const Feature flutterWebWasm = Feature(
151-
name: 'WebAssembly compilation from flutter build web',
152-
environmentOverride: 'FLUTTER_WEB_WASM',
153-
beta: FeatureChannelSetting(
154-
available: true,
155-
enabledByDefault: true,
156-
),
157-
master: FeatureChannelSetting(
158-
available: true,
159-
enabledByDefault: true,
160-
),
161-
);
162-
163145
const String kCliAnimationsFeatureName = 'cli-animations';
164146

165147
/// The [Feature] for CLI animations.

packages/flutter_tools/lib/src/flutter_features.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ class FlutterFeatureFlags implements FeatureFlags {
4444
@override
4545
bool get areCustomDevicesEnabled => isEnabled(flutterCustomDevicesFeature);
4646

47-
@override
48-
bool get isFlutterWebWasmEnabled => isEnabled(flutterWebWasm);
49-
5047
@override
5148
bool get isCliAnimationEnabled {
5249
if (_platform.environment['TERM'] == 'dumb') {

packages/flutter_tools/test/general.shard/features_test.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,6 @@ void main() {
8181
expect(featureFlags.isWebEnabled, true);
8282
});
8383

84-
testWithoutContext('Flutter web wasm only enable on master', () {
85-
expect(flutterWebWasm.getSettingForChannel('master').enabledByDefault, isTrue);
86-
expect(flutterWebWasm.getSettingForChannel('beta').enabledByDefault, isTrue);
87-
expect(flutterWebWasm.getSettingForChannel('stable').enabledByDefault, isFalse);
88-
});
89-
9084
testWithoutContext('Flutter web help string', () {
9185
expect(flutterWebFeature.generateHelpMessage(),
9286
'Enable or disable Flutter for web.');

packages/flutter_tools/test/integration.shard/flutter_build_wasm_test.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import 'dart:io';
66

77
import 'package:file_testing/file_testing.dart';
88
import 'package:flutter_tools/src/base/file_system.dart';
9-
import 'package:flutter_tools/src/features.dart';
109

1110
import '../src/common.dart';
1211
import 'test_utils.dart';
@@ -42,9 +41,6 @@ void main() {
4241
'--wasm',
4342
],
4443
workingDirectory: exampleAppDir.path,
45-
environment: <String, String>{
46-
flutterWebWasm.environmentOverride!: 'true'
47-
},
4844
);
4945
expect(result, const ProcessResultMatcher());
5046

packages/flutter_tools/test/src/fakes.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,6 @@ class TestFeatureFlags implements FeatureFlags {
469469
this.isIOSEnabled = true,
470470
this.isFuchsiaEnabled = false,
471471
this.areCustomDevicesEnabled = false,
472-
this.isFlutterWebWasmEnabled = false,
473472
this.isCliAnimationEnabled = true,
474473
this.isNativeAssetsEnabled = false,
475474
this.isPreviewDeviceEnabled = false,
@@ -499,9 +498,6 @@ class TestFeatureFlags implements FeatureFlags {
499498
@override
500499
final bool areCustomDevicesEnabled;
501500

502-
@override
503-
final bool isFlutterWebWasmEnabled;
504-
505501
@override
506502
final bool isCliAnimationEnabled;
507503

0 commit comments

Comments
 (0)