Is there a away to check if my plugin is running locally?
Answered
Hi, I want to manage releases (dev/staging/prod) on my plugin and I thought that differentiating between dev and the others would be easy: I'd just check if the plugin is running local, but I haven't managed to find to way to check that.
Is there a way to check isRunningLocal() or isRunningDeployed() ?
Please sign in to leave a comment.
Gilad,
What do you mean by "running locally"? Do you want to check if you're testing your plugin across the CI? Or is it a version installed from the repository or by the manual installation or just run from the IJ during the development?
In general, SDK provides you with methods such as Application.isUnitTestMode() or Application.isHeadlessEnvironment().
If you want to detect the difference between the builds, I'd suggest you prepare builds with suffixes like 1.0.0-dev, 1.0.0-staging or 1.0.0
Having the version containing environment suffix, you can verify it checking the version string:
Jakub Chrzanowski
Hi, i'll make my question clearer,
how do I know if the current code (of the plugin) is running locally on my computer using runIde task or, it is running as a deployed plugin?
Thank you very much for your time
There is no straight forward way to check in the IJ SDK that its instance is running triggered by the Gradle task or as a "real" IDE.
As said above - you can introduce version suffix that may be overwritten by the Grade task (Patching DLS section). In your Gradle configuration, you can use the environment variable (called i.e., "VERSION_SUFFIX"), which will be provided by the local task and skipped (fallback to an empty string) when built for production.
Then you can edit the runIde configuration and provide VERSION_SUFFIX that you'll test against during the runtime.
You could just put a dummy file somewhere and check for its existence.
Thank you for your help!
val isDevelopmentMode = System.getProperty("idea.is.internal") == "true"