Skip to content

Commit

Permalink
Add an argument only-version to the verify cli command (#7796)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwren authored Nov 19, 2024
1 parent 271a568 commit c4f635a
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions tool/plugin/lib/verify.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,55 @@ class VerifyCommand extends ProductCommand {
@override
final BuildCommandRunner runner;

VerifyCommand(this.runner) : super('verify');
VerifyCommand(this.runner) : super('verify') {
argParser.addOption('only-version',
abbr: 'o',
help: 'Only verify the specified IntelliJ version; useful for sharding '
'builds on CI systems.');
}

@override
String get description =>
'Execute the verifyPlugin and verifyPluginConfiguration Gradle tasks for each build spec.';
'Execute the verify Gradle tasks for each build spec.';

@override
Future<int> doit() async {
final argResults = this.argResults!;

// Check to see if we should only be building a specific version.
// (this only-version logic was copied from the make command in plugin.dart)
final onlyVersion = argResults.option('only-version');

var buildSpecs = specs;
if (onlyVersion != null && onlyVersion.isNotEmpty) {
buildSpecs = specs.where((spec) => spec.version == onlyVersion).toList();
if (buildSpecs.isEmpty) {
log("No spec found for version '$onlyVersion'");
return 1;
}
}

// run './gradlew verifyPluginProjectConfiguration'
// run './gradlew verifyPluginStructure'
// run './gradlew verifyPluginSignature'
// run './gradlew verifyPlugin'
var result = 0;
for (var spec in specs) {
for (var spec in buildSpecs) {
log('\nverifyPluginProjectConfiguration for $spec:');
result = await runner
.runGradleCommand(['verifyPluginProjectConfiguration'], spec, '1', 'false');
result = await runner.runGradleCommand(
['verifyPluginProjectConfiguration'], spec, '1', 'false');
if (result != 0) {
return result;
}
log('\nverifyPluginStructure for $spec:');
result =
await runner.runGradleCommand(['verifyPluginStructure'], spec, '1', 'false');
result = await runner
.runGradleCommand(['verifyPluginStructure'], spec, '1', 'false');
if (result != 0) {
return result;
}
log('\nverifyPluginSignature for $spec:');
result =
await runner.runGradleCommand(['verifyPluginSignature'], spec, '1', 'false');
result = await runner
.runGradleCommand(['verifyPluginSignature'], spec, '1', 'false');
if (result != 0) {
return result;
}
Expand All @@ -50,7 +70,8 @@ class VerifyCommand extends ProductCommand {
return result;
}
}
log('\nSummary: verification of all ${specs
// TODO (jwren) improve logging by listing out the idea versions verified:
log('\nSummary: verification of all ${buildSpecs
.length} build specifications was successful.');
return result;
}
Expand Down

0 comments on commit c4f635a

Please sign in to comment.