[Android] Move LibVLC build in LibVLC gradle file
Geoffrey Métais
git at videolan.org
Mon Jan 5 13:49:43 CET 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Sun Jan 4 16:19:53 2015 +0100| [87adbbc816570bb98a2a9c77e55fa29c792674f2] | committer: Geoffrey Métais
Move LibVLC build in LibVLC gradle file
LibVLC debug and release are bundled in libvlc/build/outputs/aar/
So it seems OK to build release and debug apks at the same time
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=87adbbc816570bb98a2a9c77e55fa29c792674f2
---
libvlc/build.gradle | 44 +++++++++++++++++++++++++++++++++++++++
vlc-android/build.gradle | 52 ----------------------------------------------
2 files changed, 44 insertions(+), 52 deletions(-)
diff --git a/libvlc/build.gradle b/libvlc/build.gradle
index 173739c..5e3219b 100644
--- a/libvlc/build.gradle
+++ b/libvlc/build.gradle
@@ -1,5 +1,41 @@
apply plugin: 'com.android.library'
+task buildDebug(type:Exec) {
+ /*
+ Properties set for Android Studio own shell.
+ when you run gradlew from cli, OS shell env variables will be used
+
+ To be able to build from Android Studio, you have to set ndk.dir & sdk.dir
+ properties in local.properties in the root folder, like this (for example):
+ sdk.dir=/home/<username>/SDK/android-sdk-linux
+ ndk.dir=/home/<username>/SDK/android-ndk-r10b
+ */
+ if (System.getenv('ANDROID_SDK') == null || System.getenv('ANDROID_NDK') == null) {
+ Properties properties = new Properties()
+ properties.load(project.rootProject.file('local.properties').newDataInputStream())
+ environment 'ANDROID_NDK', properties.getProperty('ndk.dir')
+ environment 'ANDROID_SDK', properties.getProperty('sdk.dir')
+ environment 'ANDROID_ABI', 'armeabi-v7a x86'
+ }
+ workingDir '..'
+ commandLine './compile.sh'
+ args('jni')
+}
+
+task buildRelease(type:Exec) {
+ if (System.getenv('ANDROID_SDK') == null || System.getenv('ANDROID_NDK') == null) {
+ Properties properties = new Properties()
+ properties.load(project.rootProject.file('local.properties').newDataInputStream())
+ environment 'ANDROID_NDK', properties.getProperty('ndk.dir')
+ environment 'ANDROID_SDK', properties.getProperty('sdk.dir')
+ environment 'ANDROID_ABI', 'armeabi-v7a x86'
+ }
+
+ workingDir '..'
+ commandLine './compile.sh'
+ args('jni', 'release')
+}
+
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
@@ -21,6 +57,14 @@ android {
defaultConfig {
minSdkVersion 7
targetSdkVersion 21
+
+ tasks.whenTaskAdded { task ->
+ if (task.name == 'bundleDebug') {
+ task.dependsOn buildDebug
+ } else if (task.name == 'bundleRelease') {
+ task.dependsOn buildRelease
+ }
+ }
}
buildTypes {
diff --git a/vlc-android/build.gradle b/vlc-android/build.gradle
index 2be3dd0..ca6b3ad 100644
--- a/vlc-android/build.gradle
+++ b/vlc-android/build.gradle
@@ -1,41 +1,5 @@
apply plugin: 'com.android.application'
-
-task buildDebug(type:Exec) {
- /*
- Properties set for Android Studio own shell.
- when you run gradlew from cli, OS shell env variables will be used
-
- To be able to build from Android Studio, you have to set ndk.dir & sdk.dir
- properties in local.properties in the root folder, like this (for example):
- sdk.dir=/home/<username>/SDK/android-sdk-linux
- ndk.dir=/home/<username>/SDK/android-ndk-r10b
- */
- if (System.getenv('ANDROID_SDK') == null || System.getenv('ANDROID_NDK') == null) {
- Properties properties = new Properties()
- properties.load(project.rootProject.file('local.properties').newDataInputStream())
- environment 'ANDROID_NDK', properties.getProperty('ndk.dir')
- environment 'ANDROID_SDK', properties.getProperty('sdk.dir')
- environment 'ANDROID_ABI', 'armeabi-v7a x86'
- }
- workingDir '..'
- commandLine './compile.sh'
- args('jni')
-}
-task buildRelease(type:Exec) {
- if (System.getenv('ANDROID_SDK') == null || System.getenv('ANDROID_NDK') == null) {
- Properties properties = new Properties()
- properties.load(project.rootProject.file('local.properties').newDataInputStream())
- environment 'ANDROID_NDK', properties.getProperty('ndk.dir')
- environment 'ANDROID_SDK', properties.getProperty('sdk.dir')
- environment 'ANDROID_ABI', 'armeabi-v7a x86'
- }
-
- workingDir '..'
- commandLine './compile.sh'
- args('jni', 'release')
-}
-
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
@@ -71,35 +35,19 @@ android {
buildTypes {
release {
signingConfig signingConfigs.release
- tasks.assembleRelease.dependsOn buildRelease
minifyEnabled true
shrinkResources true
proguardFile 'proguard.cfg'
}
debug {
- tasks.assembleDebug.dependsOn buildDebug
debuggable true
}
}
productFlavors {
vanilla {
- tasks.whenTaskAdded { task ->
- if (task.name == 'assembleVanillaDebug') {
- task.dependsOn buildDebug
- } else if (task.name == 'assembleVanillaRelease') {
- task.dependsOn buildRelease
- }
- }
applicationId "org.videolan.vlc"
}
tv {
- tasks.whenTaskAdded { task ->
- if (task.name == 'assembleTvDebug') {
- task.dependsOn buildDebug
- } else if (task.name == 'assembleTvRelease') {
- task.dependsOn buildRelease
- }
- }
applicationId "org.videolan.vlc.tv"
minSdkVersion 17
}
More information about the Android
mailing list