Setting environment variables for the wrapper in a separated file

It would be nice, if the default wrapper script would either read environment variables from a separated file and/or if the wrapper task would offer some configuration options to add environment variables to.

Wherefore? Some tasks need to have environment variables set in the Gradle process (e.g. if you want to pass something to the jetty or tomcat plugin), i.e. every task that doesn’t spawn a new process. At the moment the only way is to modify the wrapper to set these environment variables.

Problem with this solution: If I now want to update the wrapper with the wrapper task to a new version, it will overwrite my changes to the script and I need to make them again.

So solution (a): the wrapper should be rewritten to read a specific file (e.g. which variables it will add to the environment before starting the actual Java process. or solution (b): the wrapper task could be configured to add some variables to the wrapper script, so when i execute it again, it will also again add it, what could look like:

task wrapper(type: Wrapper) {
   gradleVersion = '1.12'
   envvars 'LD_LIBRARY_PATH': 'libs/native'

Any thoughts on that?