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.
This commit is contained in:
stuartmorgan
2019-10-29 21:43:25 -07:00
committed by GitHub
parent 9cb2047139
commit f6f6e86eb8
2 changed files with 15 additions and 15 deletions

View File

@@ -97,7 +97,7 @@ const Feature flutterWebFeature = Feature(
const Feature flutterMacOSDesktopFeature = Feature(
name: 'Flutter for desktop on macOS',
configSetting: 'enable-macos-desktop',
environmentOverride: 'ENABLE_FLUTTER_DESKTOP',
environmentOverride: 'FLUTTER_MACOS',
master: FeatureChannelSetting(
available: true,
enabledByDefault: false,
@@ -108,7 +108,7 @@ const Feature flutterMacOSDesktopFeature = Feature(
const Feature flutterLinuxDesktopFeature = Feature(
name: 'Flutter for desktop on Linux',
configSetting: 'enable-linux-desktop',
environmentOverride: 'ENABLE_FLUTTER_DESKTOP',
environmentOverride: 'FLUTTER_LINUX',
master: FeatureChannelSetting(
available: true,
enabledByDefault: false,
@@ -119,7 +119,7 @@ const Feature flutterLinuxDesktopFeature = Feature(
const Feature flutterWindowsDesktopFeature = Feature(
name: 'Flutter for desktop on Windows',
configSetting: 'enable-windows-desktop',
environmentOverride: 'ENABLE_FLUTTER_DESKTOP',
environmentOverride: 'FLUTTER_WINDOWS',
master: FeatureChannelSetting(
available: true,
enabledByDefault: false,

View File

@@ -206,7 +206,7 @@ void main() {
test('flutter macos desktop enabled with environment variable on master', () => testbed.run(() {
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);
}));
@@ -226,7 +226,7 @@ void main() {
test('flutter macos desktop not enabled with environment variable on dev', () => testbed.run(() {
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);
}));
@@ -246,7 +246,7 @@ void main() {
test('flutter macos desktop not enabled with environment variable on beta', () => testbed.run(() {
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);
}));
@@ -266,7 +266,7 @@ void main() {
test('flutter macos desktop not enabled with environment variable on stable', () => testbed.run(() {
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);
}));
@@ -287,7 +287,7 @@ void main() {
test('flutter linux desktop enabled with environment variable on master', () => testbed.run(() {
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);
}));
@@ -307,7 +307,7 @@ void main() {
test('flutter linux desktop not enabled with environment variable on dev', () => testbed.run(() {
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);
}));
@@ -327,7 +327,7 @@ void main() {
test('flutter linux desktop not enabled with environment variable on beta', () => testbed.run(() {
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);
}));
@@ -347,7 +347,7 @@ void main() {
test('flutter linux desktop not enabled with environment variable on stable', () => testbed.run(() {
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);
}));
@@ -368,7 +368,7 @@ void main() {
test('flutter windows desktop enabled with environment variable on master', () => testbed.run(() {
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);
}));
@@ -388,7 +388,7 @@ void main() {
test('flutter windows desktop not enabled with environment variable on dev', () => testbed.run(() {
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);
}));
@@ -408,7 +408,7 @@ void main() {
test('flutter windows desktop not enabled with environment variable on beta', () => testbed.run(() {
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);
}));
@@ -428,7 +428,7 @@ void main() {
test('flutter windows desktop not enabled with environment variable on stable', () => testbed.run(() {
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);
}));