Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 004af7f

Browse files
[ci] Run analyze with minimum resolved packages (#6207)
1 parent 4219332 commit 004af7f

File tree

17 files changed

+124
-18
lines changed

17 files changed

+124
-18
lines changed

.cirrus.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,14 @@ task:
171171
# Only analyze lib/; non-client code doesn't need to work on
172172
# all supported legacy version.
173173
- ./script/tool_runner.sh analyze --lib-only --skip-if-not-supporting-flutter-version="$CHANNEL" --custom-analysis=script/configs/custom_analysis.yaml
174+
# Does a sanity check that plugins pass analysis with the lowest possible
175+
# versions of all dependencies. This is to catch cases where we add use of
176+
# new APIs but forget to update minimum versions of dependencies to when
177+
# those APIs are introduced.
178+
- name: downgraded_analyze
179+
depends_on: analyze
180+
analyze_script:
181+
- ./script/tool_runner.sh analyze --downgrade
174182
- name: readme_excerpts
175183
env:
176184
CIRRUS_CLONE_SUBMODULES: true

packages/image_picker/image_picker_android/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.8.5+2
2+
3+
* Updates `image_picker_platform_interface` constraint to the correct minimum
4+
version.
5+
16
## 0.8.5+1
27

38
* Switches to an internal method channel implementation.

packages/image_picker/image_picker_android/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: image_picker_android
22
description: Android implementation of the image_picker plugin.
33
repository: https://github.com/flutter/plugins/tree/main/packages/image_picker/image_picker_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22
5-
version: 0.8.5+1
5+
version: 0.8.5+2
66

77
environment:
88
sdk: ">=2.14.0 <3.0.0"
@@ -21,7 +21,7 @@ dependencies:
2121
flutter:
2222
sdk: flutter
2323
flutter_plugin_android_lifecycle: ^2.0.1
24-
image_picker_platform_interface: ^2.3.0
24+
image_picker_platform_interface: ^2.5.0
2525

2626
dev_dependencies:
2727
flutter_test:

packages/local_auth/local_auth_android/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.0.10
2+
3+
* Updates `local_auth_platform_interface` constraint to the correct minimum
4+
version.
5+
16
## 1.0.9
27

38
* Updates androidx.fragment version to 1.5.1.

packages/local_auth/local_auth_android/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: local_auth_android
22
description: Android implementation of the local_auth plugin.
33
repository: https://github.com/flutter/plugins/tree/main/packages/local_auth/local_auth_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+local_auth%22
5-
version: 1.0.9
5+
version: 1.0.10
66

77
environment:
88
sdk: ">=2.14.0 <3.0.0"
@@ -22,7 +22,7 @@ dependencies:
2222
sdk: flutter
2323
flutter_plugin_android_lifecycle: ^2.0.1
2424
intl: ^0.17.0
25-
local_auth_platform_interface: ^1.0.0
25+
local_auth_platform_interface: ^1.0.1
2626

2727
dev_dependencies:
2828
flutter_test:

packages/local_auth/local_auth_ios/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.0.8
2+
3+
* Updates `local_auth_platform_interface` constraint to the correct minimum
4+
version.
5+
16
## 1.0.7
27

38
* Updates references to the obsolete master branch.

packages/local_auth/local_auth_ios/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: local_auth_ios
22
description: iOS implementation of the local_auth plugin.
33
repository: https://github.com/flutter/plugins/tree/main/packages/local_auth/local_auth_ios
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+local_auth%22
5-
version: 1.0.7
5+
version: 1.0.8
66

77
environment:
88
sdk: ">=2.14.0 <3.0.0"
@@ -20,7 +20,7 @@ dependencies:
2020
flutter:
2121
sdk: flutter
2222
intl: ^0.17.0
23-
local_auth_platform_interface: ^1.0.0
23+
local_auth_platform_interface: ^1.0.1
2424

2525
dev_dependencies:
2626
flutter_test:

packages/local_auth/local_auth_windows/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.0.2
2+
3+
* Updates `local_auth_platform_interface` constraint to the correct minimum
4+
version.
5+
16
## 1.0.1
27

38
* Updates references to the obsolete master branch.

packages/local_auth/local_auth_windows/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: local_auth_windows
22
description: Windows implementation of the local_auth plugin.
33
repository: https://github.com/flutter/plugins/tree/main/packages/local_auth/local_auth_windows
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+local_auth%22
5-
version: 1.0.1
5+
version: 1.0.2
66

77
environment:
88
sdk: ">=2.14.0 <3.0.0"
@@ -19,7 +19,7 @@ flutter:
1919
dependencies:
2020
flutter:
2121
sdk: flutter
22-
local_auth_platform_interface: ^1.0.0
22+
local_auth_platform_interface: ^1.0.1
2323

2424
dev_dependencies:
2525
flutter_test:

packages/url_launcher/url_launcher_web/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2.0.13
2+
3+
* Updates `url_launcher_platform_interface` constraint to the correct minimum
4+
version.
5+
16
## 2.0.12
27

38
* Fixes call to `setState` after dispose on the `Link` widget.

packages/url_launcher/url_launcher_web/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: url_launcher_web
22
description: Web platform implementation of url_launcher
33
repository: https://github.com/flutter/plugins/tree/main/packages/url_launcher/url_launcher_web
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22
5-
version: 2.0.12
5+
version: 2.0.13
66

77
environment:
88
sdk: ">=2.12.0 <3.0.0"
@@ -21,7 +21,7 @@ dependencies:
2121
sdk: flutter
2222
flutter_web_plugins:
2323
sdk: flutter
24-
url_launcher_platform_interface: ^2.0.0
24+
url_launcher_platform_interface: ^2.0.3
2525

2626
dev_dependencies:
2727
flutter_test:

packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2.9.3
2+
3+
* Updates `webview_flutter_platform_interface` constraint to the correct minimum
4+
version.
5+
16
## 2.9.2
27

38
* Fixes crash when an Objective-C object in `FWFInstanceManager` is released, but the dealloc

packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: webview_flutter_wkwebview
22
description: A Flutter plugin that provides a WebView widget based on Apple's WKWebView control.
33
repository: https://github.com/flutter/plugins/tree/main/packages/webview_flutter/webview_flutter_wkwebview
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22
5-
version: 2.9.2
5+
version: 2.9.3
66

77
environment:
88
sdk: ">=2.17.0 <3.0.0"
@@ -19,7 +19,7 @@ dependencies:
1919
flutter:
2020
sdk: flutter
2121
path: ^1.8.0
22-
webview_flutter_platform_interface: ^1.8.0
22+
webview_flutter_platform_interface: ^1.9.0
2323

2424
dev_dependencies:
2525
build_runner: ^2.1.5

script/tool/CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
## 0.9.1
2+
3+
* Adds a `--downgrade` flag to `analyze` for analyzing with the oldest possible
4+
versions of packages.
5+
16
## 0.9.0
27

38
* Replaces PR-description-based version/changelog/breaking change check
49
overrides in `version-check` with label-based overrides using a new
510
`pr-labels` flag, since we don't actually have reliable access to the
611
PR description in checks.
7-
12+
813
## 0.8.10
914

1015
- Adds a new `remove-dev-dependencies` command to remove `dev_dependencies`

script/tool/lib/src/analyze_command.dart

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,16 @@ class AnalyzeCommand extends PackageLoopingCommand {
3232
valueHelp: 'dart-sdk',
3333
help: 'An optional path to a Dart SDK; this is used to override the '
3434
'SDK used to provide analysis.');
35+
argParser.addFlag(_downgradeFlag,
36+
help: 'Runs "flutter pub downgrade" before analysis to verify that '
37+
'the minimum constraints are sufficiently new for APIs used.');
3538
argParser.addFlag(_libOnlyFlag,
3639
help: 'Only analyze the lib/ directory of the main package, not the '
3740
'entire package.');
3841
}
3942

4043
static const String _customAnalysisFlag = 'custom-analysis';
44+
static const String _downgradeFlag = 'downgrade';
4145
static const String _libOnlyFlag = 'lib-only';
4246
static const String _analysisSdk = 'analysis-sdk';
4347

@@ -113,6 +117,12 @@ class AnalyzeCommand extends PackageLoopingCommand {
113117
return PackageResult.skip('No lib/ directory.');
114118
}
115119

120+
if (getBoolArg(_downgradeFlag)) {
121+
if (!await _runPubCommand(package, 'downgrade')) {
122+
return PackageResult.fail(<String>['Unable to downgrade dependencies']);
123+
}
124+
}
125+
116126
// Analysis runs over the package and all subpackages (unless only lib/ is
117127
// being analyzed), so all of them need `flutter pub get` run before
118128
// analyzing. `example` packages can be skipped since 'flutter packages get'
@@ -127,10 +137,7 @@ class AnalyzeCommand extends PackageLoopingCommand {
127137
!RepositoryPackage(packageToGet.directory.parent)
128138
.pubspecFile
129139
.existsSync()) {
130-
final int exitCode = await processRunner.runAndStream(
131-
flutterCommand, <String>['pub', 'get'],
132-
workingDir: packageToGet.directory);
133-
if (exitCode != 0) {
140+
if (!await _runPubCommand(packageToGet, 'get')) {
134141
return PackageResult.fail(<String>['Unable to get dependencies']);
135142
}
136143
}
@@ -147,4 +154,11 @@ class AnalyzeCommand extends PackageLoopingCommand {
147154
}
148155
return PackageResult.success();
149156
}
157+
158+
Future<bool> _runPubCommand(RepositoryPackage package, String command) async {
159+
final int exitCode = await processRunner.runAndStream(
160+
flutterCommand, <String>['pub', command],
161+
workingDir: package.directory);
162+
return exitCode == 0;
163+
}
150164
}

script/tool/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: flutter_plugin_tools
22
description: Productivity utils for flutter/plugins and flutter/packages
33
repository: https://github.com/flutter/plugins/tree/main/script/tool
4-
version: 0.9.0
4+
version: 0.9.1
55

66
dependencies:
77
args: ^2.1.0

script/tool/test/analyze_command_test.dart

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,33 @@ void main() {
187187
);
188188
});
189189

190+
test('downgrades first when requested', () async {
191+
final RepositoryPackage plugin = createFakePlugin('a', packagesDir);
192+
193+
await runCapturingPrint(runner, <String>['analyze', '--downgrade']);
194+
195+
expect(
196+
processRunner.recordedCalls,
197+
orderedEquals(<ProcessCall>[
198+
ProcessCall(
199+
'flutter',
200+
const <String>['pub', 'downgrade'],
201+
plugin.path,
202+
),
203+
ProcessCall(
204+
'flutter',
205+
const <String>['pub', 'get'],
206+
plugin.path,
207+
),
208+
ProcessCall(
209+
'dart',
210+
const <String>['analyze', '--fatal-infos'],
211+
plugin.path,
212+
),
213+
]),
214+
);
215+
});
216+
190217
group('verifies analysis settings', () {
191218
test('fails analysis_options.yaml', () async {
192219
createFakePlugin('foo', packagesDir,
@@ -312,6 +339,28 @@ void main() {
312339
);
313340
});
314341

342+
test('fails if "pub downgrade" fails', () async {
343+
createFakePlugin('foo', packagesDir);
344+
345+
processRunner.mockProcessesForExecutable['flutter'] = <io.Process>[
346+
MockProcess(exitCode: 1) // flutter pub downgrade
347+
];
348+
349+
Error? commandError;
350+
final List<String> output = await runCapturingPrint(
351+
runner, <String>['analyze', '--downgrade'], errorHandler: (Error e) {
352+
commandError = e;
353+
});
354+
355+
expect(commandError, isA<ToolExit>());
356+
expect(
357+
output,
358+
containsAllInOrder(<Matcher>[
359+
contains('Unable to downgrade dependencies'),
360+
]),
361+
);
362+
});
363+
315364
test('fails if "analyze" fails', () async {
316365
createFakePlugin('foo', packagesDir);
317366

0 commit comments

Comments
 (0)