mirror of
https://github.com/love2d/love-android.git
synced 2026-08-12 08:31:04 +02:00
07088eee88
Support for Jelly Bean has been gone the moment we update NDK toolchain version. See #279 for the rational on this change.
123 lines
3.6 KiB
Groovy
123 lines
3.6 KiB
Groovy
apply plugin: 'com.android.library'
|
|
|
|
android {
|
|
// If you want to use the debugger for JNI code, you want to debug this lib-project in Debug!
|
|
// And due to gradle limitations/bugs, the best way is to always debug it in debug.
|
|
// See https://code.google.com/p/android/issues/detail?id=52962
|
|
// and http://stackoverflow.com/questions/27277433/why-does-gradle-build-my-module-in-release-mode-when-the-app-is-in-debug
|
|
// defaultPublishConfig "debug"
|
|
namespace "org.love2d.android"
|
|
ndkVersion '25.2.9519653'
|
|
|
|
defaultConfig {
|
|
minSdk 18
|
|
compileSdk 34
|
|
targetSdk 34
|
|
externalNativeBuild {
|
|
ndkBuild {
|
|
arguments "-j" + Runtime.runtime.availableProcessors()
|
|
}
|
|
}
|
|
ndk {
|
|
// Specifies the ABI configurations of your native
|
|
// libraries Gradle should build and package with your APK.
|
|
// noinspection ChromeOsAbiSupport
|
|
abiFilters 'armeabi-v7a', 'arm64-v8a'
|
|
debugSymbolLevel 'SYMBOL_TABLE'
|
|
}
|
|
}
|
|
|
|
def retrieveAll3pModules = { ->
|
|
def modules = []
|
|
|
|
fileTree("src/jni/lua-modules").visit { FileVisitDetails details ->
|
|
if (details.isDirectory()) {
|
|
if (file(details.file.path + "/Android.mk").exists()) {
|
|
def logger = project.getLogger()
|
|
logger.lifecycle("3rd-party module: " + details.file.path)
|
|
|
|
def javainfo = file(details.file.path + "/java.txt")
|
|
if (javainfo.exists()) {
|
|
def fstream = new FileInputStream(javainfo)
|
|
def infile = new BufferedReader(new InputStreamReader(fstream))
|
|
def javapath = infile.readLine().replace("\\", "/")
|
|
def mpath = ""
|
|
|
|
if (javapath[0] != '/') {
|
|
mpath = details.file.path + "/" + javapath
|
|
} else {
|
|
mpath = details.file.path + javapath
|
|
}
|
|
|
|
modules << mpath
|
|
|
|
logger.lifecycle("Registered path " + mpath)
|
|
infile.close()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return modules
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
minifyEnabled true
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
}
|
|
debug {
|
|
ndk {
|
|
// noinspection ChromeOsAbiSupport
|
|
abiFilters += 'x86_64'
|
|
}
|
|
}
|
|
}
|
|
flavorDimensions = ['mode']
|
|
productFlavors {
|
|
normal {
|
|
dimension 'mode'
|
|
}
|
|
embed {
|
|
dimension 'mode'
|
|
}
|
|
}
|
|
sourceSets {
|
|
main {
|
|
java {
|
|
srcDir 'src/jni/SDL2/android-project/app/src/main/java'
|
|
srcDir 'src/main/java'
|
|
srcDirs += retrieveAll3pModules()
|
|
}
|
|
}
|
|
normal {
|
|
java {
|
|
srcDirs += 'src/normal/java'
|
|
}
|
|
}
|
|
}
|
|
externalNativeBuild {
|
|
ndkBuild {
|
|
path 'src/jni/Android.mk'
|
|
}
|
|
}
|
|
packagingOptions {
|
|
jniLibs {
|
|
excludes += [
|
|
'lib/arm64-v8a/libSDL2.so',
|
|
'lib/armeabi-v7a/libSDL2.so',
|
|
'lib/x86_64/libSDL2.so',
|
|
'lib/x86/libSDL2.so'
|
|
]
|
|
}
|
|
}
|
|
lint {
|
|
abortOnError false
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
api fileTree(dir: 'libs', include: ['*.jar'])
|
|
api 'androidx.appcompat:appcompat:1.6.1'
|
|
}
|