Closed AlexeySoshin closed 4 years ago
Good catch. I think what’s happening is that since Gradle is invoking the plugin as an executable and not a jar, the properties are never propagated. I like the idea of using system env since protoc plugin options don’t play nice with path values on windows.
We have a case when KrotoPlus projects needs to run in a sandboxed environment.
In this case, it tries to create scripts cache, but fails, since sandbox doesn't allow it to generate a file at
HOME
level.In theory, there's
krotoplus.script.cache.dir
property for that: https://github.com/marcoferrer/kroto-plus/blob/2e7fcfa28db1ef2076ba0cb04dab6bbd4cbfc5ab/protoc-gen-kroto-plus/src/main/kotlin/com/github/marcoferrer/krotoplus/script/ScriptManager.kt#L38But it doesn't seem to work in any way:
Will reflect correctly when used as
System.getProperty("krotoplus.script.cache.dir")
in the main script, but not byScriptManager
My theory is there's some kind of forking happening while generating scripts, and the original property is lost. This is supported by the following stack trace:
Suggestion would be to use
System.getenv
instead ofSystem.getProperty()
, as ENV would propagate from OS.