We write such stuff in a separate file and then apply it with
apply from: "$rootDir/gradle/android-coomon.gradle"
from the project build.gradle.
On Saturday, 17 May 2014 04:05:01 UTC+3, Jake Wharton wrote:
>
> I’m setting them directly on the build type configuration.
>
> buildTypes {
> debug {
> packageNameSuffix '.development'
> versionNameSuffix '-dev'
> signingConfig rootProject.ext.signing.debug
> }
> dogfood {
> packageNameSuffix '.dogfood'
> versionNameSuffix ".${versionBuild}"
> signingConfig rootProject.ext.signing.dogfood
> }
> }
>
>
>
> On Fri, May 16, 2014 at 5:53 PM, Xavier Ducrohet <[email protected]
> <javascript:>> wrote:
>
>> This is weird because Both ProductFlavors and Build Types only have a
>> setter that receives a DefaultSigningConfig. There's no other DSL method
>> that receives a SigningConfigDsl.
>>
>> Are you trying to put the object into the android.SigningConfigs
>> collection or directly on a build type/flavor?
>>
>> I think we'd need to have a base plugin that has a DSL to allow you to
>> create the proper DSL object but nothing else, so that they are reusable in
>> modules.
>>
>>
>> On Fri, May 16, 2014 at 2:55 PM, Jake Wharton <[email protected]
>> <javascript:>> wrote:
>>
>>> Using the internal class directly works for now. I'll just follow the
>>> issue for an official solution.
>>>
>>> Thanks for the guidance.
>>>
>>>
>>> On Fri, May 16, 2014 at 2:53 PM, Jake Wharton <[email protected]
>>> <javascript:>> wrote:
>>>
>>>> Same problem:
>>>>
>>>> Cannot cast object 'DefaultSigningConfig{...}' with class
>>>> 'com.android.builder.signing.DefaultSigningConfig' to class
>>>> 'com.android.build.gradle.internal.dsl.SigningConfigDsl'
>>>>
>>>> I couldn’t get the fancy initialization to work so I resorted to:
>>>>
>>>> def signingDebug = new DefaultSigningConfig('debug')
>>>> signingDebug.storeFile = file('common/debug.keystore')
>>>> signingDebug.storePassword = 'password'
>>>> signingDebug.storeType = 'PKCS12'
>>>> signingDebug.keyAlias = 'debug'
>>>> signingDebug.keyPassword = 'password'
>>>>
>>>> def signingDogfood = new DefaultSigningConfig('dogfood')
>>>> signingDogfood.storeFile = file('common/dogfood.keystore')
>>>> signingDogfood.storePassword = 'password'
>>>> signingDogfood.keyAlias = 'dogfood'
>>>> signingDogfood.keyPassword = 'password'
>>>>
>>>> ext {
>>>> androidPlugin = 'com.android.tools.build:gradle:0.10.+'
>>>> compileSdkVersion = 19
>>>> buildToolsVersion = '19.1.0'
>>>>
>>>> signing = [
>>>> debug: signingDebug,
>>>> dogfood: signingDogfood
>>>> ]
>>>> }
>>>>
>>>>
>>>>
>>>> On Fri, May 16, 2014 at 11:11 AM, Xavier Ducrohet <[email protected]
>>>> <javascript:>> wrote:
>>>>
>>>>> https://code.google.com/p/android/issues/detail?id=69734
>>>>>
>>>>>
>>>>> On Fri, May 16, 2014 at 11:09 AM, Xavier Ducrohet <[email protected]
>>>>> <javascript:>> wrote:
>>>>>
>>>>>> 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]
>>>>>> <javascript:>> 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] <javascript:>.
>>>>>>> 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!
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> 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] <javascript:>.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>> --
>>> 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] <javascript:>.
>>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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.