The main issue is that I would like to add a versionNameSuffix
to one of my buildTypes depending on the flavor that is being compiled.
I have to flavors, original
and free
and one buildtype beta
.
So I would like to do something like this:
beta {
//...
versionNameSuffix " [BETA " + betaVersion() + "] "
}
And betaVersion()
should depend on the flavor that is being compiled, it should just return a different integer for each of them.
I found a way of doing this looking at the gradle StartParameter()
:
def betaVersion() {
Gradle gradle = getGradle()
String tskReqStr = gradle.getStartParameter().getTaskRequests().toString()
if(tskReqStr.contains("Free"))
return 1;
else if(tskReqStr.contains("Original"))
return 3;
}