FWDekker/intellij-randomness

Add the runtime-dir option to pluginVerifier

opticyclic opened this issue · 1 comments

Problem
I get the following error when running the runPluginVerifier task imported in my own plugin project

Exception in thread "main" java.lang.IllegalArgumentException: JAVA_HOME is not specified
    at com.jetbrains.pluginverifier.options.OptionsParser.getJdkPath(OptionsParser.kt:76)
    at com.jetbrains.pluginverifier.options.OptionsParser.createIdeDescriptor(OptionsParser.kt:66)
    at com.jetbrains.pluginverifier.tasks.checkPlugin.CheckPluginParamsBuilder.build(CheckPluginParamsBuilder.kt:38)
    at com.jetbrains.pluginverifier.tasks.checkPlugin.CheckPluginParamsBuilder.build(CheckPluginParamsBuilder.kt:23)
    at com.jetbrains.pluginverifier.PluginVerifierMain.main(PluginVerifierMain.kt:124)

This is due to a combination of how IDEA is started without the JAVA_HOME variable and how the PluginVerifier doesn't do a full search of the environment for a JDK.

https://github.com/JetBrains/intellij-plugin-verifier/issues/35

Suggested solution
Could you add the option to pass the -runtime-dir option to the task
https://github.com/FWDekker/intellij-randomness/blob/master/gradle/scripts/verifier.gradle#L151-L162

Alternative solutions
I could make sure that JAVA_HOME was set everywhere I wanted to use this.

Additional context
I also would like the ability to specify a different runtime than my current one so I can test different variations in a build server.

I am also aware that this is mainly for your project and not primarily designed for use by other people via an import.

You're right that it's preferable if you don't import this script from a URL since I have plans to eventually incorporate the functionality into the gradle-intellij-plugin, after which I'll remove the script from this repository. Since there's probably a few repositories depending on the script I'll try to do a deprecation phase, but just be careful.