diff --git a/.ci.yaml b/.ci.yaml index 3d39c8df70..49e39e7445 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -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 diff --git a/.ci/scripts/analyze_legacy.sh b/.ci/scripts/analyze_legacy.sh new file mode 100755 index 0000000000..7b31ea4c5e --- /dev/null +++ b/.ci/scripts/analyze_legacy.sh @@ -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 . diff --git a/.ci/scripts/pathified_analyze.sh b/.ci/scripts/analyze_pathified.sh similarity index 100% rename from .ci/scripts/pathified_analyze.sh rename to .ci/scripts/analyze_pathified.sh diff --git a/.ci/scripts/dart_unit_tests_pathified.sh b/.ci/scripts/dart_unit_tests_pathified.sh old mode 100644 new mode 100755 diff --git a/.ci/targets/analyze.yaml b/.ci/targets/analyze.yaml index 25791d3c89..02ae19504c 100644 --- a/.ci/targets/analyze.yaml +++ b/.ci/targets/analyze.yaml @@ -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 + script: .ci/scripts/analyze_pathified.sh diff --git a/.ci/targets/analyze_legacy.yaml b/.ci/targets/analyze_legacy.yaml new file mode 100644 index 0000000000..3c95e6c0e1 --- /dev/null +++ b/.ci/targets/analyze_legacy.yaml @@ -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 diff --git a/.ci/targets/repo_checks.yaml b/.ci/targets/repo_checks.yaml index fbce7ef673..4480a0b569 100644 --- a/.ci/targets/repo_checks.yaml +++ b/.ci/targets/repo_checks.yaml @@ -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: diff --git a/.cirrus.yml b/.cirrus.yml index be85fc9c01..98497827a1 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -96,10 +96,8 @@ 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. @@ -107,7 +105,7 @@ task: 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 diff --git a/script/tool/lib/src/common/core.dart b/script/tool/lib/src/common/core.dart index 020dd74667..eb1a53240a 100644 --- a/script/tool/lib/src/common/core.dart +++ b/script/tool/lib/src/common/core.dart @@ -44,7 +44,9 @@ final Map _dartSdkForFlutterSdk = { 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), }; diff --git a/script/tool/lib/src/common/package_looping_command.dart b/script/tool/lib/src/common/package_looping_command.dart index f014fb21ac..73c8528520 100644 --- a/script/tool/lib/src/common/package_looping_command.dart +++ b/script/tool/lib/src/common/package_looping_command.dart @@ -90,19 +90,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 _packagesWithWarnings = @@ -267,9 +261,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(); diff --git a/script/tool/test/common/package_looping_command_test.dart b/script/tool/test/common/package_looping_command_test.dart index 32d18376a5..d63b4344f3 100644 --- a/script/tool/test/common/package_looping_command_test.dart +++ b/script/tool/test/common/package_looping_command_test.dart @@ -373,15 +373,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 output = await runCommand(command, - arguments: ['--skip-if-not-supporting-dart-version=2.14.0']); + final List output = await runCommand(command, arguments: [ + '--skip-if-not-supporting-flutter-version=3.0.0' // Flutter 3.0.0 -> Dart 2.17.0 + ]); expect( command.checkedPackages, @@ -396,7 +397,7 @@ void main() { containsAllInOrder([ '${_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', ])); }); });