Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,24 @@ targets:
channel: stable
version_file: flutter_stable.version

# Analyze with the previous stable (N-1) and the stable before that (N-2). The
# versions in `channel` should be updated after a new major stable release.
- name: Linux analyze_legacy N-1
bringup: true # New target
recipe: packages/packages
timeout: 30
properties:
target_file: analyze_legacy.yaml
channel: "3.7.12"

- name: Linux analyze_legacy N-2
bringup: true # New target
recipe: packages/packages
timeout: 30
properties:
target_file: analyze_legacy.yaml
channel: "3.3.10"

- name: Linux_android custom_package_tests master
recipe: packages/packages
timeout: 30
Expand Down
23 changes: 23 additions & 0 deletions .ci/scripts/analyze_legacy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# Copyright 2013 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.
set -e

# Allow analyzing packages that use a dev dependency with a higher minimum
# Flutter/Dart version than the package itself. Non-client code doesn't need to
# work in legacy versions.
#
# This requires the --lib-only flag below.
./script/tool_runner.sh remove-dev-dependencies

# This uses --run-on-dirty-packages rather than --packages-for-branch
# since only the packages changed by 'make-deps-path-based' need to be
# re-checked.
./script/tool_runner.sh analyze --lib-only \
--skip-if-not-supporting-flutter-version="$CHANNEL" \
--custom-analysis=script/configs/custom_analysis.yaml

# Restore the tree to a clean state, to avoid accidental issues if
# other script steps are added to the enclosing task.
git checkout .
File renamed without changes.
Empty file modified .ci/scripts/dart_unit_tests_pathified.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion .ci/targets/analyze.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ tasks:
# the changes won't break analysis of other packages in the respository
# that depend on it.
- name: analyze - pathified
script: .ci/scripts/pathified_analyze.sh
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed this just so the variants of the analyze scripts would be grouped together in file lists, as it makes navigating the scripts easier.

script: .ci/scripts/analyze_pathified.sh
11 changes: 11 additions & 0 deletions .ci/targets/analyze_legacy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
tasks:
- name: prepare tool
script: .ci/scripts/prepare_tool.sh
# Does a sanity check that packages at least pass analysis on the N-1 and N-2
# versions of Flutter stable if the package claims to support that version.
# This is to minimize accidentally making changes that break old versions
# (which we don't commit to supporting, but don't want to actively break)
# without updating the constraints.
# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#supported-flutter-versions
- name: analyze - legacy
script: .ci/scripts/analyze_legacy.sh
2 changes: 1 addition & 1 deletion .ci/targets/repo_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tasks:
args: ["license-check"]
always: true
# The major and minor version here should match the lowest version analyzed
# in legacy version analysis (currently .cirrus.yaml legacy_version_analyze).
# in legacy version analysis (.ci.yaml analyze_legacy).
- name: pubspec validation
script: script/tool_runner.sh
args:
Expand Down
4 changes: 1 addition & 3 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,16 @@ task:
# Change the arguments to pubspec-check when changing these values.
env:
CHANNEL: "3.7.12"
DART_VERSION: "2.17.6"
env:
CHANNEL: "3.3.10"
DART_VERSION: "2.18.6"
package_prep_script:
# Allow analyzing packages that use a dev dependency with a higher
# minimum Flutter/Dart version than the package itself.
- ./script/tool_runner.sh remove-dev-dependencies
analyze_script:
# Only analyze lib/; non-client code doesn't need to work on
# all supported legacy version.
- ./script/tool_runner.sh analyze --lib-only --skip-if-not-supporting-flutter-version="$CHANNEL" --skip-if-not-supporting-dart-version="$DART_VERSION" --custom-analysis=script/configs/custom_analysis.yaml
- ./script/tool_runner.sh analyze --lib-only --skip-if-not-supporting-flutter-version="$CHANNEL" --custom-analysis=script/configs/custom_analysis.yaml
- name: readme_excerpts
env:
CIRRUS_CLONE_SUBMODULES: true
Expand Down
2 changes: 2 additions & 0 deletions script/tool/lib/src/common/core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ final Map<Version, Version> _dartSdkForFlutterSdk = <Version, Version>{
Version(3, 0, 0): Version(2, 17, 0),
Version(3, 0, 5): Version(2, 17, 6),
Version(3, 3, 0): Version(2, 18, 0),
Version(3, 3, 10): Version(2, 18, 6),
Version(3, 7, 0): Version(2, 19, 0),
Version(3, 7, 12): Version(2, 19, 6),
Version(3, 10, 0): Version(3, 0, 0),
};

Expand Down
16 changes: 5 additions & 11 deletions script/tool/lib/src/common/package_looping_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,13 @@ abstract class PackageLoopingCommand extends PackageCommand {
argParser.addOption(
_skipByFlutterVersionArg,
help: 'Skip any packages that require a Flutter version newer than '
'the provided version.',
);
argParser.addOption(
_skipByDartVersionArg,
help: 'Skip any packages that require a Dart version newer than '
'the provided version.',
'the provided version, or a Dart version newer than the '
'corresponding Dart version.',
);
}

static const String _skipByFlutterVersionArg =
'skip-if-not-supporting-flutter-version';
static const String _skipByDartVersionArg =
'skip-if-not-supporting-dart-version';

/// Packages that had at least one [logWarning] call.
final Set<PackageEnumerationEntry> _packagesWithWarnings =
Expand Down Expand Up @@ -271,9 +265,9 @@ abstract class PackageLoopingCommand extends PackageCommand {
final Version? minFlutterVersion = minFlutterVersionArg.isEmpty
? null
: Version.parse(minFlutterVersionArg);
final String minDartVersionArg = getStringArg(_skipByDartVersionArg);
final Version? minDartVersion =
minDartVersionArg.isEmpty ? null : Version.parse(minDartVersionArg);
final Version? minDartVersion = minFlutterVersion == null
? null
: getDartSdkForFlutterSdk(minFlutterVersion);

final DateTime runStart = DateTime.now();

Expand Down
9 changes: 5 additions & 4 deletions script/tool/test/common/package_looping_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -376,15 +376,16 @@ void main() {
test('skips unsupported Dart versions when requested', () async {
final RepositoryPackage excluded = createFakePackage(
'excluded_package', packagesDir,
dartConstraint: '>=2.17.0 <4.0.0');
dartConstraint: '>=2.18.0 <4.0.0');
final RepositoryPackage included =
createFakePackage('a_package', packagesDir);

final TestPackageLoopingCommand command = createTestCommand(
packageLoopingType: PackageLoopingType.includeAllSubpackages,
hasLongOutput: false);
final List<String> output = await runCommand(command,
arguments: <String>['--skip-if-not-supporting-dart-version=2.14.0']);
final List<String> output = await runCommand(command, arguments: <String>[
'--skip-if-not-supporting-flutter-version=3.0.0' // Flutter 3.0.0 -> Dart 2.17.0
]);

expect(
command.checkedPackages,
Expand All @@ -399,7 +400,7 @@ void main() {
containsAllInOrder(<String>[
'${_startHeadingColor}Running for a_package...$_endColor',
'${_startHeadingColor}Running for excluded_package...$_endColor',
'$_startSkipColor SKIPPING: Does not support Dart 2.14.0$_endColor',
'$_startSkipColor SKIPPING: Does not support Dart 2.17.0$_endColor',
]));
});
});
Expand Down