Skip to content

Commit da74d29

Browse files
authored
Run the tool/plugin/ dart files through dart format (#8270)
1 parent db6615c commit da74d29

File tree

5 files changed

+49
-56
lines changed

5 files changed

+49
-56
lines changed

tool/plugin/lib/build_spec.dart

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,21 @@ class BuildSpec {
3838
String? _changeLog;
3939

4040
BuildSpec.fromJson(Map<String, Object?> json, this.release)
41-
: name = json['name'] as String,
42-
channel = json['channel'] as String,
43-
version = json['version'] as String,
44-
ijVersion = json['ijVersion'] as String?,
45-
ideaProduct = json['ideaProduct'] as String,
46-
ideaVersion = json['ideaVersion'] as String,
47-
baseVersion = (json['baseVersion'] ?? json['ideaVersion']) as String,
48-
androidPluginVersion = json['androidPluginVersion'] as String,
49-
dartPluginVersion = json['dartPluginVersion'] as String,
50-
sinceBuild = json['sinceBuild'] as String,
51-
untilBuild = json['untilBuild'] as String,
52-
filesToSkip = json['filesToSkip'] as List<String>? ?? [],
53-
isUnitTestTarget = json['isUnitTestTarget'] == 'true',
54-
isTestTarget = json['isTestTarget'] == 'true',
55-
javaVersion = json['javaVersion'] as String;
41+
: name = json['name'] as String,
42+
channel = json['channel'] as String,
43+
version = json['version'] as String,
44+
ijVersion = json['ijVersion'] as String?,
45+
ideaProduct = json['ideaProduct'] as String,
46+
ideaVersion = json['ideaVersion'] as String,
47+
baseVersion = (json['baseVersion'] ?? json['ideaVersion']) as String,
48+
androidPluginVersion = json['androidPluginVersion'] as String,
49+
dartPluginVersion = json['dartPluginVersion'] as String,
50+
sinceBuild = json['sinceBuild'] as String,
51+
untilBuild = json['untilBuild'] as String,
52+
filesToSkip = json['filesToSkip'] as List<String>? ?? [],
53+
isUnitTestTarget = json['isUnitTestTarget'] == 'true',
54+
isTestTarget = json['isTestTarget'] == 'true',
55+
javaVersion = json['javaVersion'] as String;
5656

5757
bool get copyIjVersion => isAndroidStudio && ijVersion != null;
5858

tool/plugin/lib/edit.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ class EditCommand {
9797
required List<String> initials,
9898
required List<String> replacements,
9999
this.versions = const [],
100-
}) : assert(initials.length == replacements.length),
101-
assert(initials.isNotEmpty),
102-
assert(versions.isNotEmpty),
103-
initials = initials.map(_platformAdaptiveString).toList(),
104-
replacements = replacements.map(_platformAdaptiveString).toList();
100+
}) : assert(initials.length == replacements.length),
101+
assert(initials.isNotEmpty),
102+
assert(versions.isNotEmpty),
103+
initials = initials.map(_platformAdaptiveString).toList(),
104+
replacements = replacements.map(_platformAdaptiveString).toList();
105105

106106
/// The target file path.
107107
final String path;

tool/plugin/lib/plugin.dart

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,7 @@ Future<bool> performReleaseChecks(ProductCommand cmd) async {
193193
cmd.isDevChannel ? 'master' : "release_${cmd.releaseMajor}";
194194
var result = name == expectedName;
195195
if (!result) {
196-
result =
197-
name.startsWith("release_${cmd.releaseMajor}") &&
196+
result = name.startsWith("release_${cmd.releaseMajor}") &&
198197
name.lastIndexOf(RegExp(r"\.[0-9]")) == name.length - 2;
199198
}
200199
if (result) {
@@ -319,15 +318,13 @@ class GradleBuildCommand extends ProductCommand {
319318
argParser.addOption(
320319
'only-version',
321320
abbr: 'o',
322-
help:
323-
'Only build the specified IntelliJ version; useful for sharding '
321+
help: 'Only build the specified IntelliJ version; useful for sharding '
324322
'builds on CI systems.',
325323
);
326324
argParser.addFlag(
327325
'unpack',
328326
abbr: 'u',
329-
help:
330-
'Unpack the artifact files during provisioning, '
327+
help: 'Unpack the artifact files during provisioning, '
331328
'even if the cache appears fresh.\n'
332329
'This flag is ignored if --release is given.',
333330
defaultsTo: false,
@@ -341,8 +338,7 @@ class GradleBuildCommand extends ProductCommand {
341338
}
342339

343340
@override
344-
String get description =>
345-
'Build a deployable version of the Flutter plugin, '
341+
String get description => 'Build a deployable version of the Flutter plugin, '
346342
'compiled against the specified artifacts.';
347343

348344
@override
@@ -598,13 +594,12 @@ class GenerateCommand extends ProductCommand {
598594

599595
void generateLiveTemplates() {
600596
// Find all the live templates.
601-
final templateFragments =
602-
Directory(p.join('resources', 'liveTemplates'))
603-
.listSync()
604-
.whereType<File>()
605-
.where((file) => p.extension(file.path) == '.txt')
606-
.cast<File>()
607-
.toList();
597+
final templateFragments = Directory(p.join('resources', 'liveTemplates'))
598+
.listSync()
599+
.whereType<File>()
600+
.where((file) => p.extension(file.path) == '.txt')
601+
.cast<File>()
602+
.toList();
608603
final templateFile = File(
609604
p.join('resources', 'liveTemplates', 'flutter_miscellaneous.xml'),
610605
);
@@ -632,8 +627,7 @@ class GenerateCommand extends ProductCommand {
632627
// content from the template $name.txt file.
633628
final matchString = match.group(1);
634629
final matchStart = contents.indexOf(matchString!);
635-
contents =
636-
contents.substring(0, matchStart) +
630+
contents = contents.substring(0, matchStart) +
637631
replaceContents +
638632
contents.substring(matchStart + matchString.length);
639633
}
@@ -746,10 +740,9 @@ abstract class ProductCommand extends Command<int> {
746740
}
747741

748742
String releasesFilePath(BuildSpec spec) {
749-
var subDir =
750-
isReleaseMode
751-
? 'release_$releaseMajor'
752-
: (spec.channel == "stable" ? 'release_master' : 'release_dev');
743+
var subDir = isReleaseMode
744+
? 'release_$releaseMajor'
745+
: (spec.channel == "stable" ? 'release_master' : 'release_dev');
753746
var filePath = p.join(
754747
rootPath,
755748
'releases',
@@ -875,10 +868,9 @@ class RenamePackageCommand extends ProductCommand {
875868
baseDir = p.join(baseDir, 'flutter-studio/src');
876869
}
877870
oldName = argResults.option('package')!;
878-
newName =
879-
argResults.wasParsed('new-name')
880-
? argResults.option('new-name')!
881-
: oldName + argResults.option('append')!;
871+
newName = argResults.wasParsed('new-name')
872+
? argResults.option('new-name')!
873+
: oldName + argResults.option('append')!;
882874
if (oldName == newName) {
883875
log('Nothing to do; new name is same as old name');
884876
return 1;

tool/plugin/lib/verify.dart

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ class VerifyCommand extends ProductCommand {
1515
argParser.addOption(
1616
'only-version',
1717
abbr: 'o',
18-
help:
19-
'Only verify the specified IntelliJ version; useful for sharding '
18+
help: 'Only verify the specified IntelliJ version; useful for sharding '
2019
'builds on CI systems.',
2120
);
2221
}
@@ -90,10 +89,8 @@ class VerifyCommand extends ProductCommand {
9089
}
9190
}
9291

93-
var verifiedVersions = buildSpecs
94-
.map((spec) => spec.name)
95-
.toList()
96-
.join(', ');
92+
var verifiedVersions =
93+
buildSpecs.map((spec) => spec.name).toList().join(', ');
9794
log(
9895
'\nVerification of the ${buildSpecs.length} builds was '
9996
'successful: $verifiedVersions.',

tool/plugin/test/plugin_test.dart

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,15 @@ void main() {
144144
test('clean', () async {
145145
var dir = Directory.current;
146146
var runner = makeTestRunner();
147-
await runner
148-
.run(["-r=19", "-d../..", "deploy", "--no-as", "--no-ij"])
149-
.whenComplete(() {
150-
expect(Directory.current.path, equals(dir.path));
151-
});
147+
await runner.run([
148+
"-r=19",
149+
"-d../..",
150+
"deploy",
151+
"--no-as",
152+
"--no-ij"
153+
]).whenComplete(() {
154+
expect(Directory.current.path, equals(dir.path));
155+
});
152156
});
153157

154158
test('without --release', () async {

0 commit comments

Comments
 (0)