Unverified Commit 7ae3caf3 authored by Michael Thomsen's avatar Michael Thomsen Committed by GitHub

Rename `flutter packages` to `flutter pub` (#33041)

parent d5aae54a
...@@ -565,7 +565,7 @@ linter: ...@@ -565,7 +565,7 @@ linter:
if (stdout.isNotEmpty && stdout.first == 'Building flutter tool...') { if (stdout.isNotEmpty && stdout.first == 'Building flutter tool...') {
stdout.removeAt(0); stdout.removeAt(0);
} }
if (stdout.isNotEmpty && stdout.first.startsWith('Running "flutter packages get" in ')) { if (stdout.isNotEmpty && stdout.first.startsWith('Running "flutter pub get" in ')) {
stdout.removeAt(0); stdout.removeAt(0);
} }
_exitCode = result.exitCode; _exitCode = result.exitCode;
......
...@@ -108,7 +108,7 @@ fi ...@@ -108,7 +108,7 @@ fi
# This script generates a unified doc set, and creates # This script generates a unified doc set, and creates
# a custom index.html, placing everything into dev/docs/doc. # a custom index.html, placing everything into dev/docs/doc.
(cd "$FLUTTER_ROOT/dev/tools" && "$FLUTTER" packages get) (cd "$FLUTTER_ROOT/dev/tools" && "$FLUTTER" pub get)
(cd "$FLUTTER_ROOT/dev/tools" && "$PUB" get) (cd "$FLUTTER_ROOT/dev/tools" && "$PUB" get)
(cd "$FLUTTER_ROOT" && "$DART" "$FLUTTER_ROOT/dev/tools/dartdoc.dart") (cd "$FLUTTER_ROOT" && "$DART" "$FLUTTER_ROOT/dev/tools/dartdoc.dart")
(cd "$FLUTTER_ROOT" && "$DART" "$FLUTTER_ROOT/dev/tools/java_and_objc_doc.dart") (cd "$FLUTTER_ROOT" && "$DART" "$FLUTTER_ROOT/dev/tools/java_and_objc_doc.dart")
......
...@@ -59,7 +59,7 @@ Future<int> runTest({bool coverage = false}) async { ...@@ -59,7 +59,7 @@ Future<int> runTest({bool coverage = false}) async {
step = TestStep.buildingFlutterTool; step = TestStep.buildingFlutterTool;
} else if (step == TestStep.testPassed && entry.contains('Collecting coverage information...')) { } else if (step == TestStep.testPassed && entry.contains('Collecting coverage information...')) {
// ignore this line // ignore this line
} else if (step.index < TestStep.runningPubGet.index && entry == 'Running "flutter packages get" in automated_tests...') { } else if (step.index < TestStep.runningPubGet.index && entry == 'Running "flutter pub get" in automated_tests...') {
// ignore this line // ignore this line
step = TestStep.runningPubGet; step = TestStep.runningPubGet;
} else if (step.index < TestStep.testWritesFirstCarriageReturn.index && entry == '') { } else if (step.index < TestStep.testWritesFirstCarriageReturn.index && entry == '') {
......
...@@ -54,7 +54,7 @@ void main() { ...@@ -54,7 +54,7 @@ void main() {
throw 'flutter run --release had output on standard error.'; throw 'flutter run --release had output on standard error.';
if (stdout.first.startsWith('Building flutter tool...')) if (stdout.first.startsWith('Building flutter tool...'))
stdout.removeAt(0); stdout.removeAt(0);
if (stdout.first.startsWith('Running "flutter packages get" in ui...')) if (stdout.first.startsWith('Running "flutter pub get" in ui...'))
stdout.removeAt(0); stdout.removeAt(0);
if (stdout.first.startsWith('Initializing gradle...')) if (stdout.first.startsWith('Initializing gradle...'))
stdout.removeAt(0); stdout.removeAt(0);
......
...@@ -41,7 +41,7 @@ target 'Runner' do ...@@ -41,7 +41,7 @@ target 'Runner' do
# Flutter Pods # Flutter Pods
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
if generated_xcode_build_settings.empty? if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
end end
generated_xcode_build_settings.map { |p| generated_xcode_build_settings.map { |p|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR' if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
......
...@@ -16,7 +16,7 @@ the [Flutter Setup](https://flutter.dev/setup/) guide. ...@@ -16,7 +16,7 @@ the [Flutter Setup](https://flutter.dev/setup/) guide.
### Building and installing the Flutter app ### Building and installing the Flutter app
* `cd $FLUTTER_ROOT/examples/flutter_gallery` * `cd $FLUTTER_ROOT/examples/flutter_gallery`
* `flutter packages get` * `flutter pub get`
* `flutter run --release` * `flutter run --release`
The `flutter run --release` command both builds and installs the Flutter app. The `flutter run --release` command both builds and installs the Flutter app.
......
...@@ -35,7 +35,7 @@ target 'Runner' do ...@@ -35,7 +35,7 @@ target 'Runner' do
# Flutter Pods # Flutter Pods
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
if generated_xcode_build_settings.empty? if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
end end
generated_xcode_build_settings.map { |p| generated_xcode_build_settings.map { |p|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR' if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
......
...@@ -15,7 +15,7 @@ the [Flutter Setup](https://flutter.dev/setup/) guide. ...@@ -15,7 +15,7 @@ the [Flutter Setup](https://flutter.dev/setup/) guide.
### Building and installing the stocks demo app ### Building and installing the stocks demo app
* `cd $FLUTTER_ROOT/examples/stocks` * `cd $FLUTTER_ROOT/examples/stocks`
* `flutter packages get` * `flutter pub get`
* `flutter run --release` * `flutter run --release`
The `flutter run --release` command both builds and installs the Flutter app. The `flutter run --release` command both builds and installs the Flutter app.
......
...@@ -56,11 +56,11 @@ class CreateCommand extends FlutterCommand { ...@@ -56,11 +56,11 @@ class CreateCommand extends FlutterCommand {
CreateCommand() { CreateCommand() {
argParser.addFlag('pub', argParser.addFlag('pub',
defaultsTo: true, defaultsTo: true,
help: 'Whether to run "flutter packages get" after the project has been created.', help: 'Whether to run "flutter pub get" after the project has been created.',
); );
argParser.addFlag('offline', argParser.addFlag('offline',
defaultsTo: false, defaultsTo: false,
help: 'When "flutter packages get" is run by the create command, this indicates ' help: 'When "flutter pub get" is run by the create command, this indicates '
'whether to run it in offline mode or not. In offline mode, it will need to ' 'whether to run it in offline mode or not. In offline mode, it will need to '
'have all dependencies already available in the pub cache to succeed.', 'have all dependencies already available in the pub cache to succeed.',
); );
......
...@@ -27,10 +27,10 @@ class PackagesCommand extends FlutterCommand { ...@@ -27,10 +27,10 @@ class PackagesCommand extends FlutterCommand {
} }
@override @override
final String name = 'packages'; final String name = 'pub';
@override @override
List<String> get aliases => const <String>['pub']; List<String> get aliases => const <String>['packages'];
@override @override
final String description = 'Commands for managing Flutter packages.'; final String description = 'Commands for managing Flutter packages.';
...@@ -65,7 +65,7 @@ class PackagesGetCommand extends FlutterCommand { ...@@ -65,7 +65,7 @@ class PackagesGetCommand extends FlutterCommand {
@override @override
String get invocation { String get invocation {
return '${runner.executableName} packages $name [<target directory>]'; return '${runner.executableName} pub $name [<target directory>]';
} }
Future<void> _runPubGet (String directory) async { Future<void> _runPubGet (String directory) async {
...@@ -127,7 +127,7 @@ class PackagesTestCommand extends FlutterCommand { ...@@ -127,7 +127,7 @@ class PackagesTestCommand extends FlutterCommand {
@override @override
String get invocation { String get invocation {
return '${runner.executableName} packages test [<tests...>]'; return '${runner.executableName} pub test [<tests...>]';
} }
@override @override
...@@ -157,7 +157,7 @@ class PackagesForwardCommand extends FlutterCommand { ...@@ -157,7 +157,7 @@ class PackagesForwardCommand extends FlutterCommand {
@override @override
String get invocation { String get invocation {
return '${runner.executableName} packages $_commandName [<arguments...>]'; return '${runner.executableName} pub $_commandName [<arguments...>]';
} }
@override @override
......
...@@ -64,7 +64,7 @@ class PackageMap { ...@@ -64,7 +64,7 @@ class PackageMap {
String message = '$packagesPath does not exist.'; String message = '$packagesPath does not exist.';
final String pubspecPath = fs.path.absolute(fs.path.dirname(packagesPath), 'pubspec.yaml'); final String pubspecPath = fs.path.absolute(fs.path.dirname(packagesPath), 'pubspec.yaml');
if (fs.isFileSync(pubspecPath)) if (fs.isFileSync(pubspecPath))
message += '\nDid you run "flutter packages get" in this directory?'; message += '\nDid you run "flutter pub get" in this directory?';
else else
message += '\nDid you run this command from the same directory as your pubspec.yaml file?'; message += '\nDid you run this command from the same directory as your pubspec.yaml file?';
return message; return message;
......
...@@ -93,7 +93,7 @@ Future<void> pubGet({ ...@@ -93,7 +93,7 @@ Future<void> pubGet({
if (!checkLastModified || _shouldRunPubGet(pubSpecYaml: pubSpecYaml, dotPackages: dotPackages)) { if (!checkLastModified || _shouldRunPubGet(pubSpecYaml: pubSpecYaml, dotPackages: dotPackages)) {
final String command = upgrade ? 'upgrade' : 'get'; final String command = upgrade ? 'upgrade' : 'get';
final Status status = logger.startProgress( final Status status = logger.startProgress(
'Running "flutter packages $command" in ${fs.path.basename(directory)}...', 'Running "flutter pub $command" in ${fs.path.basename(directory)}...',
timeout: timeoutConfiguration.slowOperation, timeout: timeoutConfiguration.slowOperation,
); );
final List<String> args = <String>['--verbosity=warning']; final List<String> args = <String>['--verbosity=warning'];
......
...@@ -139,7 +139,7 @@ abstract class FlutterCommand extends Command<void> { ...@@ -139,7 +139,7 @@ abstract class FlutterCommand extends Command<void> {
void usesPubOption() { void usesPubOption() {
argParser.addFlag('pub', argParser.addFlag('pub',
defaultsTo: true, defaultsTo: true,
help: 'Whether to run "flutter packages get" before executing this command.'); help: 'Whether to run "flutter pub get" before executing this command.');
_usesPubOption = true; _usesPubOption = true;
} }
...@@ -594,7 +594,7 @@ abstract class FlutterCommand extends Command<void> { ...@@ -594,7 +594,7 @@ abstract class FlutterCommand extends Command<void> {
} }
// Validate the current package map only if we will not be running "pub get" later. // Validate the current package map only if we will not be running "pub get" later.
if (parent?.name != 'packages' && !(_usesPubOption && argResults['pub'])) { if (parent?.name != 'pub' && !(_usesPubOption && argResults['pub'])) {
final String error = PackageMap(PackageMap.globalPackagesPath).checkValid(); final String error = PackageMap(PackageMap.globalPackagesPath).checkValid();
if (error != null) if (error != null)
throw ToolExit(error); throw ToolExit(error);
......
...@@ -41,7 +41,7 @@ target 'Runner' do ...@@ -41,7 +41,7 @@ target 'Runner' do
# Flutter Pods # Flutter Pods
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
if generated_xcode_build_settings.empty? if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
end end
generated_xcode_build_settings.map { |p| generated_xcode_build_settings.map { |p|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR' if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
......
...@@ -43,7 +43,7 @@ target 'Runner' do ...@@ -43,7 +43,7 @@ target 'Runner' do
# Flutter Pods # Flutter Pods
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
if generated_xcode_build_settings.empty? if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
end end
generated_xcode_build_settings.map { |p| generated_xcode_build_settings.map { |p|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR' if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
......
...@@ -23,7 +23,7 @@ end ...@@ -23,7 +23,7 @@ end
def flutter_root(f) def flutter_root(f)
generated_xcode_build_settings = parse_KV_file(File.join(f, File.join('.ios', 'Flutter', 'Generated.xcconfig'))) generated_xcode_build_settings = parse_KV_file(File.join(f, File.join('.ios', 'Flutter', 'Generated.xcconfig')))
if generated_xcode_build_settings.empty? if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. Make sure `flutter packages get` is executed in #{f}." puts "Generated.xcconfig must exist. Make sure `flutter pub get` is executed in #{f}."
exit exit
end end
generated_xcode_build_settings.map { |p| generated_xcode_build_settings.map { |p|
......
...@@ -106,7 +106,7 @@ Future<void> _testFile(String testName, String workingDirectory, String testDire ...@@ -106,7 +106,7 @@ Future<void> _testFile(String testName, String workingDirectory, String testDire
final List<String> output = exec.stdout.split('\n'); final List<String> output = exec.stdout.split('\n');
if (output.first == 'Waiting for another flutter command to release the startup lock...') if (output.first == 'Waiting for another flutter command to release the startup lock...')
output.removeAt(0); output.removeAt(0);
if (output.first.startsWith('Running "flutter packages get" in')) if (output.first.startsWith('Running "flutter pub get" in'))
output.removeAt(0); output.removeAt(0);
output.add('<<stderr>>'); output.add('<<stderr>>');
output.addAll(exec.stderr.split('\n')); output.addAll(exec.stderr.split('\n'));
......
...@@ -39,26 +39,26 @@ void main() { ...@@ -39,26 +39,26 @@ void main() {
}); });
time.elapse(const Duration(milliseconds: 500)); time.elapse(const Duration(milliseconds: 500));
expect(testLogger.statusText, expect(testLogger.statusText,
'Running "flutter packages get" in /...\n' 'Running "flutter pub get" in /...\n'
'pub get failed (69) -- attempting retry 1 in 1 second...\n', 'pub get failed (69) -- attempting retry 1 in 1 second...\n',
); );
expect(processMock.lastPubEnvironment, contains('flutter_cli:flutter_tests')); expect(processMock.lastPubEnvironment, contains('flutter_cli:flutter_tests'));
expect(processMock.lastPubCache, isNull); expect(processMock.lastPubCache, isNull);
time.elapse(const Duration(milliseconds: 500)); time.elapse(const Duration(milliseconds: 500));
expect(testLogger.statusText, expect(testLogger.statusText,
'Running "flutter packages get" in /...\n' 'Running "flutter pub get" in /...\n'
'pub get failed (69) -- attempting retry 1 in 1 second...\n' 'pub get failed (69) -- attempting retry 1 in 1 second...\n'
'pub get failed (69) -- attempting retry 2 in 2 seconds...\n', 'pub get failed (69) -- attempting retry 2 in 2 seconds...\n',
); );
time.elapse(const Duration(seconds: 1)); time.elapse(const Duration(seconds: 1));
expect(testLogger.statusText, expect(testLogger.statusText,
'Running "flutter packages get" in /...\n' 'Running "flutter pub get" in /...\n'
'pub get failed (69) -- attempting retry 1 in 1 second...\n' 'pub get failed (69) -- attempting retry 1 in 1 second...\n'
'pub get failed (69) -- attempting retry 2 in 2 seconds...\n', 'pub get failed (69) -- attempting retry 2 in 2 seconds...\n',
); );
time.elapse(const Duration(seconds: 100)); // from t=0 to t=100 time.elapse(const Duration(seconds: 100)); // from t=0 to t=100
expect(testLogger.statusText, expect(testLogger.statusText,
'Running "flutter packages get" in /...\n' 'Running "flutter pub get" in /...\n'
'pub get failed (69) -- attempting retry 1 in 1 second...\n' 'pub get failed (69) -- attempting retry 1 in 1 second...\n'
'pub get failed (69) -- attempting retry 2 in 2 seconds...\n' 'pub get failed (69) -- attempting retry 2 in 2 seconds...\n'
'pub get failed (69) -- attempting retry 3 in 4 seconds...\n' // at t=1 'pub get failed (69) -- attempting retry 3 in 4 seconds...\n' // at t=1
...@@ -69,7 +69,7 @@ void main() { ...@@ -69,7 +69,7 @@ void main() {
); );
time.elapse(const Duration(seconds: 200)); // from t=0 to t=200 time.elapse(const Duration(seconds: 200)); // from t=0 to t=200
expect(testLogger.statusText, expect(testLogger.statusText,
'Running "flutter packages get" in /...\n' 'Running "flutter pub get" in /...\n'
'pub get failed (69) -- attempting retry 1 in 1 second...\n' 'pub get failed (69) -- attempting retry 1 in 1 second...\n'
'pub get failed (69) -- attempting retry 2 in 2 seconds...\n' 'pub get failed (69) -- attempting retry 2 in 2 seconds...\n'
'pub get failed (69) -- attempting retry 3 in 4 seconds...\n' 'pub get failed (69) -- attempting retry 3 in 4 seconds...\n'
......
...@@ -43,7 +43,7 @@ dependencies: ...@@ -43,7 +43,7 @@ dependencies:
Future<void> getPackages(String folder) async { Future<void> getPackages(String folder) async {
final List<String> command = <String>[ final List<String> command = <String>[
fs.path.join(getFlutterRoot(), 'bin', 'flutter'), fs.path.join(getFlutterRoot(), 'bin', 'flutter'),
'packages', 'pub',
'get', 'get',
]; ];
final Process process = await processManager.start(command, workingDirectory: folder); final Process process = await processManager.start(command, workingDirectory: folder);
...@@ -52,5 +52,5 @@ Future<void> getPackages(String folder) async { ...@@ -52,5 +52,5 @@ Future<void> getPackages(String folder) async {
final int exitCode = await process.exitCode; final int exitCode = await process.exitCode;
if (exitCode != 0) if (exitCode != 0)
throw Exception( throw Exception(
'flutter packages get failed: ${errorOutput.toString()}'); 'flutter pub get failed: ${errorOutput.toString()}');
} }
...@@ -360,7 +360,7 @@ Error launching application on iPhone.''', ...@@ -360,7 +360,7 @@ Error launching application on iPhone.''',
final XcodeBuildResult buildResult = XcodeBuildResult( final XcodeBuildResult buildResult = XcodeBuildResult(
success: false, success: false,
stdout: ''' stdout: '''
Running "flutter packages get" in flutter_gallery... 0.6s Running "flutter pub get" in flutter_gallery... 0.6s
Launching lib/main.dart on x in release mode... Launching lib/main.dart on x in release mode...
Running pod install... 1.2s Running pod install... 1.2s
Running Xcode build... 1.4s Running Xcode build... 1.4s
......
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