Unverified Commit f6f6e86e authored by stuartmorgan's avatar stuartmorgan Committed by GitHub

Split desktop config fallback variable by platform (#43758)

The environment variable for all desktop platforms is currently
ENABLE_FLUTTER_DESKTOP to allow backward compatibility with existing
workflows. However, this is actually causing issues since 'flutter
config' provides a better experience (most importantly, IDEs will work
correctly, which is generally not the case with the environemnt
variable). Currently people following old (third-patry) instructions
don't realize that they are missing available functionality, so aren't
looking for the current instructions.

In adddition, this will be confusing as different platform graduate to
channels other than master at different times.

To resolve both issues, the environment variable fallback is now
separate for each desktop platform, and follows a naming scheme
consistent with the web environment variable.
parent 9cb20471
...@@ -97,7 +97,7 @@ const Feature flutterWebFeature = Feature( ...@@ -97,7 +97,7 @@ const Feature flutterWebFeature = Feature(
const Feature flutterMacOSDesktopFeature = Feature( const Feature flutterMacOSDesktopFeature = Feature(
name: 'Flutter for desktop on macOS', name: 'Flutter for desktop on macOS',
configSetting: 'enable-macos-desktop', configSetting: 'enable-macos-desktop',
environmentOverride: 'ENABLE_FLUTTER_DESKTOP', environmentOverride: 'FLUTTER_MACOS',
master: FeatureChannelSetting( master: FeatureChannelSetting(
available: true, available: true,
enabledByDefault: false, enabledByDefault: false,
...@@ -108,7 +108,7 @@ const Feature flutterMacOSDesktopFeature = Feature( ...@@ -108,7 +108,7 @@ const Feature flutterMacOSDesktopFeature = Feature(
const Feature flutterLinuxDesktopFeature = Feature( const Feature flutterLinuxDesktopFeature = Feature(
name: 'Flutter for desktop on Linux', name: 'Flutter for desktop on Linux',
configSetting: 'enable-linux-desktop', configSetting: 'enable-linux-desktop',
environmentOverride: 'ENABLE_FLUTTER_DESKTOP', environmentOverride: 'FLUTTER_LINUX',
master: FeatureChannelSetting( master: FeatureChannelSetting(
available: true, available: true,
enabledByDefault: false, enabledByDefault: false,
...@@ -119,7 +119,7 @@ const Feature flutterLinuxDesktopFeature = Feature( ...@@ -119,7 +119,7 @@ const Feature flutterLinuxDesktopFeature = Feature(
const Feature flutterWindowsDesktopFeature = Feature( const Feature flutterWindowsDesktopFeature = Feature(
name: 'Flutter for desktop on Windows', name: 'Flutter for desktop on Windows',
configSetting: 'enable-windows-desktop', configSetting: 'enable-windows-desktop',
environmentOverride: 'ENABLE_FLUTTER_DESKTOP', environmentOverride: 'FLUTTER_WINDOWS',
master: FeatureChannelSetting( master: FeatureChannelSetting(
available: true, available: true,
enabledByDefault: false, enabledByDefault: false,
......
...@@ -206,7 +206,7 @@ void main() { ...@@ -206,7 +206,7 @@ void main() {
test('flutter macos desktop enabled with environment variable on master', () => testbed.run(() { test('flutter macos desktop enabled with environment variable on master', () => testbed.run(() {
when(mockFlutterVerion.channel).thenReturn('master'); when(mockFlutterVerion.channel).thenReturn('master');
when(mockPlatform.environment).thenReturn(<String, String>{'ENABLE_FLUTTER_DESKTOP': 'true'}); when(mockPlatform.environment).thenReturn(<String, String>{'FLUTTER_MACOS': 'true'});
expect(featureFlags.isMacOSEnabled, true); expect(featureFlags.isMacOSEnabled, true);
})); }));
...@@ -226,7 +226,7 @@ void main() { ...@@ -226,7 +226,7 @@ void main() {
test('flutter macos desktop not enabled with environment variable on dev', () => testbed.run(() { test('flutter macos desktop not enabled with environment variable on dev', () => testbed.run(() {
when(mockFlutterVerion.channel).thenReturn('dev'); when(mockFlutterVerion.channel).thenReturn('dev');
when(mockPlatform.environment).thenReturn(<String, String>{'ENABLE_FLUTTER_DESKTOP': 'true'}); when(mockPlatform.environment).thenReturn(<String, String>{'FLUTTER_MACOS': 'true'});
expect(featureFlags.isMacOSEnabled, false); expect(featureFlags.isMacOSEnabled, false);
})); }));
...@@ -246,7 +246,7 @@ void main() { ...@@ -246,7 +246,7 @@ void main() {
test('flutter macos desktop not enabled with environment variable on beta', () => testbed.run(() { test('flutter macos desktop not enabled with environment variable on beta', () => testbed.run(() {
when(mockFlutterVerion.channel).thenReturn('beta'); when(mockFlutterVerion.channel).thenReturn('beta');
when(mockPlatform.environment).thenReturn(<String, String>{'ENABLE_FLUTTER_DESKTOP': 'true'}); when(mockPlatform.environment).thenReturn(<String, String>{'FLUTTER_MACOS': 'true'});
expect(featureFlags.isMacOSEnabled, false); expect(featureFlags.isMacOSEnabled, false);
})); }));
...@@ -266,7 +266,7 @@ void main() { ...@@ -266,7 +266,7 @@ void main() {
test('flutter macos desktop not enabled with environment variable on stable', () => testbed.run(() { test('flutter macos desktop not enabled with environment variable on stable', () => testbed.run(() {
when(mockFlutterVerion.channel).thenReturn('stable'); when(mockFlutterVerion.channel).thenReturn('stable');
when(mockPlatform.environment).thenReturn(<String, String>{'ENABLE_FLUTTER_DESKTOP': 'true'}); when(mockPlatform.environment).thenReturn(<String, String>{'FLUTTER_MACOS': 'true'});
expect(featureFlags.isMacOSEnabled, false); expect(featureFlags.isMacOSEnabled, false);
})); }));
...@@ -287,7 +287,7 @@ void main() { ...@@ -287,7 +287,7 @@ void main() {
test('flutter linux desktop enabled with environment variable on master', () => testbed.run(() { test('flutter linux desktop enabled with environment variable on master', () => testbed.run(() {
when(mockFlutterVerion.channel).thenReturn('master'); when(mockFlutterVerion.channel).thenReturn('master');
when(mockPlatform.environment).thenReturn(<String, String>{'ENABLE_FLUTTER_DESKTOP': 'true'}); when(mockPlatform.environment).thenReturn(<String, String>{'FLUTTER_LINUX': 'true'});
expect(featureFlags.isLinuxEnabled, true); expect(featureFlags.isLinuxEnabled, true);
})); }));
...@@ -307,7 +307,7 @@ void main() { ...@@ -307,7 +307,7 @@ void main() {
test('flutter linux desktop not enabled with environment variable on dev', () => testbed.run(() { test('flutter linux desktop not enabled with environment variable on dev', () => testbed.run(() {
when(mockFlutterVerion.channel).thenReturn('dev'); when(mockFlutterVerion.channel).thenReturn('dev');
when(mockPlatform.environment).thenReturn(<String, String>{'ENABLE_FLUTTER_DESKTOP': 'true'}); when(mockPlatform.environment).thenReturn(<String, String>{'FLUTTER_LINUX': 'true'});
expect(featureFlags.isLinuxEnabled, false); expect(featureFlags.isLinuxEnabled, false);
})); }));
...@@ -327,7 +327,7 @@ void main() { ...@@ -327,7 +327,7 @@ void main() {
test('flutter linux desktop not enabled with environment variable on beta', () => testbed.run(() { test('flutter linux desktop not enabled with environment variable on beta', () => testbed.run(() {
when(mockFlutterVerion.channel).thenReturn('beta'); when(mockFlutterVerion.channel).thenReturn('beta');
when(mockPlatform.environment).thenReturn(<String, String>{'ENABLE_FLUTTER_DESKTOP': 'true'}); when(mockPlatform.environment).thenReturn(<String, String>{'FLUTTER_LINUX': 'true'});
expect(featureFlags.isLinuxEnabled, false); expect(featureFlags.isLinuxEnabled, false);
})); }));
...@@ -347,7 +347,7 @@ void main() { ...@@ -347,7 +347,7 @@ void main() {
test('flutter linux desktop not enabled with environment variable on stable', () => testbed.run(() { test('flutter linux desktop not enabled with environment variable on stable', () => testbed.run(() {
when(mockFlutterVerion.channel).thenReturn('stable'); when(mockFlutterVerion.channel).thenReturn('stable');
when(mockPlatform.environment).thenReturn(<String, String>{'ENABLE_FLUTTER_DESKTOP': 'true'}); when(mockPlatform.environment).thenReturn(<String, String>{'FLUTTER_LINUX': 'true'});
expect(featureFlags.isLinuxEnabled, false); expect(featureFlags.isLinuxEnabled, false);
})); }));
...@@ -368,7 +368,7 @@ void main() { ...@@ -368,7 +368,7 @@ void main() {
test('flutter windows desktop enabled with environment variable on master', () => testbed.run(() { test('flutter windows desktop enabled with environment variable on master', () => testbed.run(() {
when(mockFlutterVerion.channel).thenReturn('master'); when(mockFlutterVerion.channel).thenReturn('master');
when(mockPlatform.environment).thenReturn(<String, String>{'ENABLE_FLUTTER_DESKTOP': 'true'}); when(mockPlatform.environment).thenReturn(<String, String>{'FLUTTER_WINDOWS': 'true'});
expect(featureFlags.isWindowsEnabled, true); expect(featureFlags.isWindowsEnabled, true);
})); }));
...@@ -388,7 +388,7 @@ void main() { ...@@ -388,7 +388,7 @@ void main() {
test('flutter windows desktop not enabled with environment variable on dev', () => testbed.run(() { test('flutter windows desktop not enabled with environment variable on dev', () => testbed.run(() {
when(mockFlutterVerion.channel).thenReturn('dev'); when(mockFlutterVerion.channel).thenReturn('dev');
when(mockPlatform.environment).thenReturn(<String, String>{'ENABLE_FLUTTER_DESKTOP': 'true'}); when(mockPlatform.environment).thenReturn(<String, String>{'FLUTTER_WINDOWS': 'true'});
expect(featureFlags.isWindowsEnabled, false); expect(featureFlags.isWindowsEnabled, false);
})); }));
...@@ -408,7 +408,7 @@ void main() { ...@@ -408,7 +408,7 @@ void main() {
test('flutter windows desktop not enabled with environment variable on beta', () => testbed.run(() { test('flutter windows desktop not enabled with environment variable on beta', () => testbed.run(() {
when(mockFlutterVerion.channel).thenReturn('beta'); when(mockFlutterVerion.channel).thenReturn('beta');
when(mockPlatform.environment).thenReturn(<String, String>{'ENABLE_FLUTTER_DESKTOP': 'true'}); when(mockPlatform.environment).thenReturn(<String, String>{'FLUTTER_WINDOWS': 'true'});
expect(featureFlags.isWindowsEnabled, false); expect(featureFlags.isWindowsEnabled, false);
})); }));
...@@ -428,7 +428,7 @@ void main() { ...@@ -428,7 +428,7 @@ void main() {
test('flutter windows desktop not enabled with environment variable on stable', () => testbed.run(() { test('flutter windows desktop not enabled with environment variable on stable', () => testbed.run(() {
when(mockFlutterVerion.channel).thenReturn('stable'); when(mockFlutterVerion.channel).thenReturn('stable');
when(mockPlatform.environment).thenReturn(<String, String>{'ENABLE_FLUTTER_DESKTOP': 'true'}); when(mockPlatform.environment).thenReturn(<String, String>{'FLUTTER_WINDOWS': 'true'});
expect(featureFlags.isWindowsEnabled, false); expect(featureFlags.isWindowsEnabled, false);
})); }));
......
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