2020-04-15 16:27:40 +02:00
|
|
|
apply plugin: 'com.android.application'
|
2023-02-18 00:03:28 +01:00
|
|
|
|
2020-04-15 16:27:40 +02:00
|
|
|
android {
|
2023-02-18 00:03:28 +01:00
|
|
|
compileSdkVersion 33
|
|
|
|
buildToolsVersion '33.0.2'
|
2021-10-31 23:32:25 +01:00
|
|
|
ndkVersion "$ndk_version"
|
2020-04-15 16:27:40 +02:00
|
|
|
defaultConfig {
|
|
|
|
applicationId 'net.minetest.minetest'
|
2023-02-18 00:03:28 +01:00
|
|
|
minSdkVersion 21
|
|
|
|
targetSdkVersion 33
|
2020-04-15 16:27:40 +02:00
|
|
|
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
|
|
|
|
versionCode project.versionCode
|
|
|
|
}
|
|
|
|
|
2020-05-24 12:57:05 +02:00
|
|
|
// load properties
|
2020-04-15 16:27:40 +02:00
|
|
|
Properties props = new Properties()
|
2020-05-24 12:57:05 +02:00
|
|
|
def propfile = file('../local.properties')
|
|
|
|
if (propfile.exists())
|
|
|
|
props.load(new FileInputStream(propfile))
|
2020-04-15 16:27:40 +02:00
|
|
|
|
|
|
|
if (props.getProperty('keystore') != null) {
|
|
|
|
signingConfigs {
|
|
|
|
release {
|
|
|
|
storeFile file(props['keystore'])
|
|
|
|
storePassword props['keystore.password']
|
|
|
|
keyAlias props['key']
|
|
|
|
keyPassword props['key.password']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
release {
|
|
|
|
minifyEnabled true
|
|
|
|
signingConfig signingConfigs.release
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// for multiple APKs
|
|
|
|
splits {
|
|
|
|
abi {
|
|
|
|
enable true
|
|
|
|
reset()
|
2022-08-25 23:48:49 +02:00
|
|
|
include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
2020-04-15 16:27:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
compileOptions {
|
|
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task prepareAssets() {
|
|
|
|
def assetsFolder = "build/assets"
|
2023-02-23 11:32:42 +01:00
|
|
|
def projRoot = rootDir.parent
|
2020-04-15 16:27:40 +02:00
|
|
|
|
2023-10-05 17:29:02 +02:00
|
|
|
// See issue #4638
|
|
|
|
def unsupportedLanguages = new File("${projRoot}/src/unsupported_language_list.txt").text.readLines()
|
|
|
|
|
2023-02-23 11:32:42 +01:00
|
|
|
doFirst {
|
|
|
|
logger.lifecycle('Preparing assets at {}', assetsFolder)
|
2020-04-15 16:27:40 +02:00
|
|
|
}
|
2023-02-23 11:32:42 +01:00
|
|
|
doLast {
|
|
|
|
copy {
|
|
|
|
from "${projRoot}/minetest.conf.example", "${projRoot}/README.md" into assetsFolder
|
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from "${projRoot}/doc/lgpl-2.1.txt" into assetsFolder
|
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from "${projRoot}/builtin" into "${assetsFolder}/builtin"
|
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from "${projRoot}/client/shaders" into "${assetsFolder}/client/shaders"
|
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from "../native/deps/armeabi-v7a/Irrlicht/Shaders" into "${assetsFolder}/client/shaders/Irrlicht"
|
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from "${projRoot}/fonts" include "*.ttf" into "${assetsFolder}/fonts"
|
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from "${projRoot}/textures" into "${assetsFolder}/textures"
|
2021-08-08 18:59:07 +02:00
|
|
|
}
|
2020-04-15 16:27:40 +02:00
|
|
|
|
2023-02-23 11:32:42 +01:00
|
|
|
// compile translations
|
2023-10-05 17:29:02 +02:00
|
|
|
fileTree("${projRoot}/po").include("**/*.po").grep {
|
|
|
|
it.parentFile.name !in unsupportedLanguages
|
|
|
|
}.forEach { poFile ->
|
2023-02-23 11:32:42 +01:00
|
|
|
def moPath = "${assetsFolder}/locale/${poFile.parentFile.name}/LC_MESSAGES/"
|
|
|
|
file(moPath).mkdirs()
|
|
|
|
exec {
|
|
|
|
commandLine 'msgfmt', '-o', "${moPath}/minetest.mo", poFile
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
file("${assetsFolder}/.nomedia").text = ""
|
|
|
|
}
|
2020-06-18 19:24:38 +02:00
|
|
|
|
2023-02-23 11:32:42 +01:00
|
|
|
task zipAssets(dependsOn: prepareAssets, type: Zip) {
|
2022-10-31 14:19:30 +01:00
|
|
|
archiveFileName = "Minetest.zip"
|
2023-02-23 11:32:42 +01:00
|
|
|
from assetsFolder
|
2022-10-31 14:19:30 +01:00
|
|
|
destinationDirectory = file("src/main/assets")
|
2020-04-15 16:27:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
preBuild.dependsOn zipAssets
|
2023-02-23 11:32:42 +01:00
|
|
|
prepareAssets.dependsOn ':native:getDeps'
|
2020-04-15 16:27:40 +02:00
|
|
|
|
|
|
|
// Map for the version code that gives each ABI a value.
|
|
|
|
import com.android.build.OutputFile
|
|
|
|
|
|
|
|
def abiCodes = ['armeabi-v7a': 0, 'arm64-v8a': 1]
|
|
|
|
android.applicationVariants.all { variant ->
|
|
|
|
variant.outputs.each {
|
|
|
|
output ->
|
|
|
|
def abiName = output.getFilter(OutputFile.ABI)
|
|
|
|
output.versionCodeOverride = abiCodes.get(abiName, 0) + variant.versionCode
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
implementation project(':native')
|
2023-02-18 00:03:28 +01:00
|
|
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
2020-04-15 16:27:40 +02:00
|
|
|
}
|