mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Adjust desktop feature flag (#74348)
Prep to make https://github.com/flutter/flutter/issues/73857 easier in the future.
This commit is contained in:
parent
84722e6552
commit
5aa6cba31d
@ -159,9 +159,11 @@ const Feature flutterWebFeature = Feature(
|
||||
|
||||
/// The [Feature] for macOS desktop.
|
||||
const Feature flutterMacOSDesktopFeature = Feature(
|
||||
name: 'Flutter for desktop on macOS',
|
||||
name: 'beta-quality support for desktop on macOS',
|
||||
configSetting: 'enable-macos-desktop',
|
||||
environmentOverride: 'FLUTTER_MACOS',
|
||||
extraHelpText: flutterNext ?
|
||||
'Newer beta versions are available on the beta channel.' : null,
|
||||
master: FeatureChannelSetting(
|
||||
available: true,
|
||||
enabledByDefault: false,
|
||||
@ -170,13 +172,23 @@ const Feature flutterMacOSDesktopFeature = Feature(
|
||||
available: true,
|
||||
enabledByDefault: false,
|
||||
),
|
||||
beta: FeatureChannelSetting(
|
||||
available: flutterNext,
|
||||
enabledByDefault: false,
|
||||
),
|
||||
stable: FeatureChannelSetting(
|
||||
available: flutterNext,
|
||||
enabledByDefault: false,
|
||||
),
|
||||
);
|
||||
|
||||
/// The [Feature] for Linux desktop.
|
||||
const Feature flutterLinuxDesktopFeature = Feature(
|
||||
name: 'Flutter for desktop on Linux',
|
||||
name: 'beta-quality support for desktop on Linux',
|
||||
configSetting: 'enable-linux-desktop',
|
||||
environmentOverride: 'FLUTTER_LINUX',
|
||||
extraHelpText: flutterNext ?
|
||||
'Newer beta versions are available on the beta channel.' : null,
|
||||
master: FeatureChannelSetting(
|
||||
available: true,
|
||||
enabledByDefault: false,
|
||||
@ -185,13 +197,23 @@ const Feature flutterLinuxDesktopFeature = Feature(
|
||||
available: true,
|
||||
enabledByDefault: false,
|
||||
),
|
||||
beta: FeatureChannelSetting(
|
||||
available: flutterNext,
|
||||
enabledByDefault: false,
|
||||
),
|
||||
stable: FeatureChannelSetting(
|
||||
available: flutterNext,
|
||||
enabledByDefault: false,
|
||||
),
|
||||
);
|
||||
|
||||
/// The [Feature] for Windows desktop.
|
||||
const Feature flutterWindowsDesktopFeature = Feature(
|
||||
name: 'Flutter for desktop on Windows',
|
||||
name: 'beta-quality support for desktop on Windows',
|
||||
configSetting: 'enable-windows-desktop',
|
||||
environmentOverride: 'FLUTTER_WINDOWS',
|
||||
extraHelpText: flutterNext ?
|
||||
'Newer beta versions are available on the beta channel.' : null,
|
||||
master: FeatureChannelSetting(
|
||||
available: true,
|
||||
enabledByDefault: false,
|
||||
@ -200,6 +222,14 @@ const Feature flutterWindowsDesktopFeature = Feature(
|
||||
available: true,
|
||||
enabledByDefault: false,
|
||||
),
|
||||
beta: FeatureChannelSetting(
|
||||
available: flutterNext,
|
||||
enabledByDefault: false,
|
||||
),
|
||||
stable: FeatureChannelSetting(
|
||||
available: flutterNext,
|
||||
enabledByDefault: false,
|
||||
),
|
||||
);
|
||||
|
||||
/// The [Feature] for Android devices.
|
||||
@ -318,6 +348,7 @@ class Feature {
|
||||
@required this.name,
|
||||
this.environmentOverride,
|
||||
this.configSetting,
|
||||
this.extraHelpText,
|
||||
this.master = const FeatureChannelSetting(),
|
||||
this.dev = const FeatureChannelSetting(),
|
||||
this.beta = const FeatureChannelSetting(),
|
||||
@ -353,6 +384,11 @@ class Feature {
|
||||
/// If not provided, defaults to `null` meaning there is no config setting.
|
||||
final String configSetting;
|
||||
|
||||
/// Additional text to add to the end of the help message.
|
||||
///
|
||||
/// If not provided, defaults to `null` meaning there is no additional text.
|
||||
final String extraHelpText;
|
||||
|
||||
/// A help message for the `flutter config` command, or null if unsupported.
|
||||
String generateHelpMessage() {
|
||||
if (configSetting == null) {
|
||||
@ -375,6 +411,9 @@ class Feature {
|
||||
..removeLast()).join(', ');
|
||||
buffer.write('the $prefix, and ${channels.last} channels.');
|
||||
}
|
||||
if (extraHelpText != null) {
|
||||
buffer.write(' $extraHelpText');
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
|
||||
@ -84,19 +84,19 @@ void main() {
|
||||
|
||||
testWithoutContext('flutter macOS desktop help string', () {
|
||||
expect(flutterMacOSDesktopFeature.generateHelpMessage(),
|
||||
'Enable or disable Flutter for desktop on macOS. '
|
||||
'Enable or disable beta-quality support for desktop on macOS. '
|
||||
'This setting will take effect on the master and dev channels.');
|
||||
});
|
||||
|
||||
testWithoutContext('flutter Linux desktop help string', () {
|
||||
expect(flutterLinuxDesktopFeature.generateHelpMessage(),
|
||||
'Enable or disable Flutter for desktop on Linux. '
|
||||
'Enable or disable beta-quality support for desktop on Linux. '
|
||||
'This setting will take effect on the master and dev channels.');
|
||||
});
|
||||
|
||||
testWithoutContext('flutter Windows desktop help string', () {
|
||||
expect(flutterWindowsDesktopFeature.generateHelpMessage(),
|
||||
'Enable or disable Flutter for desktop on Windows. '
|
||||
'Enable or disable beta-quality support for desktop on Windows. '
|
||||
'This setting will take effect on the master and dev channels.');
|
||||
});
|
||||
|
||||
@ -244,9 +244,9 @@ void main() {
|
||||
expect(featureFlags.isMacOSEnabled, false);
|
||||
});
|
||||
|
||||
testWithoutContext('fflutter macos desktop not enabled with config on beta', () {
|
||||
testWithoutContext('flutter macos desktop not enabled with config on beta', () {
|
||||
when(mockFlutterVerion.channel).thenReturn('beta');
|
||||
when<bool>(mockFlutterConfig.getValue('flutter-desktop-macos') as bool).thenReturn(true);
|
||||
when<bool>(mockFlutterConfig.getValue('enable-macos-desktop') as bool).thenReturn(true);
|
||||
|
||||
expect(featureFlags.isMacOSEnabled, false);
|
||||
});
|
||||
@ -266,7 +266,7 @@ void main() {
|
||||
|
||||
testWithoutContext('flutter macos desktop not enabled with config on stable', () {
|
||||
when(mockFlutterVerion.channel).thenReturn('stable');
|
||||
when<bool>(mockFlutterConfig.getValue('flutter-desktop-macos') as bool).thenReturn(true);
|
||||
when<bool>(mockFlutterConfig.getValue('enable-macos-desktop') as bool).thenReturn(true);
|
||||
|
||||
expect(featureFlags.isMacOSEnabled, false);
|
||||
});
|
||||
@ -325,7 +325,7 @@ void main() {
|
||||
expect(featureFlags.isLinuxEnabled, false);
|
||||
});
|
||||
|
||||
testWithoutContext('fflutter linux desktop not enabled with config on beta', () {
|
||||
testWithoutContext('flutter linux desktop not enabled with config on beta', () {
|
||||
when(mockFlutterVerion.channel).thenReturn('beta');
|
||||
when<bool>(mockFlutterConfig.getValue('enable-linux-desktop') as bool).thenReturn(true);
|
||||
|
||||
@ -406,7 +406,7 @@ void main() {
|
||||
expect(featureFlags.isWindowsEnabled, false);
|
||||
});
|
||||
|
||||
testWithoutContext('fflutter windows desktop not enabled with config on beta', () {
|
||||
testWithoutContext('flutter windows desktop not enabled with config on beta', () {
|
||||
when(mockFlutterVerion.channel).thenReturn('beta');
|
||||
when<bool>(mockFlutterConfig.getValue('enable-windows-desktop') as bool).thenReturn(true);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user