intellij-platform-gradle-plugin icon indicating copy to clipboard operation
intellij-platform-gradle-plugin copied to clipboard

2.0 - don't add IDE version string to sandboxContainer

Open jonathanlermitage opened this issue 1 year ago • 8 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

jonathanlermitage avatar May 21 '24 14:05 jonathanlermitage

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.

hsz avatar May 22 '24 16:05 hsz

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.

jonathanlermitage avatar May 22 '24 16:05 jonathanlermitage

What about

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

hsz avatar May 22 '24 16:05 hsz

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

jonathanlermitage avatar May 22 '24 16:05 jonathanlermitage

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

jonathanlermitage avatar May 22 '24 16:05 jonathanlermitage

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.

jonathanlermitage avatar May 22 '24 19:05 jonathanlermitage

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")
    }
}

hsz avatar May 22 '24 19:05 hsz

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

jonathanlermitage avatar May 29 '24 16:05 jonathanlermitage

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

hsz avatar Jul 13 '24 06:07 hsz