intellij-platform-gradle-plugin
intellij-platform-gradle-plugin copied to clipboard
Plugin Verifier should verify against the bundled JBR
Describe the need of your request
When the Plugin Verifier verifies the compatibility of a plugin with a given IDE, it should also verify the compatibility of the plugin against the JBR that comes with the given IDE.
Proposed solution
Remove the -runtime-dir command line argument given to the plugin verifier.
https://github.com/JetBrains/intellij-platform-gradle-plugin/blob/0c6867a233cee020eee99785592aeba4be0d58fb/src/main/kotlin/org/jetbrains/intellij/platform/gradle/tasks/VerifyPluginTask.kt#L239
From the README.md of the Plugin Verifier:
-runtime-dir (-r)The path to the directory containing Java runtime JAR files (JDK). If not specified, the embedded JDK from the provided
IDEparameter will be used.
If the IDE does not contain an embedded JDK, theJAVA_HOMEenvironment variable will be used to resolve the Java runtime.
As far as I am aware, the IDE distributions downloaded for the Plugin Verifier should usually have a bundled JBR. Also note that in contrast to all the other usages of RuntimeAware, the JBR is not actually used as a runtime in this context. The PluginVerifier uses the JBR directory to resolve classes used by the plugin, so it can verify whether the used classes, methods, and fields exist in the given IDE/JBR.
Alternatives you've considered
It might make sense to provide an explicit option to use a different JBR as the one bundled with the IDE. I am also not sure if we can really assume that all IDEs downloaded for the Plugin Verifier have a bundled JBR. So, it might also make sense to test whether they have one, and fallback to the JBR used by the other tasks.
Additional context
No response
Those are valid points — passing the runtimeDirectory to Plugin Verifier makes it use the JBR bundled with the IntelliJ Platform you use for building the plugin, not the one bundled within the IDE distribution picked for the verification.
Still, the case when the picked IDE has no JBR bundled is possible.
@novotnyr Can we introduce a -fallback-runtime-dir so we could use provided Java Runtime when IDE has no JBR present?
As I see, currently we use provided Runtime, then check for the bundled one:
https://github.com/JetBrains/intellij-plugin-verifier/blob/9cfbae0088934c03b40253b6000c7ce6c521e3cc/intellij-plugin-verifier/verifier-intellij/src/main/java/com/jetbrains/pluginverifier/jdk/JdkDescriptorProviders.kt#L25-L28