ashald / EnvFile

EnvFile 3.x is a plugin for JetBrains IDEs that allows you to set environment variables for your run configurations from one or multiple files.
MIT License
539 stars 129 forks source link

Allow delegated Gradle runs when using Application Run Configurations #110

Closed pilzm closed 4 years ago

pilzm commented 4 years ago

Fixes the issue described in #108, currently POC status.

Problem: When using delegated Gradle actions, IntelliJ creates a GradleRunConfiguration out of the ApplicationConfiguration and sets variables like env vars, VM params etc. What it doesn't set is UserData, which is the mechanism EnvFile uses to persist the list of env files per config. Therefore, when the IdeaRunConfigurationExtension receives the GradleRunConfiguration, it will not find any config in the GradleRunConfigurations user data. Instead, this PR introduces a hook into the GradleRunConfiguration creation process. After the config is created, it reads the original ApplicationConfigurations userData and applies the standard envFile process.

There's a few aspects I'm not satisfied with:

Any input is welcome

ashald commented 4 years ago

Thanks for the PR!