minetest/android/app/build.gradle

123 lines
2.8 KiB
Groovy
Raw Normal View History

apply plugin: 'com.android.application'
android {
ndkVersion "$ndk_version"
defaultConfig {
applicationId 'net.minetest.minetest'
minSdkVersion 21
2024-08-02 00:13:13 +02:00
compileSdk 34
targetSdkVersion 34
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
versionCode versionMajor * 1000000 + versionMinor * 10000 + versionPatch * 100 + versionBuild
}
2024-08-02 00:13:13 +02:00
buildFeatures {
buildConfig true
}
2020-05-24 12:57:05 +02:00
// load properties
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))
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()
include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
2024-08-02 00:13:13 +02:00
namespace 'net.minetest.minetest'
}
task prepareAssets() {
def assetsFolder = "build/assets"
def projRoot = rootDir.parent
// See issue #4638
def unsupportedLanguages = new File("${projRoot}/src/unsupported_language_list.txt").text.readLines()
doFirst {
logger.lifecycle('Preparing assets at {}', assetsFolder)
}
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 "${projRoot}/irr/media/Shaders" into "${assetsFolder}/client/shaders/Irrlicht"
}
copy {
from "${projRoot}/fonts" include "*.ttf" into "${assetsFolder}/fonts"
}
copy {
from "${projRoot}/textures/base/pack" into "${assetsFolder}/textures/base/pack"
}
// compile translations
fileTree("${projRoot}/po").include("**/*.po").grep {
it.parentFile.name !in unsupportedLanguages
}.forEach { poFile ->
def moPath = "${assetsFolder}/locale/${poFile.parentFile.name}/LC_MESSAGES/"
file(moPath).mkdirs()
exec {
commandLine 'msgfmt', '-o', "${moPath}/minetest.mo", poFile
}
}
file("${assetsFolder}/.nomedia").text = ""
}
task zipAssets(dependsOn: prepareAssets, type: Zip) {
archiveFileName = "Minetest.zip"
from assetsFolder
destinationDirectory = file("src/main/assets")
}
}
preBuild.dependsOn zipAssets
prepareAssets.dependsOn ':native:getDeps'
2024-02-18 15:23:37 +01:00
clean {
delete new File("src/main/assets", "Minetest.zip")
}
dependencies {
implementation project(':native')
implementation 'androidx.appcompat:appcompat:1.6.1'
}