mirror of
https://github.com/flutter/packages.git
synced 2025-05-28 19:26:50 +08:00
[tool] Use 'flutter pub get' for Flutter packages (#4397)
Extracts common logic for running `pub get`, and switches commands to use it. The common logic always uses `flutter pub get` for Flutter packages, rather than `dart pub get`, since the latter will fail if someone has a non-Flutter `dart` in their path before `flutter` (e.g., Dart team members contributing PRs).
This commit is contained in:
@ -88,7 +88,7 @@ void main() {
|
||||
final Iterable<ProcessCall> pubGetCalls =
|
||||
plugin1.getExamples().map((RepositoryPackage example) {
|
||||
return ProcessCall(
|
||||
'dart',
|
||||
getFlutterCommand(mockPlatform),
|
||||
const <String>['pub', 'get'],
|
||||
example.path,
|
||||
);
|
||||
@ -117,6 +117,7 @@ void main() {
|
||||
createFakePlugin('plugin_tools_test_package_a', packagesDir);
|
||||
|
||||
processRunner.mockProcessesForExecutable['flutter'] = <FakeProcessInfo>[
|
||||
FakeProcessInfo(MockProcess(), <String>['pub', 'get']),
|
||||
FakeProcessInfo(MockProcess(exitCode: 1, stdout: 'Some error from pub'),
|
||||
<String>['pub', 'publish'])
|
||||
];
|
||||
@ -205,7 +206,8 @@ void main() {
|
||||
'Packages with an SDK constraint on a pre-release of the Dart '
|
||||
'SDK should themselves be published as a pre-release version.');
|
||||
processRunner.mockProcessesForExecutable['flutter'] = <FakeProcessInfo>[
|
||||
FakeProcessInfo(process, <String>['pub', 'publish'])
|
||||
FakeProcessInfo(MockProcess(), <String>['pub', 'get']),
|
||||
FakeProcessInfo(process, <String>['pub', 'publish']),
|
||||
];
|
||||
|
||||
expect(
|
||||
@ -223,7 +225,8 @@ void main() {
|
||||
'Packages with an SDK constraint on a pre-release of the Dart '
|
||||
'SDK should themselves be published as a pre-release version.');
|
||||
processRunner.mockProcessesForExecutable['flutter'] = <FakeProcessInfo>[
|
||||
FakeProcessInfo(process, <String>['pub', 'publish'])
|
||||
FakeProcessInfo(MockProcess(), <String>['pub', 'get']),
|
||||
FakeProcessInfo(process, <String>['pub', 'publish']),
|
||||
];
|
||||
|
||||
Error? commandError;
|
||||
@ -247,6 +250,7 @@ void main() {
|
||||
createFakePlugin('d', packagesDir);
|
||||
|
||||
processRunner.mockProcessesForExecutable['flutter'] = <FakeProcessInfo>[
|
||||
FakeProcessInfo(MockProcess(), <String>['pub', 'get']),
|
||||
FakeProcessInfo(MockProcess(stdout: 'Package has 0 warnings.'),
|
||||
<String>['pub', 'publish']),
|
||||
];
|
||||
|
Reference in New Issue
Block a user