Those tasks are created after the project evaluation so you can setup your
tasks dependencies in

afterEvaluate {
}

but it's probably better to do it for each variants:

android.applicationVariants.all { variant ->
   variant.proguard.dependsOn ...
}


On Tue, Apr 15, 2014 at 2:42 PM, Alex Avance <[email protected]> wrote:

> 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"
>     }
>   }
>
>   ...
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "adt-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
http://developer.android.com | http://tools.android.com

Please do not send me questions directly. Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to