UserData and GradleApplicationEnvironmentProvider

My question is similar to the one asked at https://intellij-support.jetbrains.com/hc/en-us/community/posts/360007654740-Patching-VM-Options-Under-Gradle-Application-Run-Configuration:

I'm currently trying to figure out how to modify the EnvFile plugin to work for Application Configurations when using Gradle delegated build actions.

The EnvFile plugin works by setting the user data of a run configuration in an editor, and then reading that user data when the configuration is run (using the runConfigurationExtension point). For a quick look at the implementation, take a peek at https://github.com/ashald/EnvFile/blob/710482b2b7d8b555bbc49aa0959c068c30079db2/modules/platform/src/main/java/net/ashald/envfile/platform/ui/EnvFileConfigurationEditor.java#L145-L165.

Now when the run action is delegated to Gradle, the User Data set by the UI on the ApplicationConfiguration object is not copied over to the GradleRunConfiguration. As such, the runConfigurationExtension thinks the plugin is not configured on the config and will do nothing.

I have already tried using copyable user data instead of normal user data, but that is not copied over either.
I also tried writing an executionEnvironmentProvider, but any user data I set will be overwritten by the ExecutionEnvironmentBuilder#copyUserDataTo.

Is there any way to use user data set in ApplicationConfiguration when using delegated runs? Any help would be appreciated!

Please sign in to leave a comment.