I'm working with a gradle build for an internal app where the proguard and keystore files are hosted on our internal maven server and used across multiple apps.
I'm trying to fetch the keystore and proguard files using gradle then reference them in the setup, but I'm having issues. See the build.gradle below
If I run 'gradle getKeystore getProguard build' everything works, but I can't seem to hook them up directly.
I tried using 'proguardRelease.dependsOn getProguard', but it complains that it can't find proguardRelease or packageRelease properties on project :myproject.
How can I hook up those task dependencies correctly so that it fetches the keystore or proguard config before running the related tasks? Are there android plugin tasks I can hook up to?
configurations {
signing
proguard
}
dependencies {
...
signing 'com.internal:keystore:1.0'
proguard 'com.internal:proguard:1.0'
}
task getKeystore(type: Copy) {
from configurations.signing
into "$buildDir/keystore"
rename '.*\\.keystore', 'android.keystore'
}
task getProguard(type: Copy) {
from configurations.proguard
into "$buildDir/proguard"
rename '.*\\.proguard', 'global.proguard'
}
android {
...
signingConfigs {
release {
storeFile file("$buildDir/keystore/android.keystore")
// keystore password
}
}
buildTypes {
release {
signingConfig signingConfigs.release
runProguard true
proguardFiles 'proguard-project.cfg', "$buildDir/proguard/global.proguard"
}
}
...
}