Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Remove Dart version flag, and use tool map instead
  • Loading branch information
stuartmorgan-g committed Jul 7, 2023
commit da5f255dc0ad155c50ef7fb64ae31f48357cb1e5
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