mirror of
https://github.com/flutter/flutter
synced 2024-10-13 03:32:55 +00:00
[flutter_tools] pin transitive deps during --transitive-closure (#80911)
This commit is contained in:
parent
18a118b952
commit
c2aa193c5f
|
@ -18,7 +18,6 @@ const Set<String> kCorePackageAllowList = <String>{
|
|||
'collection',
|
||||
'fake_async',
|
||||
'file',
|
||||
'frontend_server_client',
|
||||
'intl',
|
||||
'meta',
|
||||
'path',
|
||||
|
@ -73,5 +72,11 @@ const Set<String> kCorePackageAllowList = <String>{
|
|||
'flutter_driver',
|
||||
'flutter_localizations',
|
||||
'flutter_test',
|
||||
'integration_test'
|
||||
'integration_test',
|
||||
'flutter_goldens',
|
||||
'flutter_goldens_client',
|
||||
'fuchsia_remote_debug_protocol',
|
||||
'platform',
|
||||
'process',
|
||||
'sky_engine',
|
||||
};
|
||||
|
|
|
@ -1173,7 +1173,7 @@ Future<void> _checkConsumerDependencies() async {
|
|||
|
||||
// Do not change this signature without following the directions in
|
||||
// dev/bots/allowlist.dart
|
||||
const String kExpected = 'nkO7DCjvSMB6VKyw+V9MU46m3xFEk/oYSbmgAWqvbXE=';
|
||||
const String kExpected = 'QnuXnTSwemf+qT+LAU8K8Bb0l9L20z4qT1PUEQlBrVg=';
|
||||
|
||||
if (disallowed.isNotEmpty) {
|
||||
exitWithError(<String>[
|
||||
|
|
|
@ -196,22 +196,41 @@ class UpdatePackagesCommand extends FlutterCommand {
|
|||
'--force-upgrade cannot be used with the --offline flag'
|
||||
);
|
||||
}
|
||||
|
||||
// "consumer" packages are those that constitute our public API (e.g. flutter, flutter_test, flutter_driver, flutter_localizations, integration_test).
|
||||
if (isConsumerOnly) {
|
||||
if (!isPrintTransitiveClosure) {
|
||||
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'];
|
||||
// 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');
|
||||
});
|
||||
|
||||
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
|
||||
);
|
||||
}
|
||||
tree._dependencyTree.forEach((String from, Set<String> to) {
|
||||
globals.printStatus('$from -> $to');
|
||||
});
|
||||
return FlutterCommandResult.success();
|
||||
}
|
||||
|
||||
if (isVerifyOnly) {
|
||||
|
|
Loading…
Reference in a new issue