2020-04-15 16:27:40 +02:00
|
|
|
apply plugin: 'com.android.application'
|
|
|
|
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 {
|
|
|
|
applicationId 'net.minetest.minetest'
|
|
|
|
minSdkVersion 16
|
2020-05-04 08:47:00 +02:00
|
|
|
targetSdkVersion 29
|
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()
|
|
|
|
include 'armeabi-v7a', 'arm64-v8a'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
compileOptions {
|
|
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task prepareAssets() {
|
|
|
|
def assetsFolder = "build/assets"
|
2021-06-21 21:51:42 +02:00
|
|
|
def projRoot = "../.."
|
2020-04-15 16:27:40 +02:00
|
|
|
def gameToCopy = "minetest_game"
|
|
|
|
|
|
|
|
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"
|
|
|
|
}
|
2020-10-25 18:01:03 +01:00
|
|
|
copy {
|
2020-04-15 16:27:40 +02:00
|
|
|
from "${projRoot}/client/shaders" into "${assetsFolder}/client/shaders"
|
2020-10-25 18:01:03 +01:00
|
|
|
}
|
2020-04-22 20:03:46 +02:00
|
|
|
copy {
|
|
|
|
from "../native/deps/Android/Irrlicht/shaders" into "${assetsFolder}/client/shaders/Irrlicht"
|
2020-04-15 16:27:40 +02:00
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from "${projRoot}/fonts" include "*.ttf" into "${assetsFolder}/fonts"
|
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from "${projRoot}/games/${gameToCopy}" into "${assetsFolder}/games/${gameToCopy}"
|
|
|
|
}
|
2021-08-08 18:59:07 +02:00
|
|
|
fileTree("${projRoot}/po").include("**/*.po").forEach { poFile ->
|
|
|
|
def moPath = "${assetsFolder}/locale/${poFile.parentFile.name}/LC_MESSAGES/"
|
|
|
|
file(moPath).mkdirs()
|
|
|
|
exec {
|
|
|
|
commandLine 'msgfmt', '-o', "${moPath}/minetest.mo", poFile
|
|
|
|
}
|
|
|
|
}
|
2020-04-15 16:27:40 +02:00
|
|
|
copy {
|
|
|
|
from "${projRoot}/textures" into "${assetsFolder}/textures"
|
|
|
|
}
|
|
|
|
|
2020-06-18 19:24:38 +02:00
|
|
|
file("${assetsFolder}/.nomedia").text = "";
|
|
|
|
|
2020-04-15 16:27:40 +02:00
|
|
|
task zipAssets(type: Zip) {
|
|
|
|
archiveName "Minetest.zip"
|
|
|
|
from "${assetsFolder}"
|
|
|
|
destinationDir file("src/main/assets")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
preBuild.dependsOn zipAssets
|
|
|
|
|
|
|
|
// 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')
|
2020-09-07 22:12:31 +02:00
|
|
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
2020-04-15 16:27:40 +02:00
|
|
|
}
|