Unverified Commit 8be1c9ef authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] turn off fuchsia support by default (#61634)

parent a821bdbf
...@@ -15,6 +15,7 @@ import 'package:flutter_tools/src/cache.dart'; ...@@ -15,6 +15,7 @@ import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/commands/attach.dart'; import 'package:flutter_tools/src/commands/attach.dart';
import 'package:flutter_tools/src/commands/doctor.dart'; import 'package:flutter_tools/src/commands/doctor.dart';
import 'package:flutter_tools/src/device.dart'; import 'package:flutter_tools/src/device.dart';
import 'package:flutter_tools/src/features.dart';
import 'package:flutter_tools/src/fuchsia/fuchsia_device.dart'; import 'package:flutter_tools/src/fuchsia/fuchsia_device.dart';
import 'package:flutter_tools/src/fuchsia/fuchsia_sdk.dart'; import 'package:flutter_tools/src/fuchsia/fuchsia_sdk.dart';
import 'package:flutter_tools/src/fuchsia/fuchsia_workflow.dart'; import 'package:flutter_tools/src/fuchsia/fuchsia_workflow.dart';
...@@ -106,6 +107,7 @@ Future<void> main(List<String> args) async { ...@@ -106,6 +107,7 @@ Future<void> main(List<String> args) async {
muteCommandLogging: false, muteCommandLogging: false,
verboseHelp: false, verboseHelp: false,
overrides: <Type, Generator>{ overrides: <Type, Generator>{
FeatureFlags: () => const _FuchsiaFeatureFlags(),
DeviceManager: () => _FuchsiaDeviceManager(), DeviceManager: () => _FuchsiaDeviceManager(),
FuchsiaArtifacts: () => FuchsiaArtifacts(sshConfig: sshConfig, devFinder: devFinder), FuchsiaArtifacts: () => FuchsiaArtifacts(sshConfig: sshConfig, devFinder: devFinder),
Artifacts: () => OverrideArtifacts( Artifacts: () => OverrideArtifacts(
...@@ -171,3 +173,31 @@ class _FuchsiaAttachCommand extends AttachCommand { ...@@ -171,3 +173,31 @@ class _FuchsiaAttachCommand extends AttachCommand {
return super.runCommand(); return super.runCommand();
} }
} }
class _FuchsiaFeatureFlags extends FeatureFlags {
const _FuchsiaFeatureFlags();
@override
bool get isLinuxEnabled => false;
@override
bool get isMacOSEnabled => false;
@override
bool get isWebEnabled => false;
@override
bool get isWindowsEnabled => false;
@override
bool get isAndroidEnabled => false;
@override
bool get isIOSEnabled => false;
@override
bool get isFuchsiaEnabled => true;
@override
bool get isSingleWidgetReloadEnabled => false;
}
...@@ -9,6 +9,7 @@ import 'package:meta/meta.dart'; ...@@ -9,6 +9,7 @@ import 'package:meta/meta.dart';
import '../base/common.dart'; import '../base/common.dart';
import '../build_info.dart'; import '../build_info.dart';
import '../cache.dart'; import '../cache.dart';
import '../features.dart';
import '../fuchsia/fuchsia_build.dart'; import '../fuchsia/fuchsia_build.dart';
import '../fuchsia/fuchsia_pm.dart'; import '../fuchsia/fuchsia_pm.dart';
import '../globals.dart' as globals; import '../globals.dart' as globals;
...@@ -59,6 +60,12 @@ class BuildFuchsiaCommand extends BuildSubCommand { ...@@ -59,6 +60,12 @@ class BuildFuchsiaCommand extends BuildSubCommand {
@override @override
Future<FlutterCommandResult> runCommand() async { Future<FlutterCommandResult> runCommand() async {
if (!featureFlags.isFuchsiaEnabled) {
throwToolExit(
'"build fuchsia" is currently disabled. See "flutter config" for more '
'information.'
);
}
final BuildInfo buildInfo = getBuildInfo(); final BuildInfo buildInfo = getBuildInfo();
final FlutterProject flutterProject = FlutterProject.current(); final FlutterProject flutterProject = FlutterProject.current();
if (!globals.platform.isLinux && !globals.platform.isMacOS) { if (!globals.platform.isLinux && !globals.platform.isMacOS) {
......
...@@ -227,7 +227,7 @@ const Feature flutterFuchsiaFeature = Feature( ...@@ -227,7 +227,7 @@ const Feature flutterFuchsiaFeature = Feature(
environmentOverride: 'FLUTTER_FUCHSIA', environmentOverride: 'FLUTTER_FUCHSIA',
master: FeatureChannelSetting( master: FeatureChannelSetting(
available: true, available: true,
enabledByDefault: true, enabledByDefault: false,
), ),
); );
......
...@@ -9,6 +9,7 @@ import 'package:flutter_tools/src/base/platform.dart'; ...@@ -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/build_info.dart';
import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/commands/build.dart'; import 'package:flutter_tools/src/commands/build.dart';
import 'package:flutter_tools/src/features.dart';
import 'package:flutter_tools/src/fuchsia/fuchsia_kernel_compiler.dart'; import 'package:flutter_tools/src/fuchsia/fuchsia_kernel_compiler.dart';
import 'package:flutter_tools/src/fuchsia/fuchsia_pm.dart'; import 'package:flutter_tools/src/fuchsia/fuchsia_pm.dart';
import 'package:flutter_tools/src/fuchsia/fuchsia_sdk.dart'; import 'package:flutter_tools/src/fuchsia/fuchsia_sdk.dart';
...@@ -20,6 +21,7 @@ import 'package:process/process.dart'; ...@@ -20,6 +21,7 @@ import 'package:process/process.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../../src/context.dart'; import '../../src/context.dart';
import '../../src/mocks.dart'; import '../../src/mocks.dart';
import '../../src/testbed.dart';
// Defined globally for mocks to use. // Defined globally for mocks to use.
FileSystem fileSystem; FileSystem fileSystem;
...@@ -47,6 +49,23 @@ void main() { ...@@ -47,6 +49,23 @@ void main() {
}); });
group('Fuchsia build fails gracefully when', () { group('Fuchsia build fails gracefully when', () {
testUsingContext('The feature is disabled', () async {
final BuildCommand command = BuildCommand();
fileSystem.directory('fuchsia').createSync(recursive: true);
fileSystem.file('.packages').createSync();
fileSystem.file('pubspec.yaml').createSync();
fileSystem.file('lib/main.dart').createSync(recursive: true);
expect(
createTestCommandRunner(command).run(const <String>['build', 'fuchsia']),
throwsToolExit(message: '"build fuchsia" is currently disabled'),
);
}, overrides: <Type, Generator>{
Platform: () => linuxPlatform,
FileSystem: () => fileSystem,
ProcessManager: () => FakeProcessManager.any(),
FeatureFlags: () => TestFeatureFlags(isFuchsiaEnabled: false),
});
testUsingContext('there is no Fuchsia project', () async { testUsingContext('there is no Fuchsia project', () async {
final BuildCommand command = BuildCommand(); final BuildCommand command = BuildCommand();
...@@ -58,6 +77,7 @@ void main() { ...@@ -58,6 +77,7 @@ void main() {
Platform: () => linuxPlatform, Platform: () => linuxPlatform,
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
FeatureFlags: () => TestFeatureFlags(isFuchsiaEnabled: true),
}); });
testUsingContext('there is no cmx file', () async { testUsingContext('there is no cmx file', () async {
...@@ -74,6 +94,7 @@ void main() { ...@@ -74,6 +94,7 @@ void main() {
Platform: () => linuxPlatform, Platform: () => linuxPlatform,
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
FeatureFlags: () => TestFeatureFlags(isFuchsiaEnabled: true),
}); });
testUsingContext('on Windows platform', () async { testUsingContext('on Windows platform', () async {
...@@ -95,6 +116,7 @@ void main() { ...@@ -95,6 +116,7 @@ void main() {
Platform: () => windowsPlatform, Platform: () => windowsPlatform,
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
FeatureFlags: () => TestFeatureFlags(isFuchsiaEnabled: true),
}); });
testUsingContext('there is no Fuchsia kernel compiler', () async { testUsingContext('there is no Fuchsia kernel compiler', () async {
...@@ -117,6 +139,7 @@ void main() { ...@@ -117,6 +139,7 @@ void main() {
Platform: () => linuxPlatform, Platform: () => linuxPlatform,
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
FeatureFlags: () => TestFeatureFlags(isFuchsiaEnabled: true),
}); });
}); });
...@@ -145,6 +168,7 @@ void main() { ...@@ -145,6 +168,7 @@ void main() {
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
FuchsiaSdk: () => fuchsiaSdk, FuchsiaSdk: () => fuchsiaSdk,
FeatureFlags: () => TestFeatureFlags(isFuchsiaEnabled: true),
}); });
} }
......
...@@ -216,6 +216,7 @@ void main() { ...@@ -216,6 +216,7 @@ void main() {
isLinuxEnabled: true, isLinuxEnabled: true,
isMacOSEnabled: true, isMacOSEnabled: true,
isWindowsEnabled: true, isWindowsEnabled: true,
isFuchsiaEnabled: true,
), ),
platform: FakePlatform(environment: <String, String>{}), platform: FakePlatform(environment: <String, String>{}),
); );
...@@ -329,6 +330,7 @@ void main() { ...@@ -329,6 +330,7 @@ void main() {
isLinuxEnabled: true, isLinuxEnabled: true,
isMacOSEnabled: true, isMacOSEnabled: true,
isWindowsEnabled: true, isWindowsEnabled: true,
isFuchsiaEnabled: true,
), ),
platform: FakePlatform(environment: <String, String>{}), platform: FakePlatform(environment: <String, String>{}),
); );
......
...@@ -732,7 +732,7 @@ class TestFeatureFlags implements FeatureFlags { ...@@ -732,7 +732,7 @@ class TestFeatureFlags implements FeatureFlags {
this.isSingleWidgetReloadEnabled = false, this.isSingleWidgetReloadEnabled = false,
this.isAndroidEnabled = true, this.isAndroidEnabled = true,
this.isIOSEnabled = true, this.isIOSEnabled = true,
this.isFuchsiaEnabled = true, this.isFuchsiaEnabled = false,
}); });
@override @override
......
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