gradle set a global property for all projects from gradle -
i set property within gradle (for example settings.gradle) in way similar gradle.properties
or -d
. possible?
the following code demonstrates trying not working:
import org.gradle.internal.os.operatingsystem def getarchitecture() { return system.getproperty("os.arch") } def getname() { if(operatingsystem.current().ismacosx()) { return "darwin" } else if(operatingsystem.current().islinux()) { return "linux" } else { throw exception("the operating system use not supported.") } } allprojects { ext { // variable has visible projects // , .gradle files in same way if set // gradle.properties file buildmachine = getname() + "_" + getarchitecture() } }
edit
i property defined in settings.gradle , visible in other .gradle file
edit2
i have number of build machines , don't want specify value of variable buildmachine
(in settings , in other .gradle
files) , wouldn't passed -p
or gradle.properties
, because seems possible figure out property purely within gradle
Comments
Post a Comment