[Android] Restore native builds in gradle for debug

Geoffrey Métais git at videolan.org
Tue Feb 10 11:09:37 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Feb 10 11:06:13 2015 +0100| [f1c96170d05925c2cbe4ef7f2177c56d753a581a] | committer: Geoffrey Métais

Restore native builds in gradle for debug

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=f1c96170d05925c2cbe4ef7f2177c56d753a581a
---

 libvlc/build.gradle      |   83 ++++++++++++++++++++++++++++------------------
 vlc-android/build.gradle |   20 +++++++++--
 2 files changed, 67 insertions(+), 36 deletions(-)

diff --git a/libvlc/build.gradle b/libvlc/build.gradle
index 6bade1d..a26d664 100644
--- a/libvlc/build.gradle
+++ b/libvlc/build.gradle
@@ -1,38 +1,5 @@
 apply plugin: 'com.android.library'
 
-
-task buildDebugARM(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')
-    }
-    workingDir '..'
-    commandLine './compile-libvlc.sh'
-    args('-a', "armeabi-v7a")
-}
-task buildDebugx86(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')
-    }
-    workingDir '..'
-    commandLine './compile-libvlc.sh'
-    args('-a', "x86")
-}
-
 android {
     compileSdkVersion rootProject.ext.compileSdkVersion
     buildToolsVersion rootProject.ext.buildToolsVersion
@@ -63,3 +30,53 @@ android {
         }
     }
 }
+
+class BuildNative extends Exec {}
+
+tasks.withType(BuildNative){
+    /*
+    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')
+    }
+    workingDir '..'
+    commandLine './compile-libvlc.sh'
+}
+
+task buildDebugARMv5(type:BuildNative) {
+    args('-a', "armeabi-v5")
+}
+task buildDebugARMv6(type:BuildNative) {
+    args('-a', "armeabi")
+}
+task buildDebugARMv6_nofpu(type:BuildNative) {
+    args('-a', "armeabi-nofpu")
+}
+task buildDebugARMv7(type:BuildNative) {
+    args('-a', "armeabi-v7a")
+}
+task buildDebugARM64(type:BuildNative) {
+    args('-a', "armeabi-v8a")
+}
+task buildDebugx86(type:BuildNative) {
+    args('-a', "x86")
+}
+task buildDebugx86_64(type:BuildNative) {
+    args('-a', "x86_64")
+}
+task buildDebugMIPS(type:BuildNative) {
+    args('-a', "mips")
+}
+task buildDebugMIPS64(type:BuildNative) {
+    args('-a', "mips64")
+}
diff --git a/vlc-android/build.gradle b/vlc-android/build.gradle
index 038e2fa..887c26c 100644
--- a/vlc-android/build.gradle
+++ b/vlc-android/build.gradle
@@ -19,10 +19,24 @@ android {
         //Set the build ABI according to build types
         tasks.whenTaskAdded { task ->
             if (task.name.startsWith('assemble')) {
-                if (task.name.endsWith('Debug'))
-                    task.dependsOn(":libvlc:buildDebugARM")
-                else if (task.name.endsWith('Debugx86'))
+                if (task.name.endsWith('ARMv5Debug'))
+                    task.dependsOn(":libvlc:buildDebugARMv5")
+                else if (task.name.endsWith('ARMv6fpuDebug'))
+                    task.dependsOn(":libvlc:buildDebugARMv6")
+                else if (task.name.endsWith('ARMv6nofpuDebug'))
+                    task.dependsOn(":libvlc:buildDebugARMv6_nofpu")
+                else if (task.name.endsWith('ARMv7Debug'))
+                    task.dependsOn(":libvlc:buildDebugARMv7")
+                else if (task.name.endsWith('ARMv8Debug'))
+                    task.dependsOn(":libvlc:buildDebugARM64")
+                else if (task.name.endsWith('X86Debug'))
                     task.dependsOn(":libvlc:buildDebugx86")
+                else if (task.name.endsWith('X86_64Debug'))
+                    task.dependsOn(":libvlc:buildDebugx86_64")
+                else if (task.name.endsWith('MIPSDebug'))
+                    task.dependsOn(":libvlc:buildDebugMIPS")
+                else if (task.name.endsWith('MIPS64Debug'))
+                    task.dependsOn(":libvlc:buildDebugMIPS64")
             }
         }
     }



More information about the Android mailing list