JetBrains / intellij-platform-plugin-template

Template repository for creating plugins for IntelliJ Platform
Apache License 2.0
3.05k stars 618 forks source link

Pass the cache folder to `runPluginVerifier` correctly #352

Closed Konafets closed 1 year ago

Konafets commented 1 year ago

Closes https://github.com/JetBrains/intellij-platform-plugin-template/issues/339

hsz commented 1 year ago

The /ides at the end is redundant and ends up in producing ~/.pluginVerifier/ides/ides.

Konafets commented 1 year ago

How?

Here the env var pluginVerifierHomeDir is set to ~/.pluginVerifier.

In the cache step, the path is set to ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides which evaluates to ~/.pluginVerifier/ides and for the Plugin Verification task the path is set also to ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides which evaluates to ~/.pluginVerifier/ides. I do not see where ides is added twice.

Do you have any log or debug information which you can share, where the redundant path can be seen?

hsz commented 1 year ago

In the cache step, the pluginVerifierHomeDir is reused with /ides appended to instruct the cache mechanism to take care only of the/ides subdirectory.

But later, when passing this variable as a plugin.verifier.home.dir system property, it has to point to the "root" PV home directory, not the ides subdirectory. This is because Gradle IntelliJ Plugin reads it here:

https://github.com/JetBrains/gradle-intellij-plugin/blob/4a710e37653a5ca5e3a85277d18ff853e300d036/src/main/kotlin/org/jetbrains/intellij/tasks/RunPluginVerifierTask.kt#L473

and then uses it to resolve the ideDownloadDir using that PV home directory and adds the ides subdirectory to it, as follows:

https://github.com/JetBrains/gradle-intellij-plugin/blob/4a710e37653a5ca5e3a85277d18ff853e300d036/src/main/kotlin/org/jetbrains/intellij/tasks/RunPluginVerifierTask.kt#L604

To test this behavior, you can locally run:

./gradlew runPluginVerifier -Dplugin.verifier.home.dir=~/.pluginVerifier/ides

and check if it creates the ~/.pluginVerifier/ides/ides directory for you.

Konafets commented 1 year ago

Ok, I see. Are you ok with adding a comment like

// Do not append folder /ides as this is added by the Gradle plugin

hsz commented 1 year ago

That's unnecessary.

Konafets commented 1 year ago

Updated the PR.

hsz commented 1 year ago

Thanks!