Unverified Commit 7c24ff2c authored by Sigurd Meldgaard's avatar Sigurd Meldgaard Committed by GitHub

Use `dart pub` instead of `pub` to invoke pub from tools (#88509)

Top level `pub` is being deprecated.
parent 6dc18ef7
......@@ -234,9 +234,7 @@ class _DefaultPub implements Pub {
final bool verbose = _logger.isVerbose;
final List<String> args = <String>[
if (verbose)
'--verbose'
else
'--verbosity=warning',
'--verbose',
...<String>[
command,
'--no-precompile',
......@@ -419,7 +417,7 @@ class _DefaultPub implements Pub {
'cache',
'dart-sdk',
'bin',
'pub',
'dart',
]);
if (!_processManager.canRun(sdkPath)) {
throwToolExit(
......@@ -428,7 +426,7 @@ class _DefaultPub implements Pub {
'permissions for the current user.'
);
}
return <String>[sdkPath, ...arguments];
return <String>[sdkPath, '--no-analytics', 'pub', ...arguments];
}
// Returns the environment value that should be used when running pub.
......
......@@ -1729,7 +1729,7 @@ void main() {
final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--pub', '--offline', projectDir.path]);
expect(loggingProcessManager.commands.first, contains(matches(r'dart-sdk[\\/]bin[\\/]pub')));
expect(loggingProcessManager.commands.first, contains(matches(r'dart-sdk[\\/]bin[\\/]dart')));
expect(loggingProcessManager.commands.first, contains('--offline'));
},
overrides: <Type, Generator>{
......@@ -1754,7 +1754,7 @@ void main() {
final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--pub', projectDir.path]);
expect(loggingProcessManager.commands.first, contains(matches(r'dart-sdk[\\/]bin[\\/]pub')));
expect(loggingProcessManager.commands.first, contains(matches(r'dart-sdk[\\/]bin[\\/]dart')));
expect(loggingProcessManager.commands.first, isNot(contains('--offline')));
},
overrides: <Type, Generator>{
......
......@@ -451,7 +451,7 @@ void main() {
Cache.flutterRoot = '';
globals.fs.file('pubspec.yaml').createSync();
processManager.addCommand(
const FakeCommand(command: <String>['/bin/cache/dart-sdk/bin/pub', 'run', 'test']),
const FakeCommand(command: <String>['/bin/cache/dart-sdk/bin/dart', '--no-analytics', 'pub', 'run', 'test']),
);
await createTestCommandRunner(PackagesCommand()).run(<String>['packages', 'test']);
......@@ -476,7 +476,7 @@ void main() {
Cache.flutterRoot = '';
globals.fs.file('pubspec.yaml').createSync();
processManager.addCommand(
const FakeCommand(command: <String>['/bin/cache/dart-sdk/bin/pub', '--trace', 'run', 'test']),
const FakeCommand(command: <String>['/bin/cache/dart-sdk/bin/dart', '--no-analytics', 'pub', '--trace', 'run', 'test']),
);
await createTestCommandRunner(PackagesCommand()).run(<String>['packages', 'test']);
......@@ -503,7 +503,7 @@ void main() {
final IOSink stdin = IOSink(StreamController<List<int>>().sink);
processManager.addCommand(
FakeCommand(command: const <String>[
'/bin/cache/dart-sdk/bin/pub', 'run', '--foo', 'bar'],
'/bin/cache/dart-sdk/bin/dart', '--no-analytics', 'pub', 'run', '--foo', 'bar'],
stdin: stdin,
),
);
......@@ -529,7 +529,7 @@ void main() {
Cache.flutterRoot = '';
processManager.addCommand(
FakeCommand(command: const <String>[
'/bin/cache/dart-sdk/bin/pub', 'upgrade', '-h'],
'/bin/cache/dart-sdk/bin/dart', '--no-analytics', 'pub', 'upgrade', '-h'],
stdin: IOSink(StreamController<List<int>>().sink),
),
);
......
......@@ -26,7 +26,7 @@ void main() {
final FakeProcessManager processManager = FakeProcessManager.empty();
final BufferLogger logger = BufferLogger.test();
final MemoryFileSystem fileSystem = MemoryFileSystem.test();
processManager.excludedExecutables.add('bin/cache/dart-sdk/bin/pub');
processManager.excludedExecutables.add('bin/cache/dart-sdk/bin/dart');
fileSystem.file('pubspec.yaml').createSync();
......@@ -51,8 +51,9 @@ void main() {
testWithoutContext('does not skip pub get the parameter is false', () async {
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(command: <String>[
'bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'bin/cache/dart-sdk/bin/dart',
'--no-analytics',
'pub',
'get',
'--no-precompile',
])
......@@ -99,8 +100,9 @@ void main() {
testWithoutContext('does not skip pub get if package_config.json has "generator": "pub"', () async {
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(command: <String>[
'bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'bin/cache/dart-sdk/bin/dart',
'--no-analytics',
'pub',
'get',
'--no-precompile',
])
......@@ -147,8 +149,9 @@ void main() {
testWithoutContext('does not skip pub get if package_config.json has "generator": "pub"', () async {
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(command: <String>[
'bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'bin/cache/dart-sdk/bin/dart',
'--no-analytics',
'pub',
'get',
'--no-precompile',
])
......@@ -262,8 +265,9 @@ void main() {
'but the current framework version is not the same as the last version', () async {
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(command: <String>[
'bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'bin/cache/dart-sdk/bin/dart',
'--no-analytics',
'pub',
'get',
'--no-precompile',
])
......@@ -301,8 +305,9 @@ void main() {
'but the current framework version does not exist yet', () async {
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(command: <String>[
'bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'bin/cache/dart-sdk/bin/dart',
'--no-analytics',
'pub',
'get',
'--no-precompile',
])
......@@ -339,8 +344,9 @@ void main() {
final MemoryFileSystem fileSystem = MemoryFileSystem.test();
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
FakeCommand(command: const <String>[
'bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'bin/cache/dart-sdk/bin/dart',
'--no-analytics',
'pub',
'get',
'--no-precompile',
], onRun: () {
......@@ -377,8 +383,9 @@ void main() {
final MemoryFileSystem fileSystem = MemoryFileSystem.test();
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(command: <String>[
'bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'bin/cache/dart-sdk/bin/dart',
'--no-analytics',
'pub',
'get',
'--no-precompile',
]),
......@@ -413,8 +420,9 @@ void main() {
testWithoutContext('checkUpToDate does not skip pub get if the package config is older that the pubspec', () async {
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(command: <String>[
'bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'bin/cache/dart-sdk/bin/dart',
'--no-analytics',
'pub',
'get',
'--no-precompile',
])
......@@ -452,8 +460,9 @@ void main() {
testWithoutContext('checkUpToDate does not skip pub get if the pubspec.lock is older that the pubspec', () async {
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(command: <String>[
'bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'bin/cache/dart-sdk/bin/dart',
'--no-analytics',
'pub',
'get',
'--no-precompile',
])
......@@ -495,8 +504,9 @@ void main() {
const FakeCommand pubGetCommand = FakeCommand(
command: <String>[
'bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'bin/cache/dart-sdk/bin/dart',
'--no-analytics',
'pub',
'get',
'--no-precompile',
],
......@@ -591,8 +601,9 @@ void main() {
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(
command: <String>[
'bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'bin/cache/dart-sdk/bin/dart',
'--no-analytics',
'pub',
'get',
'--no-precompile',
],
......@@ -636,8 +647,9 @@ void main() {
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
FakeCommand(
command: const <String>[
'bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'bin/cache/dart-sdk/bin/dart',
'--no-analytics',
'pub',
'get',
'--no-precompile',
],
......@@ -677,8 +689,9 @@ void main() {
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(
command: <String>[
'bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'bin/cache/dart-sdk/bin/dart',
'--no-analytics',
'pub',
'get',
'--no-precompile',
],
......@@ -799,8 +812,9 @@ void main() {
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(
command: <String>[
'bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'bin/cache/dart-sdk/bin/dart',
'--no-analytics',
'pub',
'get',
'--no-precompile',
],
......@@ -840,8 +854,9 @@ void main() {
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(
command: <String>[
'bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'bin/cache/dart-sdk/bin/dart',
'--no-analytics',
'pub',
'get',
'--no-precompile',
],
......@@ -882,8 +897,9 @@ void main() {
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
FakeCommand(
command: const <String>[
'bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'bin/cache/dart-sdk/bin/dart',
'--no-analytics',
'pub',
'get',
'--no-precompile',
],
......@@ -894,16 +910,18 @@ void main() {
),
const FakeCommand(
command: <String>[
'bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'bin/cache/dart-sdk/bin/dart',
'--no-analytics',
'pub',
'get',
'--no-precompile',
],
),
FakeCommand(
command: const <String>[
'bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'bin/cache/dart-sdk/bin/dart',
'--no-analytics',
'pub',
'get',
'--no-precompile',
],
......@@ -914,8 +932,9 @@ void main() {
),
const FakeCommand(
command: <String>[
'bin/cache/dart-sdk/bin/pub',
'--verbosity=warning',
'bin/cache/dart-sdk/bin/dart',
'--no-analytics',
'pub',
'get',
'--no-precompile',
],
......
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