Skip to content

Commit f1f0f24

Browse files
[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.)
1 parent 3eaad3d commit f1f0f24

33 files changed

+124
-235
lines changed

script/tool/lib/src/analyze_command.dart

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,21 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import 'dart:async';
6-
75
import 'package:file/file.dart';
8-
import 'package:platform/platform.dart';
96
import 'package:yaml/yaml.dart';
107

118
import 'common/core.dart';
129
import 'common/package_looping_command.dart';
13-
import 'common/process_runner.dart';
1410
import 'common/repository_package.dart';
1511

1612
/// A command to run Dart analysis on packages.
1713
class AnalyzeCommand extends PackageLoopingCommand {
1814
/// Creates a analysis command instance.
1915
AnalyzeCommand(
20-
Directory packagesDir, {
21-
ProcessRunner processRunner = const ProcessRunner(),
22-
Platform platform = const LocalPlatform(),
23-
}) : super(packagesDir, processRunner: processRunner, platform: platform) {
16+
super.packagesDir, {
17+
super.processRunner,
18+
super.platform,
19+
}) {
2420
argParser.addMultiOption(_customAnalysisFlag,
2521
help:
2622
'Directories (comma separated) that are allowed to have their own '

script/tool/lib/src/build_examples_command.dart

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import 'dart:async';
6-
75
import 'package:file/file.dart';
8-
import 'package:platform/platform.dart';
96
import 'package:yaml/yaml.dart';
107

118
import 'common/core.dart';
129
import 'common/package_looping_command.dart';
1310
import 'common/plugin_utils.dart';
14-
import 'common/process_runner.dart';
1511
import 'common/repository_package.dart';
1612

1713
/// Key for APK.
@@ -45,10 +41,10 @@ const String _flutterBuildTypeAndroidAlias = 'android';
4541
class BuildExamplesCommand extends PackageLoopingCommand {
4642
/// Creates an instance of the build command.
4743
BuildExamplesCommand(
48-
Directory packagesDir, {
49-
ProcessRunner processRunner = const ProcessRunner(),
50-
Platform platform = const LocalPlatform(),
51-
}) : super(packagesDir, processRunner: processRunner, platform: platform) {
44+
super.packagesDir, {
45+
super.processRunner,
46+
super.platform,
47+
}) {
5248
argParser.addFlag(platformLinux);
5349
argParser.addFlag(platformMacOS);
5450
argParser.addFlag(platformWeb);

script/tool/lib/src/common/package_looping_command.dart

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@ import 'dart:async';
66

77
import 'package:colorize/colorize.dart';
88
import 'package:file/file.dart';
9-
import 'package:git/git.dart';
109
import 'package:path/path.dart' as p;
11-
import 'package:platform/platform.dart';
1210
import 'package:pub_semver/pub_semver.dart';
1311

1412
import 'core.dart';
1513
import 'package_command.dart';
16-
import 'process_runner.dart';
1714
import 'repository_package.dart';
1815

1916
/// Enumeration options for package looping commands.
@@ -85,12 +82,11 @@ class PackageResult {
8582
abstract class PackageLoopingCommand extends PackageCommand {
8683
/// Creates a command to operate on [packagesDir] with the given environment.
8784
PackageLoopingCommand(
88-
Directory packagesDir, {
89-
ProcessRunner processRunner = const ProcessRunner(),
90-
Platform platform = const LocalPlatform(),
91-
GitDir? gitDir,
92-
}) : super(packagesDir,
93-
processRunner: processRunner, platform: platform, gitDir: gitDir) {
85+
super.packagesDir, {
86+
super.processRunner,
87+
super.platform,
88+
super.gitDir,
89+
}) {
9490
argParser.addOption(
9591
_skipByFlutterVersionArg,
9692
help: 'Skip any packages that require a Flutter version newer than '

script/tool/lib/src/custom_test_command.dart

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
// found in the LICENSE file.
44

55
import 'package:file/file.dart';
6-
import 'package:platform/platform.dart';
76

87
import 'common/package_looping_command.dart';
9-
import 'common/process_runner.dart';
108
import 'common/pub_utils.dart';
119
import 'common/repository_package.dart';
1210

@@ -21,10 +19,10 @@ const String _legacyScriptName = 'run_tests.sh';
2119
class CustomTestCommand extends PackageLoopingCommand {
2220
/// Creates a custom test command instance.
2321
CustomTestCommand(
24-
Directory packagesDir, {
25-
ProcessRunner processRunner = const ProcessRunner(),
26-
Platform platform = const LocalPlatform(),
27-
}) : super(packagesDir, processRunner: processRunner, platform: platform);
22+
super.packagesDir, {
23+
super.processRunner,
24+
super.platform,
25+
});
2826

2927
@override
3028
final String name = 'custom-test';

script/tool/lib/src/dart_test_command.dart

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,21 @@
33
// found in the LICENSE file.
44

55
import 'package:file/file.dart';
6-
import 'package:platform/platform.dart';
76

87
import 'common/core.dart';
98
import 'common/package_looping_command.dart';
109
import 'common/plugin_utils.dart';
11-
import 'common/process_runner.dart';
1210
import 'common/pub_utils.dart';
1311
import 'common/repository_package.dart';
1412

1513
/// A command to run Dart unit tests for packages.
1614
class DartTestCommand extends PackageLoopingCommand {
1715
/// Creates an instance of the test command.
1816
DartTestCommand(
19-
Directory packagesDir, {
20-
ProcessRunner processRunner = const ProcessRunner(),
21-
Platform platform = const LocalPlatform(),
22-
}) : super(packagesDir, processRunner: processRunner, platform: platform) {
17+
super.packagesDir, {
18+
super.processRunner,
19+
super.platform,
20+
}) {
2321
argParser.addOption(
2422
kEnableExperiment,
2523
defaultsTo: '',

script/tool/lib/src/dependabot_check_command.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import 'dart:async';
6-
75
import 'package:file/file.dart';
8-
import 'package:git/git.dart';
96
import 'package:yaml/yaml.dart';
107

118
import 'common/core.dart';
@@ -15,8 +12,7 @@ import 'common/repository_package.dart';
1512
/// A command to verify Dependabot configuration coverage of packages.
1613
class DependabotCheckCommand extends PackageLoopingCommand {
1714
/// Creates Dependabot check command instance.
18-
DependabotCheckCommand(Directory packagesDir, {GitDir? gitDir})
19-
: super(packagesDir, gitDir: gitDir) {
15+
DependabotCheckCommand(super.packagesDir, {super.gitDir}) {
2016
argParser.addOption(_configPathFlag,
2117
help: 'Path to the Dependabot configuration file',
2218
defaultsTo: '.github/dependabot.yml');

script/tool/lib/src/drive_examples_command.dart

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import 'dart:async';
65
import 'dart:convert';
76
import 'dart:io';
87

98
import 'package:file/file.dart';
10-
import 'package:platform/platform.dart';
119

1210
import 'common/core.dart';
1311
import 'common/package_looping_command.dart';
1412
import 'common/plugin_utils.dart';
15-
import 'common/process_runner.dart';
1613
import 'common/repository_package.dart';
1714

1815
const int _exitNoPlatformFlags = 2;
@@ -25,10 +22,10 @@ const int _chromeDriverPort = 4444;
2522
class DriveExamplesCommand extends PackageLoopingCommand {
2623
/// Creates an instance of the drive command.
2724
DriveExamplesCommand(
28-
Directory packagesDir, {
29-
ProcessRunner processRunner = const ProcessRunner(),
30-
Platform platform = const LocalPlatform(),
31-
}) : super(packagesDir, processRunner: processRunner, platform: platform) {
25+
super.packagesDir, {
26+
super.processRunner,
27+
super.platform,
28+
}) {
3229
argParser.addFlag(platformAndroid,
3330
help: 'Runs the Android implementation of the examples',
3431
aliases: const <String>[platformAndroidAlias]);

script/tool/lib/src/federation_safety_check_command.dart

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@
33
// found in the LICENSE file.
44

55
import 'package:file/file.dart';
6-
import 'package:git/git.dart';
76
import 'package:path/path.dart' as p;
8-
import 'package:platform/platform.dart';
97
import 'package:pub_semver/pub_semver.dart';
108

119
import 'common/core.dart';
1210
import 'common/file_utils.dart';
1311
import 'common/git_version_finder.dart';
1412
import 'common/package_looping_command.dart';
1513
import 'common/plugin_utils.dart';
16-
import 'common/process_runner.dart';
1714
import 'common/repository_package.dart';
1815

1916
/// A command to check that PRs don't violate repository best practices that
@@ -22,16 +19,11 @@ import 'common/repository_package.dart';
2219
class FederationSafetyCheckCommand extends PackageLoopingCommand {
2320
/// Creates an instance of the safety check command.
2421
FederationSafetyCheckCommand(
25-
Directory packagesDir, {
26-
ProcessRunner processRunner = const ProcessRunner(),
27-
Platform platform = const LocalPlatform(),
28-
GitDir? gitDir,
29-
}) : super(
30-
packagesDir,
31-
processRunner: processRunner,
32-
platform: platform,
33-
gitDir: gitDir,
34-
);
22+
super.packagesDir, {
23+
super.processRunner,
24+
super.platform,
25+
super.gitDir,
26+
});
3527

3628
// A map of package name (as defined by the directory name of the package)
3729
// to a list of changed Dart files in that package, as Posix paths relative to

script/tool/lib/src/firebase_test_lab_command.dart

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import 'dart:async';
65
import 'dart:io' as io;
76

87
import 'package:file/file.dart';
9-
import 'package:platform/platform.dart';
108
import 'package:uuid/uuid.dart';
119

1210
import 'common/core.dart';
1311
import 'common/gradle.dart';
1412
import 'common/package_looping_command.dart';
1513
import 'common/plugin_utils.dart';
16-
import 'common/process_runner.dart';
1714
import 'common/repository_package.dart';
1815

1916
const int _exitGcloudAuthFailed = 2;
@@ -22,10 +19,10 @@ const int _exitGcloudAuthFailed = 2;
2219
class FirebaseTestLabCommand extends PackageLoopingCommand {
2320
/// Creates an instance of the test runner command.
2421
FirebaseTestLabCommand(
25-
Directory packagesDir, {
26-
ProcessRunner processRunner = const ProcessRunner(),
27-
Platform platform = const LocalPlatform(),
28-
}) : super(packagesDir, processRunner: processRunner, platform: platform) {
22+
super.packagesDir, {
23+
super.processRunner,
24+
super.platform,
25+
}) {
2926
argParser.addOption(
3027
'project',
3128
defaultsTo: 'flutter-cirrus',

script/tool/lib/src/fix_command.dart

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,18 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import 'dart:async';
6-
7-
import 'package:file/file.dart';
8-
import 'package:platform/platform.dart';
9-
105
import 'common/core.dart';
116
import 'common/package_looping_command.dart';
12-
import 'common/process_runner.dart';
137
import 'common/repository_package.dart';
148

159
/// A command to run Dart's "fix" command on packages.
1610
class FixCommand extends PackageLoopingCommand {
1711
/// Creates a fix command instance.
1812
FixCommand(
19-
Directory packagesDir, {
20-
ProcessRunner processRunner = const ProcessRunner(),
21-
Platform platform = const LocalPlatform(),
22-
}) : super(packagesDir, processRunner: processRunner, platform: platform);
13+
super.packagesDir, {
14+
super.processRunner,
15+
super.platform,
16+
});
2317

2418
@override
2519
final String name = 'fix';

script/tool/lib/src/format_command.dart

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ import 'dart:io' as io;
88
import 'package:file/file.dart';
99
import 'package:http/http.dart' as http;
1010
import 'package:meta/meta.dart';
11-
import 'package:platform/platform.dart';
1211

1312
import 'common/core.dart';
1413
import 'common/package_command.dart';
15-
import 'common/process_runner.dart';
1614

1715
/// In theory this should be 8191, but in practice that was still resulting in
1816
/// "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',
4038
class FormatCommand extends PackageCommand {
4139
/// Creates an instance of the format command.
4240
FormatCommand(
43-
Directory packagesDir, {
44-
ProcessRunner processRunner = const ProcessRunner(),
45-
Platform platform = const LocalPlatform(),
46-
}) : super(packagesDir, processRunner: processRunner, platform: platform) {
41+
super.packagesDir, {
42+
super.processRunner,
43+
super.platform,
44+
}) {
4745
argParser.addFlag('fail-on-change', hide: true);
4846
argParser.addOption('clang-format',
4947
defaultsTo: 'clang-format', help: 'Path to "clang-format" executable.');

script/tool/lib/src/gradle_check_command.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ final Version minKotlinVersion = Version(1, 7, 10);
1818
/// A command to enforce gradle file conventions and best practices.
1919
class GradleCheckCommand extends PackageLoopingCommand {
2020
/// Creates an instance of the gradle check command.
21-
GradleCheckCommand(Directory packagesDir) : super(packagesDir);
21+
GradleCheckCommand(super.packagesDir);
2222

2323
@override
2424
final String name = 'gradle-check';

script/tool/lib/src/license_check_command.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
// found in the LICENSE file.
44

55
import 'package:file/file.dart';
6-
import 'package:git/git.dart';
76
import 'package:path/path.dart' as p;
8-
import 'package:platform/platform.dart';
97

108
import 'common/core.dart';
119
import 'common/package_command.dart';
@@ -107,9 +105,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
107105
/// Validates that code files have copyright and license blocks.
108106
class LicenseCheckCommand extends PackageCommand {
109107
/// Creates a new license check command for [packagesDir].
110-
LicenseCheckCommand(Directory packagesDir,
111-
{Platform platform = const LocalPlatform(), GitDir? gitDir})
112-
: super(packagesDir, platform: platform, gitDir: gitDir);
108+
LicenseCheckCommand(super.packagesDir, {super.platform, super.gitDir});
113109

114110
@override
115111
final String name = 'license-check';

script/tool/lib/src/lint_android_command.dart

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,10 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import 'package:file/file.dart';
6-
import 'package:platform/platform.dart';
7-
85
import 'common/core.dart';
96
import 'common/gradle.dart';
107
import 'common/package_looping_command.dart';
118
import 'common/plugin_utils.dart';
12-
import 'common/process_runner.dart';
139
import 'common/repository_package.dart';
1410

1511
/// Run 'gradlew lint'.
@@ -18,10 +14,10 @@ import 'common/repository_package.dart';
1814
class LintAndroidCommand extends PackageLoopingCommand {
1915
/// Creates an instance of the linter command.
2016
LintAndroidCommand(
21-
Directory packagesDir, {
22-
ProcessRunner processRunner = const ProcessRunner(),
23-
Platform platform = const LocalPlatform(),
24-
}) : super(packagesDir, processRunner: processRunner, platform: platform);
17+
super.packagesDir, {
18+
super.processRunner,
19+
super.platform,
20+
});
2521

2622
@override
2723
final String name = 'lint-android';

0 commit comments

Comments
 (0)