I think you'd have to do:

import com.android.builder.signing.DefaultSigningConfig

ext {
  debugSigning = new DefaultSigningConfig('debug') {
     storeFile = file('common/debug.keystore')
     storePassword = "password"
     storeType = "PKCS12"
     keyAlias = "debug"
     keyPassword = "password",
  }
//... same for release.
}

then in your projects you can do

android {
  buildTypes {
    debug {
       signingConfig rootProject.ext.debugSigning
    }
  }
}

This may or no be applicable to buildTypes/Flavors. I'd have to see how we
can better support this use-case which seem very useful when you have a lot
of modules.




On Fri, May 16, 2014 at 9:51 AM, Jake Wharton <[email protected]> wrote:

> I’m trying to share parts of the configuration across multiple child
> projects using the ‘ext’ map. For simple types it works, but I can seem to
> share complex objects.
>
> For example, the signing configuration is something that I don’t want to
> have to specify in every project. I’ve tried all combinations of object
> configuration but none seem to work:
>
> ext {
>   androidPlugin = 'com.android.tools.build:gradle:0.10.+'
>   compileSdkVersion = 19
>   buildToolsVersion = '19.1.0'
>
>   signing = [
>     debug: [
>       storeFile: file('common/debug.keystore'),
>       storePassword: "password",
>       storeType: "PKCS12",
>       keyAlias: "debug",
>       keyPassword: "password",
>     ] as com.android.builder.model.SigningConfig,
>
>     dogfood: [
>       storeFile: file('common/dogfood.keystore'),
>       storePassword: "password",
>       keyAlias: "dogfood",
>       keyPassword: "password",
>     ] as com.android.builder.model.SigningConfig,
>   ]
> }
>
> This particular one complains upon use with:
>
> Cannot cast object '{...}' with class 'com.sun.proxy.$Proxy29' to class 
> 'com.android.build.gradle.internal.dsl.SigningConfigDsl'
>
> I tried using the internal DSL type directly just for kicks but it also
> ends up failing.
>
> Is there a good way to share things like signing configs, build types,
> etc. in the root for reference by child projects?
>
> --
> 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