Gradle Tooling : How to set environment variable

403 Views Asked by At

I have a custom plugin and I am writing tests to test it. For this I'm using gradle tooling api (I found that to be the recommended way to test).

One of the test requires me to run a task by setting some environment variable. How do I test this. I do not see ProjectConnection providing a way to set environment variable.

If I have to manually test I would have to do this :

setenv LRG_REPOS foo
gradle verify_lrg -PlrgName=abc

where verify_lrg is task added by my custom plugin.

Currently to solve this, I am running using ProcessBuilder, but would like to know if there is any gradle tooling way (because all other tests are using gradle tooling api)

1

There are 1 best solutions below

0
Vladislav Soroka On