Intellij plugin development: avoid clearing sandbox on code change

Answered

Every time I change my code the idea-sandbox gets cleared and plugins I've installed on the new instance get deleted, it is frustrating because I need to install that plugin every time I want to test my in-development IntelliJ Plugin.

 

I've tried setting those to false on my gradle file but still:

downloadSources = false
updateSinceUntilBuild = false


Is it possible to disable this: clear sandbox-on-code-change feature?

Thank you

12 comments
Comment actions Permalink

Reference: https://plugins.jetbrains.com/docs/intellij/ide-development-instance.html#the-development-instance-sandbox-directory

There's currently no way to specify additional plugins to be installed automatically in the sandbox instance.

You can specify alternate location for sandbox via "sandboxDirectory" property, so it's not located under /build/ and thus not touched by any Gradle task execution.

Alternatively, either copy required plugin distributions explicitly in your gradle script or define dependency on required plugins via "intellij -> plugins" configuration.

0
Comment actions Permalink

Hi Yann Cebron

See bellow my gradle configs, my sandbox path is now changed but every time I build my plugin and then install some required plugin-dependnecy then I stop the build, make some code changes and build it again, the sandbox dir will still clear that plugin-dependency installed from my plugin instance.

The Flutter plugin you see bellow depends on Dart, so once I build my plugin I have to install dart, but once I do code changes and build my plugin again, the Dart dependency gets removed from my sandbox. The solution you gave does not work, is there any alternative?

How do I copy the plugin in my gradle file? I did some research, but it is hard to find something in the docs (there is still room for improvements).

 

0
Comment actions Permalink

Please provide a link to your full sources to reproduce.

0
Comment actions Permalink

Hi Yann Cebron

Here it is: https://github.com/pedromassangocode/magicx

 

Also, I noticed that once I changed the sandbox dir, it always start. a brand new intelliJ instance, I mean, it always show the tips dialog even after disabling it once and the project opened previously is not in the rencet projects tab.

0
Comment actions Permalink

Please try specifying absolute path in sandbox, something like "/Users/pedro/sandbox"

0
Comment actions Permalink

I've tried that, what is happening is that no matter what add there it is always included within the project root dir, so when I add what you provided above it generates the sandbox in: root-project/:/Users/pedro/sandbox

Yes, it does include the : as well.

0
Comment actions Permalink

I cannot reproduce that behavior with wrong paths. Please make sure you re-sync your Gradle project in IDEA.

Why don't you specify Dart plugin as required dependency in intellij->setPlugins block? it is a required dependency, so it won't be possible to run tests without specifying it. Same with git plugin:

 

Dependencies defined in plugin.xml
For more information see Plugin Compatibility Guide

org.jetbrains.android

com.intellij.modules.xdebugger

com.intellij.modules.platform

com.intellij.modules.lang

Git4Idea - Git

Dart - Dart

https://plugins.jetbrains.com/plugin/9212-flutter/versions/stable/117087

0
Comment actions Permalink

"Why don't you specify Dart plugin as required dependency in intellij->setPlugins block?"

I already tried that, also tried to add in both using setPlugins in gralde and on xml file but the issue still. I don't need Dart in my plugin (I don't use Dart code in my plugin) but Flutter plugin does.

I've tried so many things for now and all does not seems to work, do you mind jumping on IntelliJ Space to help me out?

Thank you anyway.

0
Comment actions Permalink

Please try :

1) revert sandbox approach completely

2) use original "setPlugins(*properties("platformPlugins")" line in build.gradle.kts

3) find a compatible version of Dart plugin from its plugin page for your target platform and add both flutter and that plugin as plugins in gradle.properties, e.g.

platformPlugins = io.flutter:55.1.2,Dart:202.8488

to support 202 platform (unfortunately Dart plugin is versioned per platform, so you'll need to test/verify it'll continue working across multiple platforms)

This should install both plugins in your sandbox automatically. Since you only have direct compile dependency on Flutter plugin, no need to add Dart in your plugin.xml <depends> section. Reference: https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html

1
Comment actions Permalink

Wow, that worked out. Thank you so much.

Now Dart is not getiing deleted from sandbox!

So we should always use `platformPlugins` for direct and transitive plugins? why?
Why I was facing that issue?

I'm just curious :)

You saved me, thank you once again.

0
Comment actions Permalink

Setting plugin dependencies in gradle.properties is just more clear than hardcoding values in Gradle build file itself and allows easier switching in combination with other related configuration options (e.g. target platform version, since/until-build config etc.)

 

0
Comment actions Permalink

So probably deprecate (and remore it from the docs) setPlugins(...) should be the way to go, I was just following the docs :)

Thank you for your time!

0

Please sign in to leave a comment.