Clean up dependency pins and update all packages (#91109)

This commit is contained in:
Ian Hickson
2021-10-04 10:28:03 -07:00
committed by GitHub
parent 555f69e5d9
commit 126cd7388e
44 changed files with 339 additions and 358 deletions

View File

@@ -21,60 +21,25 @@ import '../runner/flutter_command.dart';
/// Map from package name to package version, used to artificially pin a pub
/// package version in cases when upgrading to the latest breaks Flutter.
const Map<String, String> _kManuallyPinnedDependencies = <String, String>{
///
/// These version pins must be pins, not ranges! Allowing these to be ranges
/// defeats the whole purpose of pinning all our dependencies, which is to
/// prevent upstream changes from causing our CI to fail randomly in ways
/// unrelated to the commits. It also, more importantly, risks breaking users
/// in ways that prevent them from every upgrading Flutter again!
const Map<String, String> kManuallyPinnedDependencies = <String, String>{
// Add pinned packages here. Please leave a comment explaining why.
// PACKAGES WITH INCOMPATIBLE LATER VERSIONS
// Dart analyzer does not catch renamed or deleted files.
// Therefore, we control the version of flutter_gallery_assets so that
// existing tests do not fail when the package has a new version.
'flutter_gallery_assets': '^1.0.1',
'flutter_gallery_assets': '1.0.2', // Tests depend on the exact version.
'flutter_template_images': '4.0.0', // Must always exactly match flutter_tools template.
// DART TEAM OWNED NNBD DEPS
'archive': '">=3.0.0-nullsafety.0"',
'async': '">=2.5.0-nullsafety.3"',
'boolean_selector': '">=2.1.0-nullsafety.3"',
'characters': '">=1.1.0-nullsafety.5"',
'charcode': '">=1.2.0-nullsafety.3"',
'clock': '">=1.1.0-nullsafety.3"',
'collection': '">=1.15.0-nullsafety.5"',
'fake_async': '">=1.2.0-nullsafety.3"',
'intl': '">=0.17.0-nullsafety.2"',
'js': '">=0.6.3-nullsafety.3"',
'matcher': '">=0.12.10-nullsafety.3"',
'meta': '">=1.3.0-nullsafety.6"',
'path': '">=1.8.0-nullsafety.3"',
'pedantic': '">=1.10.0-nullsafety.3"',
'petitparser': '">=4.0.0-nullsafety.1"',
'pool': '">=1.5.0-nullsafety.3"',
'source_map_stack_trace': '">=2.1.0-nullsafety.4"',
'source_maps': '">=0.10.10-nullsafety.3"',
'source_span': '">=1.8.0-nullsafety.4"',
'stack_trace': '">=1.10.0-nullsafety.6"',
'stream_channel': '">=2.1.0-nullsafety.3"',
'string_scanner': '">=1.1.0-nullsafety.3"',
'term_glyph': '">=1.2.0-nullsafety.3"',
'test': '">=1.16.0-nullsafety.16"',
'test_api': '">=0.2.19-nullsafety.6"',
'test_core': '">=0.3.12-nullsafety.15"',
'typed_data': '">=1.3.0-nullsafety.5"',
'vector_math': '">=2.1.0-nullsafety.5"',
'vm_service': '">=6.0.1-nullsafety.1"',
'xml': '">=5.0.0-nullsafety.1"',
// FLUTTER TEAM OWNED NNBD DEPS
'connectivity': '">=3.0.0-nullsafety.1"',
'device_info': '">=2.0.0-nullsafety.1"',
'file': '">=6.0.0-nullsafety.4"',
'path_provider': '">=2.0.0-nullsafety.1"',
'platform': '">=3.0.0-nullsafety.4"',
'process': '">=4.0.0-nullsafety.4"',
'process_runner': '">=4.0.0-nullsafety.5"',
'url_launcher': '">=6.0.0-nullsafety.1"',
// This is pinned to avoid the performance regression from a reverted feature
// from https://github.com/dart-lang/shelf/issues/189 . This can be removed
// when a new major version of shelf is published.
// "shelf" is pinned to avoid the performance regression from a reverted
// feature from https://github.com/dart-lang/shelf/issues/189 . This can be
// removed when a new major version of shelf is published.
'shelf': '1.1.4',
// Latest version does not resolve on our CI.
'video_player': '2.1.1',
'video_player': '2.1.1', // Latest version does not resolve on our CI.
// "test" is pinned because 1.18.1 fails when running web tests with this error:
// FileSystemException: Cannot open file, path = '.../.pub-cache/hosted/pub.dartlang.org/test-1.18.1/lib/src/runner/browser/static/host.dart.js' (OS Error: No such file or directory, errno = 2)
// When removing this remove `pedantic` from dev/bots/allowlist.dart also.
'test': '1.17.12', // https://github.com/dart-lang/test/issues/1594
};
class UpdatePackagesCommand extends FlutterCommand {
@@ -1277,7 +1242,7 @@ class PubspecDependency extends PubspecLine {
assert(kind != DependencyKind.unknown);
break;
case DependencyKind.normal:
if (!_kManuallyPinnedDependencies.containsKey(name)) {
if (!kManuallyPinnedDependencies.containsKey(name)) {
dependencies.writeln(' $name: $versionToUse');
}
break;
@@ -1339,7 +1304,7 @@ String _generateFakePubspec(
result.writeln(" sdk: '>=2.10.0 <3.0.0'");
result.writeln('dependencies:');
overrides.writeln('dependency_overrides:');
if (_kManuallyPinnedDependencies.isNotEmpty) {
if (kManuallyPinnedDependencies.isNotEmpty) {
if (verbose) {
globals.printStatus('WARNING: the following packages use hard-coded version constraints:');
}
@@ -1347,7 +1312,7 @@ String _generateFakePubspec(
for (final PubspecDependency dependency in dependencies)
dependency.name,
};
for (final String package in _kManuallyPinnedDependencies.keys) {
for (final String package in kManuallyPinnedDependencies.keys) {
// Don't add pinned dependency if it is not in the set of all transitive dependencies.
if (!allTransitive.contains(package)) {
if (verbose) {
@@ -1355,7 +1320,7 @@ String _generateFakePubspec(
}
continue;
}
final String version = _kManuallyPinnedDependencies[package];
final String version = kManuallyPinnedDependencies[package];
result.writeln(' $package: $version');
if (verbose) {
globals.printStatus(' - $package: $version');

View File

@@ -7,7 +7,7 @@ environment:
dependencies:
# To update these, use "flutter update-packages --force-upgrade".
archive: 3.1.4
archive: 3.1.5
args: 2.3.0
browser_launcher: 1.0.0
dds: 2.1.3
@@ -57,19 +57,19 @@ dependencies:
vm_service: 7.3.0
_fe_analyzer_shared: 26.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
analyzer: 2.3.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
_fe_analyzer_shared: 27.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
analyzer: 2.4.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
boolean_selector: 2.1.0 # 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.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
charcode: 1.3.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
cli_util: 0.3.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
cli_util: 0.3.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
clock: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
csslib: 0.17.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
devtools_shared: 2.6.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
fixnum: 1.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
frontend_server_client: 2.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
glob: 2.0.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
glob: 2.0.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
http_parser: 4.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
io: 1.0.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
json_rpc_2: 3.0.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -87,7 +87,7 @@ dependencies:
sync_http: 0.3.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
term_glyph: 1.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
typed_data: 1.3.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
watcher: 1.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
watcher: 1.0.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
dev_dependencies:
collection: 1.15.0
@@ -104,4 +104,4 @@ dartdoc:
# Exclude this package from the hosted API docs.
nodoc: true
# PUBSPEC CHECKSUM: d117
# PUBSPEC CHECKSUM: d51d

View File

@@ -0,0 +1,19 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'package:flutter_tools/src/commands/update_packages.dart';
import '../../src/common.dart';
void main() {
testWithoutContext('kManuallyPinnedDependencies pins are actually pins', () {
expect(
kManuallyPinnedDependencies.values,
isNot(contains(anyOf('any', startsWith('^'), startsWith('>'), startsWith('<')))),
reason: 'Version pins in kManuallyPinnedDependencies must be specific pins, not ranges.',
);
});
}