Hi, trying to find a way to inject a property befo...
# community-support
s
Hi, trying to find a way to inject a property before the build starts as if it was declared in gradle.properties. I need a gradle property useBinaryReleases=false in some cases, some plugins or libraries use it, it depends on another property, if gradle was run with for example -PbuildProfile=p242 , or there is buildProfile=p242 in gradle.properties. i need useBinaryReleases=false only for profile p242. of course i can add this property in the command line but i'm trying to save that from users, and also when running tasks from Idea gradle UI. basically what if need is: if(buildProfile == p242){ inject property useBinaryReleases=false } I tried to add an extension property but it didn't work,
Copy code
if (project.currentProfile() == "p242"){
    logger.lifecycle("injecting useBinaryReleases")
    gradle.extraProperties.set("org.jetbrains.intellij.platform.buildFeature.useBinaryReleases","false")
}
any ideas how to do that
v
There is no supported way. You cannot set project properties at runtime. If the property would have been read with
project.getProperty
or similar, setting the extra property would have worked. But if it for example is read using
providers.gradleProperty
, those are irrelevant.
s
Yes these properties are read with providers. i will just send this property in command line when needed, just some scripts work i need to do. Thank you!
👌 1