JetBrains / intellij-platform-gradle-plugin

Gradle plugin for building plugins for IntelliJ-based IDEs

Home Page:https://plugins.jetbrains.com/docs/intellij/gradle-prerequisites.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

2.0 - don't add IDE version string to sandboxContainer

jonathanlermitage opened this issue · comments

What happened?

Migrating to the gradle plugin v2, how can I set the full path of the sandbox container?
With plugin v1, if I set intellij { sandboxDir.set("foo/") }, starting the sandboxed IDE generates folders like /foo/config, /foo/system, etc.
With plugin v2, if I set intellijPlatform { sandboxContainer = File("foo/") }, starting the sandboxed IDE generates folders like /foo/IC-2024.1.1/config, /foo/IC-2024.1.1/config, etc.
Is there a way to remove the sandboxed IDE version string from the sandbox container's path? It looks like a regression.

Relevant log output or stack trace

No response

Steps to reproduce

Migrate to plugin v2 and run gradlew runIde.

Gradle IntelliJ Plugin version

2.0.0-beta3

Gradle version

8.7

Operating System

Windows

Link to build, i.e. failing GitHub Action job

No response

What is the reason for that?

Versioned directories within the sandbox container directory enable introducing custom tasks, like running a custom IDE with the plugin loaded with a different IntelliJ Platform.

I want to easily share the same config across multiple IDE minor versions (e.g. 2024.1.1, then 2024.1.2), and, if I'm adventurous, across major versions. Now, each time a new IDE version (even a minor version) is released, I have to copy/past my config before testing my plugin in the sandbox. This is boring.
Allowing us to control that would make everybody happy.

What about

tasks {
    prepareSandbox {
        sandboxDirectory = intellijPlatform.sandboxContainer.dir("fixedName")
    }
}

This is perfect, I was not aware of that. Thanks!!

Hum wait, when running runIde, it generates folders in fixedName, and the regular build/generated/idea-sandbox/2024.1.1 folder, and the sandboxed IDE picks config from this regular folder, not from my custom one.

I tried

prepareSandbox {
        sandboxDirectory = intellijPlatform.sandboxContainer.dir("../../.idea-sandbox2/stable/")
    }

image

An alternative would be to let the user override the idea.config.path property. But, if I do that via systemProperties("idea.config.path" to "/foo/config"), the config is stored in /foo/2024.1.1/config. Even there, and I double-checked the -Didea.config.path's value with VisualVM, the IDE version string is inserted inside the config path.

Thank you for highlighting the above issue! Apparently, tasks didn't inherit from the sandbox producer (prepareSandbox), but that is now fixed.
It'll be available this week with 2.0.0-beta4.

BTW, if you don't want to refer to the sandboxContainer (build/idea-sandbox by default), you can do as follows:

tasks {
    prepareSandbox {
        sandboxDirectory = layout.projectDirectory.dir(".idea-sandbox2/stable")
    }
}

Is it included in beta4? It changed nothing for me.

The sandbox management was revisited again in beta8. With the current beta9, it works as described above.