Revert "[flutter_tools] pin transitive deps during --transitive-closure (#80911)" (#80959)

This reverts commit c2aa193c5f.
This commit is contained in:
Jonah Williams
2021-04-22 09:39:39 -07:00
committed by GitHub
parent 43c307b3f4
commit 14759dc5a4
3 changed files with 14 additions and 38 deletions

View File

@@ -196,41 +196,22 @@ class UpdatePackagesCommand extends FlutterCommand {
'--force-upgrade cannot be used with the --offline flag'
);
}
if (isConsumerOnly && !isPrintTransitiveClosure) {
throwToolExit(
'--consumer-only can only be used with the --transitive-closure flag'
);
}
// "consumer" packages are those that constitute our public API (e.g. flutter, flutter_test, flutter_driver, flutter_localizations, integration_test).
if (isPrintTransitiveClosure) {
// Only retain flutter, flutter_test, flutter_driver, and flutter_localizations.
const List<String> consumerPackages = <String>['flutter', 'flutter_test', 'flutter_driver', 'flutter_localizations', 'integration_test'];
final PubDependencyTree tree = PubDependencyTree();
for (final Directory package in packages) {
final String packageName = globals.fs.path.basename(package.path);
if (!consumerPackages.contains(packageName) && isConsumerOnly) {
continue;
}
await pub.batch(
<String>['get'],
context: PubContext.updatePackages,
directory: package.path,
retry: false, // errors here are usually fatal since we're not hitting the network
);
await pub.batch(
<String>['deps', '--style=compact'],
context: PubContext.updatePackages,
directory: package.path,
filter: tree.fill,
retry: false, // errors here are usually fatal since we're not hitting the network
if (isConsumerOnly) {
if (!isPrintTransitiveClosure) {
throwToolExit(
'--consumer-only can only be used with the --transitive-closure flag'
);
}
tree._dependencyTree.forEach((String from, Set<String> to) {
globals.printStatus('$from -> $to');
// Only retain flutter, flutter_test, flutter_driver, and flutter_localizations.
const List<String> consumerPackages = <String>['flutter', 'flutter_test', 'flutter_driver', 'flutter_localizations', 'integration_test'];
// ensure we only get flutter/packages
packages.retainWhere((Directory directory) {
return consumerPackages.any((String package) {
return directory.path.endsWith('packages${globals.fs.path.separator}$package');
});
});
return FlutterCommandResult.success();
}
if (isVerifyOnly) {