83 lines
2.3 KiB
Groovy
83 lines
2.3 KiB
Groovy
plugins {
|
|
id 'org.tboox.gradle-xmake-plugin' version '1.1.6'
|
|
}
|
|
|
|
def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY');
|
|
def buildAsApplication = !buildAsLibrary
|
|
if (buildAsApplication) {
|
|
apply plugin: 'com.android.application'
|
|
}
|
|
else {
|
|
apply plugin: 'com.android.library'
|
|
}
|
|
|
|
android {
|
|
if (buildAsApplication) {
|
|
namespace "org.blitz.Blitz"
|
|
}
|
|
compileSdkVersion 34
|
|
defaultConfig {
|
|
minSdkVersion 19
|
|
targetSdkVersion 34
|
|
versionCode 1
|
|
versionName "1.0"
|
|
externalNativeBuild {
|
|
xmake {
|
|
// set abi filters (optional), e.g. armeabi, armeabi-v7a, arm64-v8a, x86, x86_64
|
|
// we can also get abiFilters from defaultConfig.ndk.abiFilters
|
|
abiFilters "armeabi-v7a", "arm64-v8a"
|
|
}
|
|
}
|
|
}
|
|
buildTypes {
|
|
debug {
|
|
debuggable true
|
|
if (project.hasProperty('debugBuild')) {
|
|
xmake {
|
|
// set abi filters (optional), e.g. armeabi, armeabi-v7a, arm64-v8a, x86, x86_64
|
|
// we can also get abiFilters from defaultConfig.ndk.abiFilters
|
|
buildMode "debug"
|
|
}
|
|
}
|
|
}
|
|
release {
|
|
minifyEnabled false
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
}
|
|
}
|
|
applicationVariants.all { variant ->
|
|
tasks["merge${variant.name.capitalize()}Assets"]
|
|
.dependsOn("externalNativeBuild${variant.name.capitalize()}")
|
|
}
|
|
if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) {
|
|
externalNativeBuild {
|
|
xmake {
|
|
path "jni/Blitz/xmake.lua"
|
|
}
|
|
ndkBuild {
|
|
path 'jni/Android.mk'
|
|
}
|
|
}
|
|
|
|
}
|
|
lint {
|
|
abortOnError false
|
|
}
|
|
|
|
if (buildAsLibrary) {
|
|
libraryVariants.all { variant ->
|
|
variant.outputs.each { output ->
|
|
def outputFile = output.outputFile
|
|
if (outputFile != null && outputFile.name.endsWith(".aar")) {
|
|
def fileName = "org.blitz.Blitz.aar";
|
|
output.outputFile = new File(outputFile.parent, fileName);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
|
}
|