Unverified Commit f12a5ec3 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

dont hide build commands (#39555)

parent f5eb12cd
......@@ -36,7 +36,7 @@ class BuildLinuxCommand extends BuildSubCommand {
final String name = 'linux';
@override
bool hidden = true;
bool get hidden => !featureFlags.isLinuxEnabled || !platform.isLinux;
@override
Future<Set<DevelopmentArtifact>> get requiredArtifacts async => <DevelopmentArtifact>{
......@@ -45,7 +45,7 @@ class BuildLinuxCommand extends BuildSubCommand {
};
@override
String get description => 'build the Linux desktop target (Experimental).';
String get description => 'build the Linux desktop target.';
@override
Future<FlutterCommandResult> runCommand() async {
......
......@@ -25,7 +25,7 @@ class BuildMacosCommand extends BuildSubCommand {
final String name = 'macos';
@override
bool hidden = true;
bool get hidden => !featureFlags.isMacOSEnabled || !platform.isMacOS;
@override
Future<Set<DevelopmentArtifact>> get requiredArtifacts async => <DevelopmentArtifact>{
......
......@@ -31,7 +31,7 @@ class BuildWebCommand extends BuildSubCommand {
final String name = 'web';
@override
bool get hidden => true;
bool get hidden => !featureFlags.isWebEnabled;
@override
final String description = 'build a web application bundle.';
......
......@@ -36,7 +36,7 @@ class BuildWindowsCommand extends BuildSubCommand {
final String name = 'windows';
@override
bool hidden = true;
bool get hidden => !featureFlags.isWindowsEnabled || !platform.isWindows;
@override
Future<Set<DevelopmentArtifact>> get requiredArtifacts async => <DevelopmentArtifact>{
......
......@@ -11,6 +11,7 @@ import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/commands/build.dart';
import 'package:flutter_tools/src/commands/build_linux.dart';
import 'package:flutter_tools/src/features.dart';
import 'package:flutter_tools/src/globals.dart';
import 'package:flutter_tools/src/linux/makefile.dart';
......@@ -162,6 +163,24 @@ BINARY_NAME=fizz_bar
Platform: () => linuxPlatform,
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
});
testUsingContext('hidden when not enabled on Linux host', () {
when(platform.isLinux).thenReturn(true);
expect(BuildLinuxCommand().hidden, true);
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false),
Platform: () => MockPlatform(),
});
testUsingContext('Not hidden when enabled and on Linux host', () {
when(platform.isLinux).thenReturn(true);
expect(BuildLinuxCommand().hidden, false);
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
Platform: () => MockPlatform(),
});
}
class MockProcessManager extends Mock implements ProcessManager {}
......
......@@ -11,6 +11,7 @@ import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/commands/build.dart';
import 'package:flutter_tools/src/commands/build_macos.dart';
import 'package:flutter_tools/src/features.dart';
import 'package:flutter_tools/src/ios/xcodeproj.dart';
import 'package:flutter_tools/src/project.dart';
......@@ -179,6 +180,24 @@ void main() {
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: false),
});
testUsingContext('hidden when not enabled on macOS host', () {
when(platform.isMacOS).thenReturn(true);
expect(BuildMacosCommand().hidden, true);
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: false),
Platform: () => MockPlatform(),
});
testUsingContext('Not hidden when enabled and on macOS host', () {
when(platform.isMacOS).thenReturn(true);
expect(BuildMacosCommand().hidden, false);
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
Platform: () => MockPlatform(),
});
}
class MockProcessManager extends Mock implements ProcessManager {}
......
......@@ -9,6 +9,7 @@ import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/commands/build.dart';
import 'package:flutter_tools/src/commands/build_web.dart';
import 'package:flutter_tools/src/device.dart';
import 'package:flutter_tools/src/features.dart';
import 'package:flutter_tools/src/project.dart';
......@@ -95,6 +96,18 @@ void main() {
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(isWebEnabled: false),
}));
test('hidden if feature flag is not enabled', () => testbed.run(() async {
expect(BuildWebCommand().hidden, true);
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(isWebEnabled: false),
}));
test('not hidden if feature flag is enabled', () => testbed.run(() async {
expect(BuildWebCommand().hidden, false);
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(isWebEnabled: true),
}));
}
class MockWebCompilationProxy extends Mock implements WebCompilationProxy {}
......
......@@ -10,6 +10,7 @@ import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/commands/build.dart';
import 'package:flutter_tools/src/commands/build_windows.dart';
import 'package:flutter_tools/src/features.dart';
import 'package:flutter_tools/src/globals.dart';
import 'package:flutter_tools/src/windows/visual_studio.dart';
......@@ -173,6 +174,24 @@ void main() {
VisualStudio: () => mockVisualStudio,
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
});
testUsingContext('hidden when not enabled on Windows host', () {
when(platform.isWindows).thenReturn(true);
expect(BuildWindowsCommand().hidden, true);
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: false),
Platform: () => MockPlatform(),
});
testUsingContext('Not hidden when enabled and on Windows host', () {
when(platform.isWindows).thenReturn(true);
expect(BuildWindowsCommand().hidden, false);
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
Platform: () => MockPlatform(),
});
}
class MockProcessManager extends Mock implements ProcessManager {}
......
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