Hold on, I see what you meant in the first message now.

This area is in flux _right now_. I would use the current API I mention,
which works with 0.13.x, and ignore what is in the code because one does
not reflect the other. In fact, Jerome and I just talked about this 5min
ago and decided to make some changes.

There will be changes in this area for 0.14 but we are not done yet so I
would just not look at this part for now.

On Thu, Oct 2, 2014 at 11:28 PM, Tomáš Procházka <
[email protected]> wrote:

> So, duplicate functionality is only way :-(
> I wanted only to rename output APK name with gradle produce by default.
> But keep all attributes like release/debug, flavour name, density/abi
> split, etc.
>
> Maybe best way how to do it is this:
>
> android.applicationVariants.all { variant ->
>    variant.outputs.each { output ->
>
>     File file = output.outputFile
>     String gitHash = getGitHash()
>
>     *def *name = 
> output.outputFile.name.replace(*"-"*,*","*).replace(project.name+*","*,       
>      project.parent.name + *"-" *+ project.name + *"-" *+            
> project.version + *"-" *+ variant.mergedFlavor.versionCode + *"-" *+          
>   gitHash + *"-"*)    output.outputFile = *new *File(file.parent, name)  }}
>
> It generate name like
>
> scanner-app-1.0.0-29-eb2cf30-release.apk
>
>
> All build type flags are at the end separated by ",", so it can be
>
>
> scanner-app-1.0.0-29-eb2cf30-flavour1,xhdpi,release.apk
>
>
>
> --
> Ing. Tomáš Procházka
>
> 2014-10-02 20:09 GMT+02:00 Xavier Ducrohet <[email protected]>:
>
>> Yes you can access the outputs from the script. Look at the densitySplit
>> sample we upload. It has a section which does this:
>>
>> // map for the version code
>> ext.versionCodes = [all:1, mdpi:2, hdpi:3, xhdpi:4, xxhdpi:5]
>>
>> android.applicationVariants.all { variant ->
>>   // assign different version code for each output
>>   variant.outputs.each { output ->
>>     def key = output.densityFilter == null ? "all" : output.densityFilter
>>     output.versionCodeOverride = project.ext.versionCodes.get(key) * 100
>> + android.defaultConfig.versionCode
>>   }
>> }
>>
>>  --
> 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