Skip to content

Commit ffc56ff

Browse files
[flutter_tools] hide all development tools (flutter#57690)
1 parent 43f18f3 commit ffc56ff

File tree

5 files changed

+35
-10
lines changed

5 files changed

+35
-10
lines changed

packages/flutter_tools/lib/executable.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ Future<void> main(List<String> args) async {
8989
EmulatorsCommand(),
9090
FormatCommand(),
9191
GenerateCommand(),
92-
IdeConfigCommand(hidden: !verboseHelp),
93-
InjectPluginsCommand(hidden: !verboseHelp),
9492
InstallCommand(),
9593
LogsCommand(),
9694
MakeHostAppEditableCommand(),
@@ -100,14 +98,17 @@ Future<void> main(List<String> args) async {
10098
ScreenshotCommand(),
10199
ShellCompletionCommand(),
102100
TestCommand(verboseHelp: verboseHelp),
103-
TrainingCommand(),
104-
UpdatePackagesCommand(hidden: !verboseHelp),
105101
UpgradeCommand(),
106102
VersionCommand(),
107103
SymbolizeCommand(
108104
stdio: globals.stdio,
109105
fileSystem: globals.fs,
110106
),
107+
// Development-only commands. These are always hidden,
108+
IdeConfigCommand(),
109+
InjectPluginsCommand(),
110+
TrainingCommand(),
111+
UpdatePackagesCommand(),
111112
], verbose: verbose,
112113
muteCommandLogging: muteCommandLogging,
113114
verboseHelp: verboseHelp,

packages/flutter_tools/lib/src/commands/ide_config.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import '../runner/flutter_command.dart';
1212
import '../template.dart';
1313

1414
class IdeConfigCommand extends FlutterCommand {
15-
IdeConfigCommand({this.hidden = false}) {
15+
IdeConfigCommand() {
1616
argParser.addFlag(
1717
'overwrite',
1818
negatable: true,
@@ -57,7 +57,7 @@ class IdeConfigCommand extends FlutterCommand {
5757
'Currently, IntelliJ is the default (and only) IDE that may be configured.';
5858

5959
@override
60-
final bool hidden;
60+
final bool hidden = true;
6161

6262
@override
6363
String get invocation => '${runner.executableName} $name';

packages/flutter_tools/lib/src/commands/inject_plugins.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import '../project.dart';
1010
import '../runner/flutter_command.dart';
1111

1212
class InjectPluginsCommand extends FlutterCommand {
13-
InjectPluginsCommand({ this.hidden = false }) {
13+
InjectPluginsCommand() {
1414
requiresPubspecYaml();
1515
}
1616

@@ -21,7 +21,7 @@ class InjectPluginsCommand extends FlutterCommand {
2121
final String description = 'Re-generates the GeneratedPluginRegistrants.';
2222

2323
@override
24-
final bool hidden;
24+
final bool hidden = true;
2525

2626
@override
2727
Future<Set<DevelopmentArtifact>> get requiredArtifacts async => const <DevelopmentArtifact>{};

packages/flutter_tools/lib/src/commands/update_packages.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const Map<String, String> _kManuallyPinnedDependencies = <String, String>{
3333
};
3434

3535
class UpdatePackagesCommand extends FlutterCommand {
36-
UpdatePackagesCommand({ this.hidden = false }) {
36+
UpdatePackagesCommand() {
3737
argParser
3838
..addFlag(
3939
'force-upgrade',
@@ -98,7 +98,7 @@ class UpdatePackagesCommand extends FlutterCommand {
9898
final List<String> aliases = <String>['upgrade-packages'];
9999

100100
@override
101-
final bool hidden;
101+
final bool hidden = true;
102102

103103

104104
// Lazy-initialize the net utilities with values from the context.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'package:flutter_tools/src/base/io.dart';
6+
import 'package:flutter_tools/src/globals.dart' as globals;
7+
import 'package:process/process.dart';
8+
9+
import '../src/common.dart';
10+
11+
void main() {
12+
test('All development tools are hidden', () async {
13+
final String flutterBin = globals.fs.path.join(getFlutterRoot(), 'bin', 'flutter');
14+
final ProcessResult result = await const LocalProcessManager().run(<String>[
15+
flutterBin,
16+
'-h',
17+
'-v',
18+
]);
19+
20+
expect(result.stdout, isNot(contains('ide-config')));
21+
expect(result.stdout, isNot(contains('update-packages')));
22+
expect(result.stdout, isNot(contains('inject-plugins')));
23+
});
24+
}

0 commit comments

Comments
 (0)