mirror of
https://github.com/flutter/packages.git
synced 2025-08-14 01:43:59 +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:
@ -9,6 +9,7 @@ import 'common/core.dart';
|
||||
import 'common/package_looping_command.dart';
|
||||
import 'common/plugin_utils.dart';
|
||||
import 'common/process_runner.dart';
|
||||
import 'common/pub_utils.dart';
|
||||
import 'common/repository_package.dart';
|
||||
|
||||
/// A command to run Dart unit tests for packages.
|
||||
@ -130,21 +131,16 @@ class DartTestCommand extends PackageLoopingCommand {
|
||||
/// Runs the Dart tests for a non-Flutter package, returning true on success.
|
||||
Future<bool> _runDartTests(RepositoryPackage package,
|
||||
{String? platform}) async {
|
||||
// Unlike `flutter test`, `pub run test` does not automatically get
|
||||
// Unlike `flutter test`, `dart run test` does not automatically get
|
||||
// packages
|
||||
int exitCode = await processRunner.runAndStream(
|
||||
'dart',
|
||||
<String>['pub', 'get'],
|
||||
workingDir: package.directory,
|
||||
);
|
||||
if (exitCode != 0) {
|
||||
if (!await runPubGet(package, processRunner, super.platform)) {
|
||||
printError('Unable to fetch dependencies.');
|
||||
return false;
|
||||
}
|
||||
|
||||
final String experiment = getStringArg(kEnableExperiment);
|
||||
|
||||
exitCode = await processRunner.runAndStream(
|
||||
final int exitCode = await processRunner.runAndStream(
|
||||
'dart',
|
||||
<String>[
|
||||
'run',
|
||||
|
Reference in New Issue
Block a user