mirror of
https://github.com/minetest/minetest.git
synced 2024-11-24 00:23:46 +01:00
109 lines
2.5 KiB
Groovy
109 lines
2.5 KiB
Groovy
apply plugin: 'com.android.application'
|
|
android {
|
|
compileSdkVersion 29
|
|
buildToolsVersion '29.0.3'
|
|
ndkVersion '21.0.6113669'
|
|
defaultConfig {
|
|
applicationId 'net.minetest.minetest'
|
|
minSdkVersion 16
|
|
//noinspection OldTargetApi
|
|
targetSdkVersion 28 // Workaround for using `/sdcard` instead of the `data` patch for assets
|
|
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
|
|
versionCode project.versionCode
|
|
}
|
|
|
|
Properties props = new Properties()
|
|
props.load(new FileInputStream(file('../local.properties')))
|
|
|
|
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"
|
|
def projRoot = "../../.."
|
|
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}"
|
|
rename("lgpl-2.1.txt", "LICENSE.txt")
|
|
}
|
|
copy {
|
|
from "${projRoot}/builtin" into "${assetsFolder}/builtin"
|
|
}
|
|
copy {
|
|
from "${projRoot}/client/shaders" into "${assetsFolder}/client/shaders"
|
|
}
|
|
copy {
|
|
from "${projRoot}/fonts" include "*.ttf" into "${assetsFolder}/fonts"
|
|
}
|
|
copy {
|
|
from "${projRoot}/games/${gameToCopy}" into "${assetsFolder}/games/${gameToCopy}"
|
|
}
|
|
/*copy {
|
|
// locales broken right now
|
|
// ToDo: fix it!
|
|
from "${projRoot}/po" into "${assetsFolder}/po"
|
|
}*/
|
|
copy {
|
|
from "${projRoot}/textures" into "${assetsFolder}/textures"
|
|
}
|
|
|
|
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')
|
|
implementation 'androidx.appcompat:appcompat:1.1.0'
|
|
}
|