flutter_tool: only enable wasm compile in master channel (#121755)

flutter_tool: only enable wasm compile in master channel
This commit is contained in:
Kevin Moore
2023-03-02 14:21:50 -08:00
committed by GitHub
parent aa588365f9
commit a8cc95e36d
7 changed files with 68 additions and 14 deletions

View File

@@ -20,7 +20,7 @@ void main() {
testConfig = Config.test();
platform = FakePlatform(environment: <String, String>{});
for (final Feature feature in allFeatures) {
for (final Feature feature in allConfigurableFeatures) {
testConfig.setValue(feature.configSetting!, false);
}
@@ -81,6 +81,12 @@ void main() {
expect(featureFlags.isWebEnabled, true);
});
testWithoutContext('Flutter web wasm only enable on master', () {
expect(flutterWebWasm.getSettingForChannel('master').enabledByDefault, isTrue);
expect(flutterWebWasm.getSettingForChannel('beta').enabledByDefault, isFalse);
expect(flutterWebWasm.getSettingForChannel('stable').enabledByDefault, isFalse);
});
testWithoutContext('Flutter web help string', () {
expect(flutterWebFeature.generateHelpMessage(),
'Enable or disable Flutter for web. '

View File

@@ -80,7 +80,7 @@ void main() {
// contains all of the experiments in features.dart
expect((result.stdout as String).split('\n'), containsAll(<Matcher>[
for (final Feature feature in allFeatures)
for (final Feature feature in allConfigurableFeatures)
contains(feature.configSetting),
]));
});

View File

@@ -6,6 +6,7 @@ import 'dart:io';
import 'package:file_testing/file_testing.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/features.dart';
import '../src/common.dart';
import 'test_utils.dart';
@@ -33,18 +34,24 @@ void main() {
});
test('building web with --wasm produces expected files', () async {
final ProcessResult result = processManager.runSync(<String>[
flutterBin,
'build',
'web',
'--wasm',
], workingDirectory: exampleAppDir.path);
final ProcessResult result = processManager.runSync(
<String>[
flutterBin,
'build',
'web',
'--wasm',
],
workingDirectory: exampleAppDir.path,
environment: <String, String>{
flutterWebWasm.environmentOverride!: 'true'
},
);
expect(result.exitCode, 0);
final Directory appBuildDir = fileSystem.directory(fileSystem.path.join(
exampleAppDir.path,
'build',
'web_wasm'
'web_wasm',
));
for (final String filename in const <String>[
'flutter.js',

View File

@@ -413,6 +413,7 @@ class TestFeatureFlags implements FeatureFlags {
this.isIOSEnabled = true,
this.isFuchsiaEnabled = false,
this.areCustomDevicesEnabled = false,
this.isFlutterWebWasmEnabled = false,
});
@override
@@ -442,6 +443,9 @@ class TestFeatureFlags implements FeatureFlags {
@override
final bool areCustomDevicesEnabled;
@override
final bool isFlutterWebWasmEnabled;
@override
bool isEnabled(Feature feature) {
switch (feature) {