I have a gradle script which needs to be imported as a dependency like this:
compile project(':subproject', { ext.app = 'myApp'; ext.serverUrl = 'https://example.com'; ext.system = 'LIVE'})
This is working fine, if I set the variables directly in the dependency statement.
As I have a different system for debug and for release I tried to move these properties to the buildTypes:
...
debug {
debuggable true
serverUrl = 'https://example.com'
system = 'TEST'
}
prerelease {
debuggable true
serverUrl = 'https://example.com'
system = 'STAGING'
}
release {
serverUrl = 'https://example.com'
system = 'LIVE'
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
...
dependencies {
compile project(':subproject', { ext.app = appName; ext.serverUrl = serverUrl; ext.system = system })
}
So, when I build assembleDebug
it should use TEST
and with assemblePrerelease
it should use STAGING
. However it is always using the release build type variables to compile the dependency.
The library already contains publishNonDefault true
What's wrong with this gradle script?