[Android] Set apk filename without manifest parser
Geoffrey Métais
git at videolan.org
Fri Apr 7 17:36:23 CEST 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Apr 7 17:34:40 2017 +0200| [a676471311bc6b4edba3895b968678639dea301a] | committer: Geoffrey Métais
Set apk filename without manifest parser
> https://code.videolan.org/videolan/vlc-android/commit/a676471311bc6b4edba3895b968678639dea301a
---
vlc-android/build.gradle | 33 ++++++++++++---------------------
1 file changed, 12 insertions(+), 21 deletions(-)
diff --git a/vlc-android/build.gradle b/vlc-android/build.gradle
index 5a30826..ccdfb26 100644
--- a/vlc-android/build.gradle
+++ b/vlc-android/build.gradle
@@ -1,7 +1,5 @@
apply plugin: 'com.android.application'
-import com.android.builder.core.DefaultManifestParser
-
android {
packagingOptions {
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
@@ -135,25 +133,18 @@ android {
// make per-variant version code
applicationVariants.all { variant ->
- variant.getGenerateBuildConfig().doLast {
- def manifestParser = new DefaultManifestParser(android.sourceSets.main.manifest.srcFile)
- // get the version code of each flavor
- def vlcVersion = manifestParser.getVersionName()
- def targetVersion = variant.productFlavors.get(0).versionCode
- def abiVersion = variant.productFlavors.get(1).versionCode
-
- // set the composite code
- variant.mergedFlavor.versionCode = targetVersion * 10000000 + manifestParser.versionCode + abiVersion
- variant.mergedFlavor.versionName = vlcVersion
-
- //Custom APK name
- variant.outputs.each { output ->
- def outputName = "VLC-Android-"
- if (variant.productFlavors.get(0).name != "vanilla")
- outputName += variant.productFlavors.get(0).name.toUpperCase() + "-"
- outputName += vlcVersion + "-" + variant.productFlavors.get(1).name + ".apk"
- output.outputFile = new File(output.outputFile.parentFile, outputName);
- }
+ // set the composite code
+ variant.mergedFlavor.versionCode = variant.productFlavors.get(0).versionCode * 10000000 + defaultConfig.versionCode + variant.productFlavors.get(1).versionCode
+ println variant.mergedFlavor.versionCode
+
+ //Custom APK name
+ variant.outputs.each { output ->
+ def outputName = "VLC-Android-"
+ if (variant.productFlavors.get(0).name != "vanilla")
+ outputName += variant.productFlavors.get(0).name.toUpperCase() + "-"
+ outputName += variant.versionName + "-" + variant.productFlavors.get(1).name + ".apk"
+ println outputName
+ output.outputFile = new File(output.outputFile.parentFile, outputName);
}
}
More information about the Android
mailing list