Skip to content

Commit

Permalink
Re-enable the verify Gradle task and have Kokoro run it again (#7785)
Browse files Browse the repository at this point in the history
This is follow-up work for
#7774 and
#7670
  • Loading branch information
jwren authored Nov 15, 2024
1 parent 8293462 commit 0485342
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 82 deletions.
88 changes: 54 additions & 34 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import org.jetbrains.intellij.platform.gradle.models.ProductRelease
import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion

Expand Down Expand Up @@ -68,12 +69,17 @@ java {

dependencies {
intellijPlatform {
// Documentation on the create(...) methods:
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#custom-target-platforms
if (ideaProduct == "android-studio") {
create(IntelliJPlatformType.AndroidStudio, ideaVersion)
} else {//if (ide == "ideaIC") {
create(IntelliJPlatformType.IntellijIdeaCommunity, ideaVersion)
}
testFramework(TestFrameworkType.Platform)

// Plugin dependnecy documentation:
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#plugins
val bundledPluginList = mutableListOf(
"com.intellij.java",
"com.intellij.properties",
Expand Down Expand Up @@ -103,42 +109,56 @@ dependencies {
// Please ensure the `instrumentationTools()` entry is present in the project dependencies section along with the `intellijDependencies()` entry in the repositories section.
// See: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
instrumentationTools()
// pluginVerifier()
pluginVerifier()
}
}

intellijPlatform {
pluginConfiguration {
version = flutterPluginVersion
ideaVersion {
sinceBuild = sinceBuildInput
untilBuild = untilBuildInput
}
}

// Verifier documentation
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html#intellijPlatform-pluginVerification
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html#intellijPlatform-pluginVerification-ides
pluginVerification {
// https://github.com/JetBrains/intellij-plugin-verifier/?tab=readme-ov-file#specific-options
// https://github.com/JetBrains/intellij-plugin-verifier
cliPath = file("../third_party/lib/verifier-cli-1.379-all.jar")
failureLevel = listOf(
VerifyPluginTask.FailureLevel.EXPERIMENTAL_API_USAGES,
// VerifyPluginTask.FailureLevel.PLUGIN_STRUCTURE_WARNINGS,
VerifyPluginTask.FailureLevel.INVALID_PLUGIN,
)
verificationReportsFormats = VerifyPluginTask.VerificationReportsFormats.ALL
subsystemsToCheck = VerifyPluginTask.Subsystems.ALL
// Mute and freeArgs documentation
// https://github.com/JetBrains/intellij-plugin-verifier/?tab=readme-ov-file#specific-options
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-faq.html#mutePluginVerifierProblems
freeArgs = listOf(
"-mute",
"TemplateWordInPluginId,ForbiddenPluginIdPrefix,TemplateWordInPluginName"
)
ides {
if (ideaProduct == "android-studio") {
ide(IntelliJPlatformType.AndroidStudio, ideaVersion)
} else {
ide(IntelliJPlatformType.IntellijIdeaCommunity, ideaVersion)
}
recommended()
// select {
// types = listOf(IntelliJPlatformType.AndroidStudio)
// channels = listOf(ProductRelease.Channel.RELEASE)
// sinceBuild = sinceBuildInput
// untilBuild = untilBuildInput
// }
}
}
}
//intellijPlatform {
// pluginConfiguration {
// version = flutterPluginVersion
// ideaVersion {
// sinceBuild = sinceBuildInput
// untilBuild = untilBuildInput
// }
// }
// // TODO (jwren) get the verifier to work, and enable in the github presubmit,
// // the com.teamdev dep is having the verifier fail
// // Verifier documentation: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html#intellijPlatform-pluginVerification-ides
// pluginVerification {
// // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-faq.html#mutePluginVerifierProblems
// freeArgs = listOf(
// "-mute",
// "TemplateWordInPluginId"
// )
// ides {
// if (ideaProduct == "android-studio") {
// ide(IntelliJPlatformType.AndroidStudio, ideaVersion)
// } else {
// ide(IntelliJPlatformType.IntellijIdeaCommunity, ideaVersion)
// }
// recommended()
//// select {
//// types = listOf(IntelliJPlatformType.AndroidStudio)
//// channels = listOf(ProductRelease.Channel.RELEASE)
//// sinceBuild = sinceBuildInput
//// untilBuild = untilBuildInput
//// }
// }
// }
//}

// Documentation for printProductsReleases:
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-faq.html#how-to-check-the-latest-available-eap-release
Expand Down
73 changes: 47 additions & 26 deletions flutter-idea/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion

Expand Down Expand Up @@ -49,12 +50,17 @@ java {

dependencies {
intellijPlatform {
// Documentation on the create(...) methods:
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#custom-target-platforms
if (ideaProduct == "android-studio") {
create(IntelliJPlatformType.AndroidStudio, ideaVersion)
} else { // if (ideaProduct == "IC") {
create(IntelliJPlatformType.IntellijIdeaCommunity, ideaVersion)
}
testFramework(TestFrameworkType.Platform)

// Plugin dependnecy documentation:
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#plugins
val bundledPluginList = mutableListOf(
"com.intellij.java",
"com.intellij.properties",
Expand Down Expand Up @@ -84,7 +90,7 @@ dependencies {
// Please ensure the `instrumentationTools()` entry is present in the project dependencies section along with the `intellijDependencies()` entry in the repositories section.
// See: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
instrumentationTools()
// pluginVerifier()
pluginVerifier()
}
}

Expand All @@ -96,30 +102,43 @@ intellijPlatform {
untilBuild = untilBuildInput
}
}
// TODO (jwren) get the verifier to work, and enable in the github presubmit,
// the com.teamdev dep is having the verifier fail
// Verifier documentation: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html#intellijPlatform-pluginVerification-ides
// pluginVerification {
// // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-faq.html#mutePluginVerifierProblems
// freeArgs = listOf(
// "-mute",
// "TemplateWordInPluginId"
// )
// ides {
// if (ideaProduct == "android-studio") {
// ide(IntelliJPlatformType.AndroidStudio, ideaVersion)
// } else {
// ide(IntelliJPlatformType.IntellijIdeaCommunity, ideaVersion)
// }
// recommended()
//// select {
//// types = listOf(IntelliJPlatformType.AndroidStudio)
//// channels = listOf(ProductRelease.Channel.RELEASE)
//// sinceBuild = sinceBuildInput
//// untilBuild = untilBuildInput
//// }
// }
// }

// Verifier documentation
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html#intellijPlatform-pluginVerification
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html#intellijPlatform-pluginVerification-ides
pluginVerification {
// https://github.com/JetBrains/intellij-plugin-verifier/?tab=readme-ov-file#specific-options
// https://github.com/JetBrains/intellij-plugin-verifier
cliPath = file("../third_party/lib/verifier-cli-1.379-all.jar")
failureLevel = listOf(
VerifyPluginTask.FailureLevel.EXPERIMENTAL_API_USAGES,
// VerifyPluginTask.FailureLevel.PLUGIN_STRUCTURE_WARNINGS,
VerifyPluginTask.FailureLevel.INVALID_PLUGIN,
)
verificationReportsFormats = VerifyPluginTask.VerificationReportsFormats.ALL
subsystemsToCheck = VerifyPluginTask.Subsystems.ALL
// Mute and freeArgs documentation
// https://github.com/JetBrains/intellij-plugin-verifier/?tab=readme-ov-file#specific-options
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-faq.html#mutePluginVerifierProblems
freeArgs = listOf(
"-mute",
"TemplateWordInPluginId,ForbiddenPluginIdPrefix,TemplateWordInPluginName"
)
ides {
if (ideaProduct == "android-studio") {
ide(IntelliJPlatformType.AndroidStudio, ideaVersion)
} else {
ide(IntelliJPlatformType.IntellijIdeaCommunity, ideaVersion)
}
recommended()
// select {
// types = listOf(IntelliJPlatformType.AndroidStudio)
// channels = listOf(ProductRelease.Channel.RELEASE)
// sinceBuild = sinceBuildInput
// untilBuild = untilBuildInput
// }
}
}
}

dependencies {
Expand Down Expand Up @@ -154,11 +173,13 @@ dependencies {
compileOnly("com.google.code.gson:gson:2.10.1")
testImplementation("com.google.guava:guava:32.0.0-jre")
testImplementation("com.google.code.gson:gson:2.10.1")
testImplementation("junit:junit:4.13.2")
runtimeOnly(fileTree(mapOf("dir" to "${project.rootDir}/third_party/lib/jxbrowser",
"include" to listOf("*.jar"))))
compileOnly(fileTree(mapOf("dir" to "${project.rootDir}/third_party/lib/jxbrowser",
"include" to listOf("*.jar"))))
testImplementation(fileTree(mapOf("dir" to "${project.rootDir}/third_party/lib/jxbrowser",
"include" to listOf("*.jar"))))
testImplementation("junit:junit:4.13.2")
}

sourceSets {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,27 @@ private static boolean getFirstAsBoolean(@NotNull Pair<String, VirtualFile> pair
return Boolean.parseBoolean(pair.getFirst());
}

@NotNull
public static Notification showDexOptionNotification(@NotNull Module module, @NotNull String propertyName) {
Project project = module.getProject();
Notification notification = NotificationGroupManager.getInstance().getNotificationGroup("Android Module Importing").createNotification(
AndroidBundle.message("android.facet.importing.title", module.getName()),
"'" + propertyName +
"' property is detected in " + SdkConstants.FN_PROJECT_PROPERTIES +
" file.<br>You may enable related option in <a href='configure'>Settings | Compiler | Android DX</a>",
NotificationType.INFORMATION).setListener(new NotificationListener.Adapter() {
@Override
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
notification.expire();
ShowSettingsUtil.getInstance().showSettingsDialog(
project, AndroidBundle.message("android.dex.compiler.configurable.display.name"));
}
});
notification.notify(project);
return notification;
}
// TODO(jwren) Add this support back into the plugin or delete the code
// Method is current dead when uncommented, commented out for the `./bin/plugin verify` command
//@NotNull
//public static Notification showDexOptionNotification(@NotNull Module module, @NotNull String propertyName) {
// Project project = module.getProject();
// Notification notification = NotificationGroupManager.getInstance().getNotificationGroup("Android Module Importing").createNotification(
// AndroidBundle.message("android.facet.importing.title", module.getName()),
// "'" + propertyName +
// "' property is detected in " + SdkConstants.FN_PROJECT_PROPERTIES +
// " file.<br>You may enable related option in <a href='configure'>Settings | Compiler | Android DX</a>",
// NotificationType.INFORMATION).setListener(new NotificationListener.Adapter() {
// @Override
// protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
// notification.expire();
// ShowSettingsUtil.getInstance().showSettingsDialog(
// project, AndroidBundle.message("android.dex.compiler.configurable.display.name"));
// }
// });
// notification.notify(project);
// return notification;
//}

@NotNull
@Override
Expand Down
2 changes: 2 additions & 0 deletions tool/kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ setup

echo "kokoro build start"

./bin/plugin verify

./bin/plugin make --channel=dev

echo "kokoro build finished"
20 changes: 17 additions & 3 deletions tool/plugin/lib/verify.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,27 @@ class VerifyCommand extends ProductCommand {

@override
Future<int> doit() async {
// run './gradlew verifyPluginProjectConfiguration'
// run './gradlew verifyPluginStructure'
// run './gradlew verifyPluginSignature'
// run './gradlew verifyPlugin'
// run './gradlew verifyPluginConfiguration'
var result = 0;
for (var spec in specs) {
log('\nverifyPluginConfiguration for $spec:');
log('\nverifyPluginProjectConfiguration for $spec:');
result = await runner
.runGradleCommand(['verifyPluginConfiguration'], spec, '1', 'false');
.runGradleCommand(['verifyPluginProjectConfiguration'], spec, '1', 'false');
if (result != 0) {
return result;
}
log('\nverifyPluginStructure for $spec:');
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');
if (result != 0) {
return result;
}
Expand Down

0 comments on commit 0485342

Please sign in to comment.