Skip to content

Commit

Permalink
Improve Plugin Verifier error messages #1040
Browse files Browse the repository at this point in the history
  • Loading branch information
hsz committed Jun 29, 2022
1 parent 195f571 commit 7a69fa1
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Warn about paid plugin running `buildSearchableOptions` and suggest [disabling the task](https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin-faq.html#how-to-disable-building-searchable-options). [#1025](../../issues/1025)
- IDE dependencies are added to the `compileOnly` classpath for test fixtures if the `java-test-fixtures` plugin is applied [#1028](../../issues/1028)
- `classpathIndexCleanup` task is added to remove `classpath.index` files created by `PathClassLoader` [#1039](../../issues/1039)
- Improve Plugin Verifier error messages [#1040](../../issues/1040)

### Changed
- Set minimum supported Gradle version from `6.7` to `6.7.1`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,12 @@ open class RunPluginVerifierTask @Inject constructor(

debug(context, "Current failure levels: ${FailureLevel.values().joinToString(", ")}")
FailureLevel.values().forEach { level ->
if (failureLevel.get().contains(level) && os.toString().contains(level.testValue)) {
if (failureLevel.get().contains(level) && os.toString().contains(level.sectionHeading)) {
debug(context, "Failing task on '$failureLevel' failure level")
throw GradleException(level.toString())
throw GradleException(
"$level: ${level.message} Check Plugin Verifier report for more details.\n" +
"Incompatible API Changes: https://jb.gg/intellij-api-changes"
)
}
}
}
Expand Down Expand Up @@ -548,18 +551,51 @@ open class RunPluginVerifierTask @Inject constructor(
Files.createDirectories(it)
}

enum class FailureLevel(val testValue: String) {
COMPATIBILITY_WARNINGS("Compatibility warnings"),
COMPATIBILITY_PROBLEMS("Compatibility problems"),
DEPRECATED_API_USAGES("Deprecated API usages"),
EXPERIMENTAL_API_USAGES("Experimental API usages"),
INTERNAL_API_USAGES("Internal API usages"),
OVERRIDE_ONLY_API_USAGES("Override-only API usages"),
NON_EXTENDABLE_API_USAGES("Non-extendable API usages"),
PLUGIN_STRUCTURE_WARNINGS("Plugin structure warnings"),
MISSING_DEPENDENCIES("Missing dependencies"),
INVALID_PLUGIN("The following files specified for the verification are not valid plugins"),
NOT_DYNAMIC("Plugin cannot be loaded/unloaded without IDE restart");
enum class FailureLevel(val sectionHeading: String, val message: String) {
COMPATIBILITY_WARNINGS(
"Compatibility warnings",
"Compatibility warnings detected against the specified IDE version."
),
COMPATIBILITY_PROBLEMS(
"Compatibility problems",
"Compatibility problems detected against the specified IDE version."
),
DEPRECATED_API_USAGES(
"Deprecated API usages",
"Plugin uses API marked as deprecated (@Deprecated, ApiStatus.@ScheduledForRemoval)."
),
EXPERIMENTAL_API_USAGES(
"Experimental API usages",
"Plugin uses API marked as experimental (ApiStatus.@Experimental)."
),
INTERNAL_API_USAGES(
"Internal API usages",
"Plugin uses API marked as internal (ApiStatus.@Internal)."
),
OVERRIDE_ONLY_API_USAGES(
"Override-only API usages",
"Override-only API is used incorrectly (ApiStatus.@OverrideOnly)."
),
NON_EXTENDABLE_API_USAGES(
"Non-extendable API usages",
"Non-extendable API is used incorrectly (ApiStatus.@NonExtendable)."
),
PLUGIN_STRUCTURE_WARNINGS(
"Plugin structure warnings",
"The structure of the plugin is not valid."
),
MISSING_DEPENDENCIES(
"Missing dependencies",
"Plugin has some dependencies missing."
),
INVALID_PLUGIN(
"The following files specified for the verification are not valid plugins",
"Provided plugin artifact is not valid."
),
NOT_DYNAMIC(
"Plugin cannot be loaded/unloaded without IDE restart",
"Plugin cannot be loaded/unloaded without IDE restart."
);

companion object {
val ALL: EnumSet<FailureLevel> = EnumSet.allOf(FailureLevel::class.java)
Expand Down

0 comments on commit 7a69fa1

Please sign in to comment.