Skip to content

Commit 3872e3d

Browse files
committed
[CQ] (tall-style) dart re-format
1 parent 1c76a87 commit 3872e3d

File tree

6 files changed

+52
-82
lines changed

6 files changed

+52
-82
lines changed

tool/grind.dart

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ void checkUrls() async {
2424
log('checking: $url...');
2525
if (response.statusCode != 200) {
2626
fail(
27-
'$url GET failed: [${response.statusCode}] ${response
28-
.reasonPhrase}');
27+
'$url GET failed: [${response.statusCode}] ${response.reasonPhrase}');
2928
}
3029
}
3130
}
@@ -55,18 +54,19 @@ void outlineIcons() async {
5554
}
5655
}
5756

58-
void _createPng(File sourceSvg,
59-
String targetName, {
60-
required int? size,
61-
bool forLight = false,
62-
}) {
57+
void _createPng(
58+
File sourceSvg,
59+
String targetName, {
60+
required int? size,
61+
bool forLight = false,
62+
}) {
6363
File targetFile = joinFile(sourceSvg.parent, [targetName]);
6464

6565
String color = forLight ? '#7a7a7a' : '#9e9e9e';
6666

6767
String originalContent = sourceSvg.readAsStringSync();
6868
String newContent =
69-
originalContent.replaceAll('<svg ', '<svg fill="$color" ');
69+
originalContent.replaceAll('<svg ', '<svg fill="$color" ');
7070

7171
sourceSvg.writeAsStringSync(newContent);
7272

@@ -80,8 +80,7 @@ void _createPng(File sourceSvg,
8080

8181
if (result.exitCode != 0) {
8282
print(
83-
'Error resizing image with imagemagick: ${result.stdout}\n${result
84-
.stderr}');
83+
'Error resizing image with imagemagick: ${result.stdout}\n${result.stderr}');
8584
exit(1);
8685
}
8786
} finally {

tool/plugin/lib/edit.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Future<int> applyEdits(BuildSpec spec, Future<int> Function() compileFn) async {
4646
// Handle skipped files.
4747
for (String file in spec.filesToSkip) {
4848
final entity =
49-
FileSystemEntity.isFileSync(file) ? File(file) : Directory(file);
49+
FileSystemEntity.isFileSync(file) ? File(file) : Directory(file);
5050
if (entity.existsSync()) {
5151
await entity.rename('$file~');
5252
log('renamed $file');
@@ -82,7 +82,7 @@ Future<int> applyEdits(BuildSpec spec, Future<int> Function() compileFn) async {
8282
for (final file in spec.filesToSkip) {
8383
final name = '$file~';
8484
final entity =
85-
FileSystemEntity.isFileSync(name) ? File(name) : Directory(name);
85+
FileSystemEntity.isFileSync(name) ? File(name) : Directory(name);
8686
if (entity.existsSync()) {
8787
await entity.rename(file);
8888
}
@@ -97,8 +97,7 @@ class EditCommand {
9797
required List<String> initials,
9898
required List<String> replacements,
9999
this.versions = const [],
100-
})
101-
: assert(initials.length == replacements.length),
100+
}) : assert(initials.length == replacements.length),
102101
assert(initials.isNotEmpty),
103102
assert(versions.isNotEmpty),
104103
initials = initials.map(_platformAdaptiveString).toList(),

tool/plugin/lib/plugin.dart

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,11 @@ Future<void> genPluginXml(BuildSpec spec, String destDir, String path) async {
8585
var templatePath =
8686
'${path.substring(0, path.length - '.xml'.length)}_template.xml';
8787
var file =
88-
await File(p.join(rootPath, destDir, path)).create(recursive: true);
88+
await File(p.join(rootPath, destDir, path)).create(recursive: true);
8989
log('writing ${p.relative(file.path)}');
9090
var dest = file.openWrite();
9191
dest.writeln(
92-
"<!-- Do not edit; instead, modify ${p.basename(
93-
templatePath)}, and run './bin/plugin generate'. -->");
92+
"<!-- Do not edit; instead, modify ${p.basename(templatePath)}, and run './bin/plugin generate'. -->");
9493
dest.writeln();
9594
await utf8.decoder
9695
.bind(File(p.join(rootPath, 'resources', templatePath)).openRead())
@@ -111,7 +110,7 @@ bool genPresubmitYaml(List<BuildSpec> specs) {
111110
}
112111

113112
var templateFile =
114-
File(p.join(rootPath, '.github', 'workflows', 'presubmit.yaml.template'));
113+
File(p.join(rootPath, '.github', 'workflows', 'presubmit.yaml.template'));
115114
var templateContents = templateFile.readAsStringSync();
116115
// If we need to make many changes consider something like genPluginXml().
117116
templateContents =
@@ -170,8 +169,7 @@ Future<bool> performReleaseChecks(ProductCommand cmd) async {
170169
return false;
171170
}
172171
if (!cmd.isReleaseValid) {
173-
log('the release identifier ("${cmd
174-
.release}") must be of the form xx.x (major.minor)');
172+
log('the release identifier ("${cmd.release}") must be of the form xx.x (major.minor)');
175173
return false;
176174
}
177175
var gitDir = await GitDir.fromExisting(rootPath);
@@ -180,7 +178,7 @@ Future<bool> performReleaseChecks(ProductCommand cmd) async {
180178
var branch = await gitDir.currentBranch();
181179
var name = branch.branchName;
182180
var expectedName =
183-
cmd.isDevChannel ? 'master' : "release_${cmd.releaseMajor}";
181+
cmd.isDevChannel ? 'master' : "release_${cmd.releaseMajor}";
184182
var result = name == expectedName;
185183
if (!result) {
186184
result = name.startsWith("release_${cmd.releaseMajor}") &&
@@ -203,23 +201,22 @@ Future<bool> performReleaseChecks(ProductCommand cmd) async {
203201
}
204202
// Finally, check that a jxbrowser.properties exists
205203
var jxBrowserFile =
206-
File(p.join(rootPath, 'resources', 'jxbrowser', 'jxbrowser.properties'));
204+
File(p.join(rootPath, 'resources', 'jxbrowser', 'jxbrowser.properties'));
207205
var jxBrowserFileContents = jxBrowserFile.readAsStringSync();
208206
if (jxBrowserFile.existsSync() &&
209207
jxBrowserFileContents.isNotEmpty &&
210208
jxBrowserFileContents.contains('jxbrowser.license.key=') &&
211209
!jxBrowserFileContents.contains('jxbrowser.license.key=<KEY>')) {
212210
return true;
213211
} else {
214-
log(
215-
'Release mode requires the jxbrowser.properties file to exist and include a key.');
212+
log('Release mode requires the jxbrowser.properties file to exist and include a key.');
216213
}
217214
return false;
218215
}
219216

220217
List<Map<String, Object?>> readProductMatrix() {
221218
var contents =
222-
File(p.join(rootPath, 'product-matrix.json')).readAsStringSync();
219+
File(p.join(rootPath, 'product-matrix.json')).readAsStringSync();
223220
var map = json.decode(contents);
224221
return (map['list'] as List<Object?>).cast<Map<String, Object?>>();
225222
}
@@ -239,8 +236,8 @@ String substituteTemplateVariables(String line, BuildSpec spec) {
239236
case 'CHANGELOG':
240237
return spec.changeLog;
241238
case 'DEPEND':
242-
// If found, this is the module that triggers loading the Android Studio
243-
// support. The public sources and the installable plugin use different ones.
239+
// If found, this is the module that triggers loading the Android Studio
240+
// support. The public sources and the installable plugin use different ones.
244241
return spec.isSynthetic
245242
? 'com.intellij.modules.androidstudio'
246243
: 'com.android.tools.apk';
@@ -523,11 +520,7 @@ https://plugins.jetbrains.com/plugin/uploadPlugin
523520
log('Upload failed: ${processResult.stderr} for file: $filePath');
524521
}
525522
final out = processResult.stdout as String;
526-
var message = out
527-
.trim()
528-
.split('\n')
529-
.last
530-
.trim();
523+
var message = out.trim().split('\n').last.trim();
531524
log(message);
532525
return processResult.exitCode;
533526
}
@@ -548,9 +541,9 @@ class GenerateCommand extends ProductCommand {
548541
@override
549542
String get description =>
550543
'Generate plugin.xml, .github/workflows/presubmit.yaml, '
551-
'and resources/liveTemplates/flutter_miscellaneous.xml files for the '
552-
'Flutter plugin.\nThe plugin.xml.template and product-matrix.json are '
553-
'used as input.';
544+
'and resources/liveTemplates/flutter_miscellaneous.xml files for the '
545+
'Flutter plugin.\nThe plugin.xml.template and product-matrix.json are '
546+
'used as input.';
554547

555548
@override
556549
Future<int> doit() async {
@@ -578,7 +571,7 @@ class GenerateCommand extends ProductCommand {
578571
.cast<File>()
579572
.toList();
580573
final templateFile =
581-
File(p.join('resources', 'liveTemplates', 'flutter_miscellaneous.xml'));
574+
File(p.join('resources', 'liveTemplates', 'flutter_miscellaneous.xml'));
582575
var contents = templateFile.readAsStringSync();
583576

584577
log('writing ${p.relative(templateFile.path)}');
@@ -596,8 +589,7 @@ class GenerateCommand extends ProductCommand {
596589
final regexp = RegExp('<template name="$name" value="([^"]+)"');
597590
final match = regexp.firstMatch(contents);
598591
if (match == null) {
599-
throw 'No entry found for "$name" live template in ${templateFile
600-
.path}';
592+
throw 'No entry found for "$name" live template in ${templateFile.path}';
601593
}
602594

603595
// Replace the existing content in the xml live template file with the

tool/plugin/lib/runner.dart

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import 'util.dart';
1313
class BuildCommandRunner extends CommandRunner<int> {
1414
BuildCommandRunner()
1515
: super('plugin',
16-
'A script to build, test, and deploy the Flutter IntelliJ plugin.') {
16+
'A script to build, test, and deploy the Flutter IntelliJ plugin.') {
1717
argParser.addOption(
1818
'release',
1919
abbr: 'r',
@@ -30,9 +30,9 @@ class BuildCommandRunner extends CommandRunner<int> {
3030

3131
void writeJxBrowserKeyToFile() {
3232
final jxBrowserKey =
33-
readTokenFromKeystore('FLUTTER_KEYSTORE_JXBROWSER_KEY_NAME');
33+
readTokenFromKeystore('FLUTTER_KEYSTORE_JXBROWSER_KEY_NAME');
3434
final propertiesFile =
35-
File("$rootPath/resources/jxbrowser/jxbrowser.properties");
35+
File("$rootPath/resources/jxbrowser/jxbrowser.properties");
3636
if (jxBrowserKey.isNotEmpty) {
3737
final contents = '''
3838
jxbrowser.license.key=$jxBrowserKey
@@ -47,10 +47,12 @@ jxbrowser.license.key=$jxBrowserKey
4747
['buildPlugin', '--stacktrace'], spec, version, 'false');
4848
}
4949

50-
Future<int> runGradleCommand(List<String> command,
51-
BuildSpec spec,
52-
String version,
53-
String testing,) async {
50+
Future<int> runGradleCommand(
51+
List<String> command,
52+
BuildSpec spec,
53+
String version,
54+
String testing,
55+
) async {
5456
final contents = '''
5557
name = "flutter-intellij
5658
buildSpec=${spec.version}

tool/plugin/lib/util.dart

Lines changed: 12 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Future<String> makeDevLog(BuildSpec spec) async {
3333
var gitDir = await GitDir.fromExisting(rootPath);
3434
var since = lastReleaseName;
3535
var processResult =
36-
await gitDir.runCommand(['log', '--oneline', '$since..HEAD']);
36+
await gitDir.runCommand(['log', '--oneline', '$since..HEAD']);
3737
String out = processResult.stdout as String;
3838
var messages = out.trim().split('\n');
3939
var devLog = StringBuffer();
@@ -51,46 +51,30 @@ Future<DateTime> dateOfLastRelease() async {
5151
var processResult = await gitDir
5252
.runCommand(['branch', '--list', '-v', '--no-abbrev', lastReleaseName]);
5353
String out = processResult.stdout as String;
54-
var logLine = out
55-
.trim()
56-
.split('\n')
57-
.first
58-
.trim();
54+
var logLine = out.trim().split('\n').first.trim();
5955
var match =
60-
RegExp(r'release_\d+\s+([A-Fa-f\d]{40})\s').matchAsPrefix(logLine);
56+
RegExp(r'release_\d+\s+([A-Fa-f\d]{40})\s').matchAsPrefix(logLine);
6157
var commitHash = match!.group(1);
6258
processResult =
63-
await gitDir.runCommand(['show', '--pretty=tformat:"%cI"', commitHash!]);
59+
await gitDir.runCommand(['show', '--pretty=tformat:"%cI"', commitHash!]);
6460
out = processResult.stdout as String;
65-
var date = out
66-
.trim()
67-
.split('\n')
68-
.first
69-
.trim();
61+
var date = out.trim().split('\n').first.trim();
7062
return DateTime.parse(date.replaceAll('"', ''));
7163
}
7264

7365
Future<String> lastRelease() async {
7466
_checkGitDir();
7567
var gitDir = await GitDir.fromExisting(rootPath);
7668
var processResult =
77-
await gitDir.runCommand(['branch', '--list', 'release_*']);
69+
await gitDir.runCommand(['branch', '--list', 'release_*']);
7870
String out = processResult.stdout as String;
79-
var release = out
80-
.trim()
81-
.split('\n')
82-
.last
83-
.trim();
71+
var release = out.trim().split('\n').last.trim();
8472
if (release.isNotEmpty) return release;
8573
processResult =
86-
await gitDir.runCommand(['branch', '--list', '-a', '*release_*']);
74+
await gitDir.runCommand(['branch', '--list', '-a', '*release_*']);
8775
out = processResult.stdout as String;
8876
var remote =
89-
out
90-
.trim()
91-
.split('\n')
92-
.last
93-
.trim(); // "remotes/origin/release_43"
77+
out.trim().split('\n').last.trim(); // "remotes/origin/release_43"
9478
release = remote.substring(remote.lastIndexOf('/') + 1);
9579
await gitDir.runCommand(['branch', '--track', release, remote]);
9680
return release;
@@ -125,12 +109,7 @@ Future<void> removeAll(String dir) async {
125109
}
126110

127111
bool isNewer(FileSystemEntity newer, FileSystemEntity older) {
128-
return newer
129-
.statSync()
130-
.modified
131-
.isAfter(older
132-
.statSync()
133-
.modified);
112+
return newer.statSync().modified.isAfter(older.statSync().modified);
134113
}
135114

136115
void _checkGitDir() async {
@@ -163,9 +142,7 @@ int get devBuildNumber {
163142
// The dev channel is automatically refreshed weekly, so the build number
164143
// is just the number of weeks since the last stable release.
165144
var today = DateTime.now();
166-
var daysSinceRelease = today
167-
.difference(lastReleaseDate)
168-
.inDays;
145+
var daysSinceRelease = today.difference(lastReleaseDate).inDays;
169146
var weekNumber = daysSinceRelease ~/ 7 + 1;
170147
return weekNumber;
171148
}
@@ -185,7 +162,7 @@ String buildVersionNumber(BuildSpec spec) {
185162

186163
String _nextRelease() {
187164
var current =
188-
RegExp(r'release_(\d+)').matchAsPrefix(lastReleaseName)!.group(1);
165+
RegExp(r'release_(\d+)').matchAsPrefix(lastReleaseName)!.group(1);
189166
var val = int.parse(current!) + 1;
190167
return '$val.0';
191168
}

tool/plugin/lib/verify.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ class VerifyCommand extends ProductCommand {
6565
}
6666
log('\nverifyPlugin for $spec:');
6767
result =
68-
await runner.runGradleCommand(['verifyPlugin'], spec, '1', 'false');
68+
await runner.runGradleCommand(['verifyPlugin'], spec, '1', 'false');
6969
if (result != 0) {
7070
return result;
7171
}
7272
}
7373

74-
var verifiedVersions = buildSpecs.map((spec) => spec.name).toList().join(', ');
74+
var verifiedVersions =
75+
buildSpecs.map((spec) => spec.name).toList().join(', ');
7576
log('\nVerification of the ${buildSpecs.length} builds was '
7677
'successful: $verifiedVersions.');
7778
return result;

0 commit comments

Comments
 (0)