[flutter_tools] hide all development tools (#57690)

This commit is contained in:
Jonah Williams 2020-05-27 10:10:19 -07:00 committed by GitHub
parent 43f18f36ef
commit ffc56ff735
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 10 deletions

View file

@ -89,8 +89,6 @@ Future<void> main(List<String> args) async {
EmulatorsCommand(), EmulatorsCommand(),
FormatCommand(), FormatCommand(),
GenerateCommand(), GenerateCommand(),
IdeConfigCommand(hidden: !verboseHelp),
InjectPluginsCommand(hidden: !verboseHelp),
InstallCommand(), InstallCommand(),
LogsCommand(), LogsCommand(),
MakeHostAppEditableCommand(), MakeHostAppEditableCommand(),
@ -100,14 +98,17 @@ Future<void> main(List<String> args) async {
ScreenshotCommand(), ScreenshotCommand(),
ShellCompletionCommand(), ShellCompletionCommand(),
TestCommand(verboseHelp: verboseHelp), TestCommand(verboseHelp: verboseHelp),
TrainingCommand(),
UpdatePackagesCommand(hidden: !verboseHelp),
UpgradeCommand(), UpgradeCommand(),
VersionCommand(), VersionCommand(),
SymbolizeCommand( SymbolizeCommand(
stdio: globals.stdio, stdio: globals.stdio,
fileSystem: globals.fs, fileSystem: globals.fs,
), ),
// Development-only commands. These are always hidden,
IdeConfigCommand(),
InjectPluginsCommand(),
TrainingCommand(),
UpdatePackagesCommand(),
], verbose: verbose, ], verbose: verbose,
muteCommandLogging: muteCommandLogging, muteCommandLogging: muteCommandLogging,
verboseHelp: verboseHelp, verboseHelp: verboseHelp,

View file

@ -12,7 +12,7 @@ import '../runner/flutter_command.dart';
import '../template.dart'; import '../template.dart';
class IdeConfigCommand extends FlutterCommand { class IdeConfigCommand extends FlutterCommand {
IdeConfigCommand({this.hidden = false}) { IdeConfigCommand() {
argParser.addFlag( argParser.addFlag(
'overwrite', 'overwrite',
negatable: true, negatable: true,
@ -57,7 +57,7 @@ class IdeConfigCommand extends FlutterCommand {
'Currently, IntelliJ is the default (and only) IDE that may be configured.'; 'Currently, IntelliJ is the default (and only) IDE that may be configured.';
@override @override
final bool hidden; final bool hidden = true;
@override @override
String get invocation => '${runner.executableName} $name'; String get invocation => '${runner.executableName} $name';

View file

@ -10,7 +10,7 @@ import '../project.dart';
import '../runner/flutter_command.dart'; import '../runner/flutter_command.dart';
class InjectPluginsCommand extends FlutterCommand { class InjectPluginsCommand extends FlutterCommand {
InjectPluginsCommand({ this.hidden = false }) { InjectPluginsCommand() {
requiresPubspecYaml(); requiresPubspecYaml();
} }
@ -21,7 +21,7 @@ class InjectPluginsCommand extends FlutterCommand {
final String description = 'Re-generates the GeneratedPluginRegistrants.'; final String description = 'Re-generates the GeneratedPluginRegistrants.';
@override @override
final bool hidden; final bool hidden = true;
@override @override
Future<Set<DevelopmentArtifact>> get requiredArtifacts async => const <DevelopmentArtifact>{}; Future<Set<DevelopmentArtifact>> get requiredArtifacts async => const <DevelopmentArtifact>{};

View file

@ -33,7 +33,7 @@ const Map<String, String> _kManuallyPinnedDependencies = <String, String>{
}; };
class UpdatePackagesCommand extends FlutterCommand { class UpdatePackagesCommand extends FlutterCommand {
UpdatePackagesCommand({ this.hidden = false }) { UpdatePackagesCommand() {
argParser argParser
..addFlag( ..addFlag(
'force-upgrade', 'force-upgrade',
@ -98,7 +98,7 @@ class UpdatePackagesCommand extends FlutterCommand {
final List<String> aliases = <String>['upgrade-packages']; final List<String> aliases = <String>['upgrade-packages'];
@override @override
final bool hidden; final bool hidden = true;
// Lazy-initialize the net utilities with values from the context. // Lazy-initialize the net utilities with values from the context.

View file

@ -0,0 +1,24 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/globals.dart' as globals;
import 'package:process/process.dart';
import '../src/common.dart';
void main() {
test('All development tools are hidden', () async {
final String flutterBin = globals.fs.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await const LocalProcessManager().run(<String>[
flutterBin,
'-h',
'-v',
]);
expect(result.stdout, isNot(contains('ide-config')));
expect(result.stdout, isNot(contains('update-packages')));
expect(result.stdout, isNot(contains('inject-plugins')));
});
}