@@ -65,6 +65,14 @@ class UpdatePackagesCommand extends FlutterCommand {
65
65
defaultsTo: false ,
66
66
negatable: false ,
67
67
)
68
+ ..addFlag (
69
+ 'consumer-only' ,
70
+ help: 'Only prints the dependency graph that is the transitive closure'
71
+ 'that a consumer of the Flutter SDK will observe (When combined '
72
+ 'with transitive-closure)' ,
73
+ defaultsTo: false ,
74
+ negatable: false ,
75
+ )
68
76
..addFlag (
69
77
'verify-only' ,
70
78
help: 'verifies the package checksum without changing or updating deps' ,
@@ -107,6 +115,24 @@ class UpdatePackagesCommand extends FlutterCommand {
107
115
final bool isPrintPaths = argResults['paths' ];
108
116
final bool isPrintTransitiveClosure = argResults['transitive-closure' ];
109
117
final bool isVerifyOnly = argResults['verify-only' ];
118
+ final bool isConsumerOnly = argResults['consumer-only' ];
119
+
120
+ // "consumer" packages are those that constitute our public API (e.g. flutter, flutter_test, flutter_driver, flutter_localizations).
121
+ if (isConsumerOnly) {
122
+ if (! isPrintTransitiveClosure) {
123
+ throwToolExit (
124
+ '--consumer-only can only be used with the --transitive-closure flag'
125
+ );
126
+ }
127
+ // Only retain flutter, flutter_test, flutter_driver, and flutter_localizations.
128
+ const List <String > consumerPackages = < String > ['flutter' , 'flutter_test' , 'flutter_driver' , 'flutter_localizations' ];
129
+ // ensure we only get flutter/packages
130
+ packages.retainWhere ((Directory directory) {
131
+ return consumerPackages.any ((String package) {
132
+ return directory.path.endsWith ('packages${fs .path .separator }$package ' );
133
+ });
134
+ });
135
+ }
110
136
111
137
// The dev/integration_tests/android_views integration test depends on an assets
112
138
// package that is in the goldens repository. We need to make sure that the goldens
0 commit comments