[tool] Update Dart SDK version (#4402)

Since the tool only needs to support back to Flutter 3.3 (the oldest version we still run CI with), this updates the tool to the corresponding minimum Dart version.

This allows the use of `super` parameters, so `dart fix --apply` was run to convert them all (and remove all the includes that were only needed for setting default values).

Also opportunistically cleans up a bunch of unnecessary, very old `dart:async` includes. (Other than those removals, the changes here are all `dart fix`-generated.)
This commit is contained in:
stuartmorgan
2023-07-08 10:31:19 -04:00
committed by GitHub
parent 3eaad3d0d1
commit f1f0f240db
33 changed files with 124 additions and 235 deletions

View File

@ -2,25 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:file/file.dart';
import 'package:platform/platform.dart';
import 'package:yaml/yaml.dart';
import 'common/core.dart';
import 'common/package_looping_command.dart';
import 'common/process_runner.dart';
import 'common/repository_package.dart';
/// A command to run Dart analysis on packages.
class AnalyzeCommand extends PackageLoopingCommand {
/// Creates a analysis command instance.
AnalyzeCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
Platform platform = const LocalPlatform(),
}) : super(packagesDir, processRunner: processRunner, platform: platform) {
super.packagesDir, {
super.processRunner,
super.platform,
}) {
argParser.addMultiOption(_customAnalysisFlag,
help:
'Directories (comma separated) that are allowed to have their own '

View File

@ -2,16 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:file/file.dart';
import 'package:platform/platform.dart';
import 'package:yaml/yaml.dart';
import 'common/core.dart';
import 'common/package_looping_command.dart';
import 'common/plugin_utils.dart';
import 'common/process_runner.dart';
import 'common/repository_package.dart';
/// Key for APK.
@ -45,10 +41,10 @@ const String _flutterBuildTypeAndroidAlias = 'android';
class BuildExamplesCommand extends PackageLoopingCommand {
/// Creates an instance of the build command.
BuildExamplesCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
Platform platform = const LocalPlatform(),
}) : super(packagesDir, processRunner: processRunner, platform: platform) {
super.packagesDir, {
super.processRunner,
super.platform,
}) {
argParser.addFlag(platformLinux);
argParser.addFlag(platformMacOS);
argParser.addFlag(platformWeb);

View File

@ -6,14 +6,11 @@ import 'dart:async';
import 'package:colorize/colorize.dart';
import 'package:file/file.dart';
import 'package:git/git.dart';
import 'package:path/path.dart' as p;
import 'package:platform/platform.dart';
import 'package:pub_semver/pub_semver.dart';
import 'core.dart';
import 'package_command.dart';
import 'process_runner.dart';
import 'repository_package.dart';
/// Enumeration options for package looping commands.
@ -85,12 +82,11 @@ class PackageResult {
abstract class PackageLoopingCommand extends PackageCommand {
/// Creates a command to operate on [packagesDir] with the given environment.
PackageLoopingCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
Platform platform = const LocalPlatform(),
GitDir? gitDir,
}) : super(packagesDir,
processRunner: processRunner, platform: platform, gitDir: gitDir) {
super.packagesDir, {
super.processRunner,
super.platform,
super.gitDir,
}) {
argParser.addOption(
_skipByFlutterVersionArg,
help: 'Skip any packages that require a Flutter version newer than '

View File

@ -3,10 +3,8 @@
// found in the LICENSE file.
import 'package:file/file.dart';
import 'package:platform/platform.dart';
import 'common/package_looping_command.dart';
import 'common/process_runner.dart';
import 'common/pub_utils.dart';
import 'common/repository_package.dart';
@ -21,10 +19,10 @@ const String _legacyScriptName = 'run_tests.sh';
class CustomTestCommand extends PackageLoopingCommand {
/// Creates a custom test command instance.
CustomTestCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
Platform platform = const LocalPlatform(),
}) : super(packagesDir, processRunner: processRunner, platform: platform);
super.packagesDir, {
super.processRunner,
super.platform,
});
@override
final String name = 'custom-test';

View File

@ -3,12 +3,10 @@
// found in the LICENSE file.
import 'package:file/file.dart';
import 'package:platform/platform.dart';
import 'common/core.dart';
import 'common/package_looping_command.dart';
import 'common/plugin_utils.dart';
import 'common/process_runner.dart';
import 'common/pub_utils.dart';
import 'common/repository_package.dart';
@ -16,10 +14,10 @@ import 'common/repository_package.dart';
class DartTestCommand extends PackageLoopingCommand {
/// Creates an instance of the test command.
DartTestCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
Platform platform = const LocalPlatform(),
}) : super(packagesDir, processRunner: processRunner, platform: platform) {
super.packagesDir, {
super.processRunner,
super.platform,
}) {
argParser.addOption(
kEnableExperiment,
defaultsTo: '',

View File

@ -2,10 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:file/file.dart';
import 'package:git/git.dart';
import 'package:yaml/yaml.dart';
import 'common/core.dart';
@ -15,8 +12,7 @@ import 'common/repository_package.dart';
/// A command to verify Dependabot configuration coverage of packages.
class DependabotCheckCommand extends PackageLoopingCommand {
/// Creates Dependabot check command instance.
DependabotCheckCommand(Directory packagesDir, {GitDir? gitDir})
: super(packagesDir, gitDir: gitDir) {
DependabotCheckCommand(super.packagesDir, {super.gitDir}) {
argParser.addOption(_configPathFlag,
help: 'Path to the Dependabot configuration file',
defaultsTo: '.github/dependabot.yml');

View File

@ -2,17 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:file/file.dart';
import 'package:platform/platform.dart';
import 'common/core.dart';
import 'common/package_looping_command.dart';
import 'common/plugin_utils.dart';
import 'common/process_runner.dart';
import 'common/repository_package.dart';
const int _exitNoPlatformFlags = 2;
@ -25,10 +22,10 @@ const int _chromeDriverPort = 4444;
class DriveExamplesCommand extends PackageLoopingCommand {
/// Creates an instance of the drive command.
DriveExamplesCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
Platform platform = const LocalPlatform(),
}) : super(packagesDir, processRunner: processRunner, platform: platform) {
super.packagesDir, {
super.processRunner,
super.platform,
}) {
argParser.addFlag(platformAndroid,
help: 'Runs the Android implementation of the examples',
aliases: const <String>[platformAndroidAlias]);

View File

@ -3,9 +3,7 @@
// found in the LICENSE file.
import 'package:file/file.dart';
import 'package:git/git.dart';
import 'package:path/path.dart' as p;
import 'package:platform/platform.dart';
import 'package:pub_semver/pub_semver.dart';
import 'common/core.dart';
@ -13,7 +11,6 @@ import 'common/file_utils.dart';
import 'common/git_version_finder.dart';
import 'common/package_looping_command.dart';
import 'common/plugin_utils.dart';
import 'common/process_runner.dart';
import 'common/repository_package.dart';
/// A command to check that PRs don't violate repository best practices that
@ -22,16 +19,11 @@ import 'common/repository_package.dart';
class FederationSafetyCheckCommand extends PackageLoopingCommand {
/// Creates an instance of the safety check command.
FederationSafetyCheckCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
Platform platform = const LocalPlatform(),
GitDir? gitDir,
}) : super(
packagesDir,
processRunner: processRunner,
platform: platform,
gitDir: gitDir,
);
super.packagesDir, {
super.processRunner,
super.platform,
super.gitDir,
});
// A map of package name (as defined by the directory name of the package)
// to a list of changed Dart files in that package, as Posix paths relative to

View File

@ -2,18 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'dart:io' as io;
import 'package:file/file.dart';
import 'package:platform/platform.dart';
import 'package:uuid/uuid.dart';
import 'common/core.dart';
import 'common/gradle.dart';
import 'common/package_looping_command.dart';
import 'common/plugin_utils.dart';
import 'common/process_runner.dart';
import 'common/repository_package.dart';
const int _exitGcloudAuthFailed = 2;
@ -22,10 +19,10 @@ const int _exitGcloudAuthFailed = 2;
class FirebaseTestLabCommand extends PackageLoopingCommand {
/// Creates an instance of the test runner command.
FirebaseTestLabCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
Platform platform = const LocalPlatform(),
}) : super(packagesDir, processRunner: processRunner, platform: platform) {
super.packagesDir, {
super.processRunner,
super.platform,
}) {
argParser.addOption(
'project',
defaultsTo: 'flutter-cirrus',

View File

@ -2,24 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:file/file.dart';
import 'package:platform/platform.dart';
import 'common/core.dart';
import 'common/package_looping_command.dart';
import 'common/process_runner.dart';
import 'common/repository_package.dart';
/// A command to run Dart's "fix" command on packages.
class FixCommand extends PackageLoopingCommand {
/// Creates a fix command instance.
FixCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
Platform platform = const LocalPlatform(),
}) : super(packagesDir, processRunner: processRunner, platform: platform);
super.packagesDir, {
super.processRunner,
super.platform,
});
@override
final String name = 'fix';

View File

@ -8,11 +8,9 @@ import 'dart:io' as io;
import 'package:file/file.dart';
import 'package:http/http.dart' as http;
import 'package:meta/meta.dart';
import 'package:platform/platform.dart';
import 'common/core.dart';
import 'common/package_command.dart';
import 'common/process_runner.dart';
/// In theory this should be 8191, but in practice that was still resulting in
/// "The input line is too long" errors. This was chosen as a value that worked
@ -40,10 +38,10 @@ final Uri _googleFormatterUrl = Uri.https('github.com',
class FormatCommand extends PackageCommand {
/// Creates an instance of the format command.
FormatCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
Platform platform = const LocalPlatform(),
}) : super(packagesDir, processRunner: processRunner, platform: platform) {
super.packagesDir, {
super.processRunner,
super.platform,
}) {
argParser.addFlag('fail-on-change', hide: true);
argParser.addOption('clang-format',
defaultsTo: 'clang-format', help: 'Path to "clang-format" executable.');

View File

@ -18,7 +18,7 @@ final Version minKotlinVersion = Version(1, 7, 10);
/// A command to enforce gradle file conventions and best practices.
class GradleCheckCommand extends PackageLoopingCommand {
/// Creates an instance of the gradle check command.
GradleCheckCommand(Directory packagesDir) : super(packagesDir);
GradleCheckCommand(super.packagesDir);
@override
final String name = 'gradle-check';

View File

@ -3,9 +3,7 @@
// found in the LICENSE file.
import 'package:file/file.dart';
import 'package:git/git.dart';
import 'package:path/path.dart' as p;
import 'package:platform/platform.dart';
import 'common/core.dart';
import 'common/package_command.dart';
@ -107,9 +105,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/// Validates that code files have copyright and license blocks.
class LicenseCheckCommand extends PackageCommand {
/// Creates a new license check command for [packagesDir].
LicenseCheckCommand(Directory packagesDir,
{Platform platform = const LocalPlatform(), GitDir? gitDir})
: super(packagesDir, platform: platform, gitDir: gitDir);
LicenseCheckCommand(super.packagesDir, {super.platform, super.gitDir});
@override
final String name = 'license-check';

View File

@ -2,14 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:file/file.dart';
import 'package:platform/platform.dart';
import 'common/core.dart';
import 'common/gradle.dart';
import 'common/package_looping_command.dart';
import 'common/plugin_utils.dart';
import 'common/process_runner.dart';
import 'common/repository_package.dart';
/// Run 'gradlew lint'.
@ -18,10 +14,10 @@ import 'common/repository_package.dart';
class LintAndroidCommand extends PackageLoopingCommand {
/// Creates an instance of the linter command.
LintAndroidCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
Platform platform = const LocalPlatform(),
}) : super(packagesDir, processRunner: processRunner, platform: platform);
super.packagesDir, {
super.processRunner,
super.platform,
});
@override
final String name = 'lint-android';

View File

@ -3,7 +3,6 @@
// found in the LICENSE file.
import 'package:file/file.dart';
import 'package:platform/platform.dart';
import 'common/package_command.dart';
import 'common/repository_package.dart';
@ -13,9 +12,9 @@ class ListCommand extends PackageCommand {
/// Creates an instance of the list command, whose behavior depends on the
/// 'type' argument it provides.
ListCommand(
Directory packagesDir, {
Platform platform = const LocalPlatform(),
}) : super(packagesDir, platform: platform) {
super.packagesDir, {
super.platform,
}) {
argParser.addOption(
_type,
defaultsTo: _package,

View File

@ -3,7 +3,6 @@
// found in the LICENSE file.
import 'package:file/file.dart';
import 'package:git/git.dart';
import 'package:path/path.dart' as p;
import 'package:pub_semver/pub_semver.dart';
import 'package:pubspec_parse/pubspec_parse.dart';
@ -28,9 +27,9 @@ class MakeDepsPathBasedCommand extends PackageCommand {
/// Creates an instance of the command to convert selected dependencies to
/// path-based.
MakeDepsPathBasedCommand(
Directory packagesDir, {
GitDir? gitDir,
}) : super(packagesDir, gitDir: gitDir) {
super.packagesDir, {
super.gitDir,
}) {
argParser.addMultiOption(_targetDependenciesArg,
help:
'The names of the packages to convert to path-based dependencies.\n'

View File

@ -4,14 +4,12 @@
import 'package:file/file.dart';
import 'package:meta/meta.dart';
import 'package:platform/platform.dart';
import 'common/cmake.dart';
import 'common/core.dart';
import 'common/gradle.dart';
import 'common/package_looping_command.dart';
import 'common/plugin_utils.dart';
import 'common/process_runner.dart';
import 'common/repository_package.dart';
import 'common/xcode.dart';
@ -39,11 +37,10 @@ const String misconfiguredJavaIntegrationTestErrorExplanation =
class NativeTestCommand extends PackageLoopingCommand {
/// Creates an instance of the test command.
NativeTestCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
Platform platform = const LocalPlatform(),
}) : _xcode = Xcode(processRunner: processRunner, log: true),
super(packagesDir, processRunner: processRunner, platform: platform) {
super.packagesDir, {
super.processRunner,
super.platform,
}) : _xcode = Xcode(processRunner: processRunner, log: true) {
argParser.addOption(
_iOSDestinationFlag,
help: 'Specify the destination when running iOS tests.\n'

View File

@ -6,11 +6,9 @@ import 'dart:convert';
import 'dart:io';
import 'package:file/file.dart';
import 'package:platform/platform.dart';
import 'common/core.dart';
import 'common/package_looping_command.dart';
import 'common/process_runner.dart';
import 'common/repository_package.dart';
const int _exitUnsupportedPlatform = 2;
@ -22,10 +20,10 @@ const int _exitPodNotInstalled = 3;
class PodspecCheckCommand extends PackageLoopingCommand {
/// Creates an instance of the linter command.
PodspecCheckCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
Platform platform = const LocalPlatform(),
}) : super(packagesDir, processRunner: processRunner, platform: platform);
super.packagesDir, {
super.processRunner,
super.platform,
});
@override
final String name = 'podspec-check';

View File

@ -6,14 +6,11 @@ import 'dart:async';
import 'dart:convert';
import 'dart:io' as io;
import 'package:file/file.dart';
import 'package:http/http.dart' as http;
import 'package:platform/platform.dart';
import 'package:pub_semver/pub_semver.dart';
import 'common/core.dart';
import 'common/package_looping_command.dart';
import 'common/process_runner.dart';
import 'common/pub_utils.dart';
import 'common/pub_version_finder.dart';
import 'common/repository_package.dart';
@ -22,13 +19,12 @@ import 'common/repository_package.dart';
class PublishCheckCommand extends PackageLoopingCommand {
/// Creates an instance of the publish command.
PublishCheckCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
Platform platform = const LocalPlatform(),
super.packagesDir, {
super.processRunner,
super.platform,
http.Client? httpClient,
}) : _pubVersionFinder =
PubVersionFinder(httpClient: httpClient ?? http.Client()),
super(packagesDir, processRunner: processRunner, platform: platform) {
}) : _pubVersionFinder =
PubVersionFinder(httpClient: httpClient ?? http.Client()) {
argParser.addFlag(
_allowPrereleaseFlag,
help: 'Allows the pre-release SDK warning to pass.\n'

View File

@ -20,7 +20,6 @@ import 'common/file_utils.dart';
import 'common/git_version_finder.dart';
import 'common/package_command.dart';
import 'common/package_looping_command.dart';
import 'common/process_runner.dart';
import 'common/pub_version_finder.dart';
import 'common/repository_package.dart';
@ -49,17 +48,15 @@ class _RemoteInfo {
class PublishCommand extends PackageLoopingCommand {
/// Creates an instance of the publish command.
PublishCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
Platform platform = const LocalPlatform(),
super.packagesDir, {
super.processRunner,
super.platform,
io.Stdin? stdinput,
GitDir? gitDir,
super.gitDir,
http.Client? httpClient,
}) : _pubVersionFinder =
PubVersionFinder(httpClient: httpClient ?? http.Client()),
_stdin = stdinput ?? io.stdin,
super(packagesDir,
platform: platform, processRunner: processRunner, gitDir: gitDir) {
_stdin = stdinput ?? io.stdin {
argParser.addMultiOption(_pubFlagsOption,
help:
'A list of options that will be forwarded on to pub. Separate multiple flags with commas.');

View File

@ -3,16 +3,13 @@
// found in the LICENSE file.
import 'package:file/file.dart';
import 'package:git/git.dart';
import 'package:path/path.dart' as p;
import 'package:platform/platform.dart';
import 'package:pub_semver/pub_semver.dart';
import 'package:pubspec_parse/pubspec_parse.dart';
import 'package:yaml/yaml.dart';
import 'common/core.dart';
import 'common/package_looping_command.dart';
import 'common/process_runner.dart';
import 'common/repository_package.dart';
/// A command to enforce pubspec conventions across the repository.
@ -23,16 +20,11 @@ import 'common/repository_package.dart';
class PubspecCheckCommand extends PackageLoopingCommand {
/// Creates an instance of the version check command.
PubspecCheckCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
Platform platform = const LocalPlatform(),
GitDir? gitDir,
}) : super(
packagesDir,
processRunner: processRunner,
platform: platform,
gitDir: gitDir,
) {
super.packagesDir, {
super.processRunner,
super.platform,
super.gitDir,
}) {
argParser.addOption(
_minMinFlutterVersionFlag,
help:

View File

@ -3,13 +3,10 @@
// found in the LICENSE file.
import 'package:file/file.dart';
import 'package:git/git.dart';
import 'package:platform/platform.dart';
import 'package:yaml/yaml.dart';
import 'common/core.dart';
import 'common/package_looping_command.dart';
import 'common/process_runner.dart';
import 'common/repository_package.dart';
const String _instructionWikiUrl =
@ -19,16 +16,11 @@ const String _instructionWikiUrl =
class ReadmeCheckCommand extends PackageLoopingCommand {
/// Creates an instance of the README check command.
ReadmeCheckCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
Platform platform = const LocalPlatform(),
GitDir? gitDir,
}) : super(
packagesDir,
processRunner: processRunner,
platform: platform,
gitDir: gitDir,
) {
super.packagesDir, {
super.processRunner,
super.platform,
super.gitDir,
}) {
argParser.addFlag(_requireExcerptsArg,
help: 'Require that Dart code blocks be managed by code-excerpt.');
}

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:file/file.dart';
import 'package:yaml/yaml.dart';
import 'package:yaml_edit/yaml_edit.dart';
@ -16,7 +15,7 @@ import 'common/repository_package.dart';
/// clients of the library, but not for development of the library.
class RemoveDevDependenciesCommand extends PackageLoopingCommand {
/// Creates a publish metadata updater command instance.
RemoveDevDependenciesCommand(Directory packagesDir) : super(packagesDir);
RemoveDevDependenciesCommand(super.packagesDir);
@override
final String name = 'remove-dev-dependencies';

View File

@ -12,7 +12,6 @@ import 'package:yaml_edit/yaml_edit.dart';
import 'common/core.dart';
import 'common/package_looping_command.dart';
import 'common/process_runner.dart';
import 'common/pub_utils.dart';
import 'common/pub_version_finder.dart';
import 'common/repository_package.dart';
@ -29,12 +28,11 @@ const int _exitNoTargetVersion = 4;
class UpdateDependencyCommand extends PackageLoopingCommand {
/// Creates an instance of the version check command.
UpdateDependencyCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
super.packagesDir, {
super.processRunner,
http.Client? httpClient,
}) : _pubVersionFinder =
PubVersionFinder(httpClient: httpClient ?? http.Client()),
super(packagesDir, processRunner: processRunner) {
}) : _pubVersionFinder =
PubVersionFinder(httpClient: httpClient ?? http.Client()) {
argParser.addOption(
_pubPackageFlag,
help: 'A pub package to update.',

View File

@ -5,15 +5,12 @@
import 'dart:io' as io;
import 'package:file/file.dart';
import 'package:git/git.dart';
import 'package:meta/meta.dart';
import 'package:platform/platform.dart';
import 'package:yaml/yaml.dart';
import 'package:yaml_edit/yaml_edit.dart';
import 'common/core.dart';
import 'common/package_looping_command.dart';
import 'common/process_runner.dart';
import 'common/pub_utils.dart';
import 'common/repository_package.dart';
@ -21,16 +18,11 @@ import 'common/repository_package.dart';
class UpdateExcerptsCommand extends PackageLoopingCommand {
/// Creates a excerpt updater command instance.
UpdateExcerptsCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
Platform platform = const LocalPlatform(),
GitDir? gitDir,
}) : super(
packagesDir,
processRunner: processRunner,
platform: platform,
gitDir: gitDir,
) {
super.packagesDir, {
super.processRunner,
super.platform,
super.gitDir,
}) {
argParser.addFlag(_failOnChangeFlag, hide: true);
argParser.addFlag(_noCleanupFlag,
help: 'Skips the step of cleaning up the excerpt extraction output. '

View File

@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:file/file.dart';
import 'package:pub_semver/pub_semver.dart';
import 'package:yaml_edit/yaml_edit.dart';
@ -15,7 +14,7 @@ const int _exitUnknownVersion = 3;
/// A command to update the minimum Flutter and Dart SDKs of packages.
class UpdateMinSdkCommand extends PackageLoopingCommand {
/// Creates a publish metadata updater command instance.
UpdateMinSdkCommand(Directory packagesDir) : super(packagesDir) {
UpdateMinSdkCommand(super.packagesDir) {
argParser.addOption(_flutterMinFlag,
mandatory: true,
help: 'The minimum version of Flutter to set SDK constraints to.');

View File

@ -4,7 +4,6 @@
import 'package:args/command_runner.dart';
import 'package:file/file.dart';
import 'package:git/git.dart';
import 'package:pub_semver/pub_semver.dart';
import 'package:yaml_edit/yaml_edit.dart';
@ -36,9 +35,9 @@ enum _ChangelogUpdateState {
class UpdateReleaseInfoCommand extends PackageLoopingCommand {
/// Creates a publish metadata updater command instance.
UpdateReleaseInfoCommand(
Directory packagesDir, {
GitDir? gitDir,
}) : super(packagesDir, gitDir: gitDir) {
super.packagesDir, {
super.gitDir,
}) {
argParser.addOption(_changelogFlag,
mandatory: true,
help: 'The changelog entry to add. '

View File

@ -3,18 +3,15 @@
// found in the LICENSE file.
import 'package:file/file.dart';
import 'package:git/git.dart';
import 'package:http/http.dart' as http;
import 'package:meta/meta.dart';
import 'package:path/path.dart' as p;
import 'package:platform/platform.dart';
import 'package:pub_semver/pub_semver.dart';
import 'common/core.dart';
import 'common/git_version_finder.dart';
import 'common/package_looping_command.dart';
import 'common/package_state_utils.dart';
import 'common/process_runner.dart';
import 'common/pub_version_finder.dart';
import 'common/repository_package.dart';
@ -98,19 +95,13 @@ Map<Version, NextVersionType> getAllowedNextVersions(
class VersionCheckCommand extends PackageLoopingCommand {
/// Creates an instance of the version check command.
VersionCheckCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
Platform platform = const LocalPlatform(),
GitDir? gitDir,
super.packagesDir, {
super.processRunner,
super.platform,
super.gitDir,
http.Client? httpClient,
}) : _pubVersionFinder =
PubVersionFinder(httpClient: httpClient ?? http.Client()),
super(
packagesDir,
processRunner: processRunner,
platform: platform,
gitDir: gitDir,
) {
}) : _pubVersionFinder =
PubVersionFinder(httpClient: httpClient ?? http.Client()) {
argParser.addFlag(
_againstPubFlag,
help: 'Whether the version check should run against the version on pub.\n'

View File

@ -2,13 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:file/file.dart';
import 'package:platform/platform.dart';
import 'common/core.dart';
import 'common/package_looping_command.dart';
import 'common/plugin_utils.dart';
import 'common/process_runner.dart';
import 'common/repository_package.dart';
import 'common/xcode.dart';
@ -16,11 +12,10 @@ import 'common/xcode.dart';
class XcodeAnalyzeCommand extends PackageLoopingCommand {
/// Creates an instance of the test command.
XcodeAnalyzeCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
Platform platform = const LocalPlatform(),
}) : _xcode = Xcode(processRunner: processRunner, log: true),
super(packagesDir, processRunner: processRunner, platform: platform) {
super.packagesDir, {
super.processRunner,
super.platform,
}) : _xcode = Xcode(processRunner: processRunner, log: true) {
argParser.addFlag(platformIOS, help: 'Analyze iOS');
argParser.addFlag(platformMacOS, help: 'Analyze macOS');
argParser.addOption(_minIOSVersionArg,

View File

@ -31,4 +31,4 @@ dev_dependencies:
mockito: '>=5.3.2 <=5.4.0'
environment:
sdk: '>=2.14.0 <4.0.0'
sdk: '>=2.18.0 <4.0.0'

View File

@ -7,11 +7,9 @@ import 'package:file/file.dart';
import 'package:file/memory.dart';
import 'package:flutter_plugin_tools/src/common/core.dart';
import 'package:flutter_plugin_tools/src/common/package_command.dart';
import 'package:flutter_plugin_tools/src/common/process_runner.dart';
import 'package:git/git.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:platform/platform.dart';
import 'package:test/test.dart';
import '../mocks.dart';
@ -1270,13 +1268,12 @@ packages/b_package/lib/src/foo.dart
class SamplePackageCommand extends PackageCommand {
SamplePackageCommand(
Directory packagesDir, {
ProcessRunner processRunner = const ProcessRunner(),
Platform platform = const LocalPlatform(),
GitDir? gitDir,
super.packagesDir, {
super.processRunner,
super.platform,
super.gitDir,
this.includeSubpackages = false,
}) : super(packagesDir,
processRunner: processRunner, platform: platform, gitDir: gitDir);
});
final List<String> plugins = <String>[];

View File

@ -10,10 +10,7 @@ import 'package:file/file.dart';
import 'package:file/memory.dart';
import 'package:flutter_plugin_tools/src/common/core.dart';
import 'package:flutter_plugin_tools/src/common/package_looping_command.dart';
import 'package:flutter_plugin_tools/src/common/process_runner.dart';
import 'package:git/git.dart';
import 'package:mockito/mockito.dart';
import 'package:platform/platform.dart';
import 'package:test/test.dart';
import '../mocks.dart';
@ -852,8 +849,8 @@ void main() {
class TestPackageLoopingCommand extends PackageLoopingCommand {
TestPackageLoopingCommand(
Directory packagesDir, {
required Platform platform,
super.packagesDir, {
required super.platform,
this.hasLongOutput = true,
this.packageLoopingType = PackageLoopingType.topLevelOnly,
this.customFailureListHeader,
@ -862,10 +859,9 @@ class TestPackageLoopingCommand extends PackageLoopingCommand {
this.warnsDuringInit = false,
this.warnsDuringCleanup = false,
this.captureOutput = false,
ProcessRunner processRunner = const ProcessRunner(),
GitDir? gitDir,
}) : super(packagesDir,
processRunner: processRunner, platform: platform, gitDir: gitDir);
super.processRunner,
super.gitDir,
});
final List<String> checkedPackages = <String>[];
final List<String> capturedOutput = <String>[];

View File

@ -223,9 +223,12 @@ void main() {
'plugin',
packagesDir,
platformSupport: <String, PlatformDetails>{
platformLinux: const PlatformDetails(PlatformSupport.inline, hasDartCode: true),
platformMacOS: const PlatformDetails(PlatformSupport.inline, hasDartCode: true),
platformWindows: const PlatformDetails(PlatformSupport.inline, hasDartCode: true),
platformLinux:
const PlatformDetails(PlatformSupport.inline, hasDartCode: true),
platformMacOS:
const PlatformDetails(PlatformSupport.inline, hasDartCode: true),
platformWindows:
const PlatformDetails(PlatformSupport.inline, hasDartCode: true),
},
);