Yes you can do this.

On Sun, Nov 16, 2014 at 11:49 AM, Daniele Segato <[email protected]>
wrote:

> Replies inline..
>
> On Sun, Nov 16, 2014 at 7:57 PM, Xavier Ducrohet <[email protected]> wrote:
>
>>
>>
>> On Sun, Nov 16, 2014 at 1:32 AM, Daniele Segato <[email protected]
>> > wrote:
>>
>>>
>>>
>>> On Saturday, November 15, 2014 10:23:01 PM UTC+1, Xavier Ducrohet wrote:
>>>>
>>>> 1. I'n not sure how a single buildConfigField is boiler plate.
>>>>
>>>
>>> It's not the single buildConfigField a boilerplate.
>>>
>>> When you have many parameter to inject, with different values per
>>> variants you end up with many buildConfigField.
>>>
>>> Each have the same data type and key. Meaning you duplicate your key on
>>> multiple properties and your values spread across the build file in
>>> different places. If you edit something you have to remember to edit
>>> everywhere.
>>>
>>
>> You can create local variables in your build script and uses this to
>> synchronize the type and name of the resources.
>> It's not as pretty, or object-oriented I suppose, as what you describe in
>> https://code.google.com/p/android/issues/detail?id=73396 but it's good
>> enough for 1.0
>>
>
> Yes that's what I'm doing currently.
>
>
>
>>
>>>> 3. This is not currently supported. You cannot have per-variant values.
>>>> We take a combination of build type, flavors, defaultconfig and take the
>>>> highest priority one. It's something we want to fix but no ETA.
>>>>
>>>
>>> That's the main issue.
>>> At least now I know it is not possible yet.
>>>
>>> Thank you very much for your replies and time.
>>> Daniele
>>>
>>
>> It'll be possible in the next version of the plugin to add per-variant
>> buildConfig and resValues:
>>
>> android.applicationVariants.all { variant ->
>>    variant.buildConfigField "type", "name", "value"
>>    variant.resValue "type", "name", "value"
>> }
>>
>>
> am I right in thinking  I'll be able to do something like this?
>
> android.applicationVariants.all { variant ->
>    // option A
>    variant.buildConfigField "type", "name", getMyValue(variant)
>    variant.resValue "type", "name", getMyResValue(variant)
>
>    // option B
>    if (myCheckOnVariant(variant)) {
>       variant.buildConfigField "type", "name", "value"
>       " variant.resValue "type", "name", "value"
>    } else if (...) {
>       ...
>    } else {
>       ...
>    }
> }
>
> defining my function that take the variant as parameter and do their stuff
> accordingly
>
> This would be great.
> Thanks again have a nice day/evening ;)
>
>
>  --
> 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