Allow explicit exclusion of packages from pinned packages in flutter update-packages --force-update (#147679)
## Description This introduces a list of packages that we will explicitly not pin. It is to be used for things where the package isn't actually published, but is a transitive dependency of another package included in the SDK. This happens with the `macros` package, for instance, which depends on the private, unpublished, `_macros` package where the SDK does some tricky things to depend on it (it depends on "any", but ships it as part of the SDK). Also ran `flutter update-packages --force-update` to update all of the pubspec files. ## Related Issues - Fixes #147656 ## Tests - Added a test that makes sure that explicitly unpinned packages don't show up in the pinned list.
This commit is contained in:
@@ -1067,6 +1067,7 @@ class PubspecYaml {
|
||||
...directDependencies,
|
||||
...specialDependencies,
|
||||
...devDependencies,
|
||||
...kExplicitlyExcludedPackages,
|
||||
};
|
||||
|
||||
// Create a new set to hold the list of packages we've already processed, so
|
||||
@@ -1549,6 +1550,12 @@ String generateFakePubspec(
|
||||
}
|
||||
});
|
||||
}
|
||||
if (verbose && kExplicitlyExcludedPackages.isNotEmpty) {
|
||||
globals.printStatus('WARNING: the following packages are explicitly excluded from version pinning');
|
||||
for (final String package in kExplicitlyExcludedPackages) {
|
||||
globals.printStatus(' - $package');
|
||||
}
|
||||
}
|
||||
for (final PubspecDependency dependency in dependencies) {
|
||||
if (!dependency.pointsToSdk) {
|
||||
dependency.describeForFakePubspec(result, overrides, allowUpgrade: doUpgrade);
|
||||
|
||||
@@ -32,3 +32,9 @@ const Map<String, String> kManuallyPinnedDependencies = <String, String>{
|
||||
'camera_android': '0.10.8+17', // https://github.com/flutter/flutter/issues/146004
|
||||
'dds': '4.1.0', // https://github.com/dart-lang/sdk/issues/55559
|
||||
};
|
||||
|
||||
/// These are packages that are explicitly excluded from appearing in the list
|
||||
/// of pinned packages added to each pubspec.yaml.
|
||||
const List<String> kExplicitlyExcludedPackages = <String>[
|
||||
'_macros', // Synthetic dependency for macros package, which isn't published.
|
||||
];
|
||||
|
||||
@@ -69,8 +69,8 @@ dependencies:
|
||||
|
||||
standard_message_codec: 0.0.1+4
|
||||
|
||||
_fe_analyzer_shared: 67.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
analyzer: 6.4.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
_fe_analyzer_shared: 68.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
analyzer: 6.5.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
boolean_selector: 2.1.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
built_collection: 5.1.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
built_value: 8.9.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
@@ -87,6 +87,7 @@ dependencies:
|
||||
http_parser: 4.0.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
io: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
json_rpc_2: 3.0.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
macros: 0.1.0-main.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
matcher: 0.12.16+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
petitparser: 6.0.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
platform: 3.1.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
@@ -120,4 +121,4 @@ dartdoc:
|
||||
# Exclude this package from the hosted API docs.
|
||||
nodoc: true
|
||||
|
||||
# PUBSPEC CHECKSUM: c116
|
||||
# PUBSPEC CHECKSUM: 251c
|
||||
|
||||
@@ -24,6 +24,7 @@ dependencies:
|
||||
# To update these, use "flutter update-packages --force-upgrade".
|
||||
collection: 1.14.11
|
||||
meta: 1.1.8
|
||||
macros: 0.0.1
|
||||
typed_data: 1.1.6
|
||||
vector_math: 2.0.8
|
||||
|
||||
@@ -197,6 +198,7 @@ void main() {
|
||||
equals(<String>{
|
||||
'collection: 1.14.11',
|
||||
'meta: 1.1.8',
|
||||
'macros: 0.0.1',
|
||||
'typed_data: 1.1.6',
|
||||
'vector_math: 2.0.8',
|
||||
'sky_engine: ',
|
||||
@@ -212,6 +214,7 @@ void main() {
|
||||
equals(<String>{
|
||||
'collection: 1.14.11',
|
||||
'meta: 1.1.8',
|
||||
'macros: 0.0.1',
|
||||
'typed_data: 1.1.6',
|
||||
'vector_math: 2.0.8',
|
||||
'sky_engine: ',
|
||||
@@ -226,10 +229,32 @@ void main() {
|
||||
equals(<String>{
|
||||
'collection: 1.14.11',
|
||||
'meta: 1.1.8',
|
||||
'macros: 0.0.1',
|
||||
'typed_data: 1.1.6',
|
||||
'vector_math: 2.0.8',
|
||||
'sky_engine: ',
|
||||
'gallery: ',
|
||||
}));
|
||||
});
|
||||
|
||||
testWithoutContext('PubspecYaml apply skips explicitly excluded packages', () async {
|
||||
final PubspecYaml flutterPubspec = PubspecYaml(flutter);
|
||||
final PubDependencyTree flutterTree = PubDependencyTree();
|
||||
final List<String> depsLines = <String>[
|
||||
// Have to add these first so that flutterTree.fill ignores the one in
|
||||
// the pubspec.
|
||||
'- macros 0.0.1 [_macros]',
|
||||
'- _macros 0.0.1',
|
||||
for (final PubspecDependency dependency in flutterPubspec.allDependencies)
|
||||
'- ${dependency.name} ${dependency.version}',
|
||||
];
|
||||
|
||||
final Set<String> dependencies = flutterPubspec.allDependencies.map<String>(
|
||||
(PubspecDependency dep) => dep.name).toSet();
|
||||
depsLines.add('- flutter 1.0.0 [${dependencies.join(' ')}}]');
|
||||
depsLines.forEach(flutterTree.fill);
|
||||
flutterPubspec.apply(flutterTree, <String>{});
|
||||
final String contents = flutter.childFile('pubspec.yaml').readAsStringSync();
|
||||
expect(contents, isNot(contains('_macros: 0.0.1')));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user