Commit f1c96170 authored by Geoffrey Métais's avatar Geoffrey Métais

Restore native builds in gradle for debug

parent b80fc1cb
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")
}
......@@ -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")
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment