mirror of
https://github.com/love2d/love-android.git
synced 2026-08-12 08:31:04 +02:00
8a27486c63
Fixes #247
143 lines
4.5 KiB
Groovy
143 lines
4.5 KiB
Groovy
plugins {
|
|
id 'com.android.application'
|
|
}
|
|
|
|
android {
|
|
namespace "org.love2d.android"
|
|
compileSdk 33
|
|
ndkVersion "25.2.9519653"
|
|
|
|
defaultConfig {
|
|
applicationId "org.love2d.android"
|
|
versionCode 32
|
|
versionName "12.0"
|
|
minSdk 21
|
|
targetSdk 33
|
|
externalNativeBuild {
|
|
cmake {
|
|
arguments "-DANDROID_STL=c++_shared"
|
|
// For unknown reason, transitive shared library is not taken into account, this
|
|
// result in liboboe.so and libluajit.so not get included into the final APK. "love"
|
|
// target depends on LuaJIT, and OpenAL that depends on oboe::oboe. So, add "OpenAL"
|
|
// and "love" target.
|
|
targets "love_android", "OpenAL", "love"
|
|
}
|
|
}
|
|
}
|
|
|
|
def retrieveAll3pModules = { ->
|
|
def modules = []
|
|
|
|
fileTree("src/main/cpp/lua-modules/").visit { FileVisitDetails details ->
|
|
if (details.isDirectory()) {
|
|
if (file(details.file.path + "/Android.mk").exists() ||
|
|
file(details.file.path + "/CMakeLists.mk").exists()) {
|
|
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 = null
|
|
|
|
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 false
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
}
|
|
}
|
|
|
|
buildFeatures {
|
|
prefab true
|
|
}
|
|
|
|
flavorDimensions 'mode', 'recording'
|
|
productFlavors {
|
|
normal {
|
|
dimension 'mode'
|
|
}
|
|
embed {
|
|
dimension 'mode'
|
|
}
|
|
record {
|
|
dimension 'recording'
|
|
}
|
|
noRecord {
|
|
dimension 'recording'
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
java {
|
|
srcDir 'src/main/cpp/megasource/libs/SDL2/android-project/app/src/main/java'
|
|
srcDir 'src/main/java'
|
|
srcDir 'src/main/cpp/love/src/libraries/luahttps/src/android/java'
|
|
srcDirs += retrieveAll3pModules()
|
|
}
|
|
}
|
|
normal {
|
|
java {
|
|
srcDir 'src/normal/java'
|
|
}
|
|
}
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
}
|
|
buildFeatures {
|
|
viewBinding true
|
|
}
|
|
externalNativeBuild {
|
|
cmake {
|
|
path file('src/main/cpp/CMakeLists.txt')
|
|
// '+' notation apparently has been supported long time ago
|
|
// https://issuetracker.google.com/issues/110693527#comment22
|
|
// We require CMake 3.21 because r23 has important fixes
|
|
// that's only fixed if CMake 3.21 is used.
|
|
// https://github.com/android/ndk/issues/463
|
|
version '3.21.0+'
|
|
}
|
|
}
|
|
packagingOptions {
|
|
// Due to inclusion of "OpenAL" target, these files are included too, but this
|
|
// file is provided by Android as public API. Exclude them!
|
|
exclude 'lib/armeabi-v7a/libOpenSLES.so'
|
|
exclude 'lib/arm64-v8a/libOpenSLES.so'
|
|
exclude 'lib/x86/libOpenSLES.so'
|
|
exclude 'lib/x86_64/libOpenSLES.so'
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation 'androidx.appcompat:appcompat:1.5.1'
|
|
implementation 'com.google.android.material:material:1.7.0'
|
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
|
implementation 'androidx.navigation:navigation-fragment:2.5.3'
|
|
implementation 'androidx.navigation:navigation-ui:2.5.3'
|
|
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
|
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
|
implementation 'com.google.oboe:oboe:1.7.0'
|
|
}
|