2020-04-15 16:27:40 +02:00
|
|
|
apply plugin: 'com.android.library'
|
2020-05-24 12:55:48 +02:00
|
|
|
apply plugin: 'de.undercouch.download'
|
2020-04-15 16:27:40 +02:00
|
|
|
|
|
|
|
android {
|
|
|
|
compileSdkVersion 29
|
2021-01-20 23:31:59 +01:00
|
|
|
buildToolsVersion '30.0.3'
|
|
|
|
ndkVersion '22.0.7026061'
|
2020-04-15 16:27:40 +02:00
|
|
|
defaultConfig {
|
|
|
|
minSdkVersion 16
|
|
|
|
targetSdkVersion 29
|
|
|
|
externalNativeBuild {
|
|
|
|
ndkBuild {
|
2020-05-24 12:55:48 +02:00
|
|
|
arguments '-j' + Runtime.getRuntime().availableProcessors(),
|
2020-04-15 16:27:40 +02:00
|
|
|
"versionMajor=${versionMajor}",
|
|
|
|
"versionMinor=${versionMinor}",
|
|
|
|
"versionPatch=${versionPatch}",
|
|
|
|
"versionExtra=${versionExtra}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
externalNativeBuild {
|
|
|
|
ndkBuild {
|
|
|
|
path file('jni/Android.mk')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// supported architectures
|
|
|
|
splits {
|
|
|
|
abi {
|
|
|
|
enable true
|
|
|
|
reset()
|
|
|
|
include 'armeabi-v7a', 'arm64-v8a'//, 'x86'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
release {
|
|
|
|
externalNativeBuild {
|
|
|
|
ndkBuild {
|
|
|
|
arguments 'NDEBUG=1'
|
|
|
|
}
|
|
|
|
}
|
2021-10-15 18:14:48 +02:00
|
|
|
|
|
|
|
ndk {
|
|
|
|
debugSymbolLevel 'SYMBOL_TABLE'
|
|
|
|
}
|
2020-04-15 16:27:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-24 12:55:48 +02:00
|
|
|
// get precompiled deps
|
|
|
|
def folder = 'minetest_android_deps_binaries'
|
|
|
|
|
|
|
|
task downloadDeps(type: Download) {
|
|
|
|
src 'https://github.com/minetest/' + folder + '/archive/master.zip'
|
|
|
|
dest new File(buildDir, 'deps.zip')
|
|
|
|
overwrite false
|
|
|
|
}
|
|
|
|
|
|
|
|
task getDeps(dependsOn: downloadDeps, type: Copy) {
|
|
|
|
def deps = file('deps')
|
|
|
|
def f = file("$buildDir/" + folder + "-master")
|
|
|
|
|
|
|
|
if (!deps.exists() && !f.exists()) {
|
|
|
|
from zipTree(downloadDeps.dest)
|
|
|
|
into buildDir
|
|
|
|
}
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
if (!deps.exists()) {
|
|
|
|
file(f).renameTo(file(deps))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// get sqlite
|
2021-01-20 23:31:59 +01:00
|
|
|
def sqlite_ver = '3340000'
|
2020-05-24 12:55:48 +02:00
|
|
|
task downloadSqlite(dependsOn: getDeps, type: Download) {
|
|
|
|
src 'https://www.sqlite.org/2020/sqlite-amalgamation-' + sqlite_ver + '.zip'
|
|
|
|
dest new File(buildDir, 'sqlite.zip')
|
|
|
|
overwrite false
|
|
|
|
}
|
|
|
|
|
|
|
|
task getSqlite(dependsOn: downloadSqlite, type: Copy) {
|
|
|
|
def sqlite = file('deps/Android/sqlite')
|
|
|
|
def f = file("$buildDir/sqlite-amalgamation-" + sqlite_ver)
|
|
|
|
|
|
|
|
if (!sqlite.exists() && !f.exists()) {
|
|
|
|
from zipTree(downloadSqlite.dest)
|
|
|
|
into buildDir
|
|
|
|
}
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
if (!sqlite.exists()) {
|
|
|
|
file(f).renameTo(file(sqlite))
|
|
|
|
}
|
2020-04-15 16:27:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-24 12:55:48 +02:00
|
|
|
preBuild.dependsOn getDeps
|
|
|
|
preBuild.dependsOn getSqlite
|