1
0

127 lines
3.0 KiB
Groovy
Raw Normal View History

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
2022-08-06 23:03:24 +02:00
compileSdkVersion 33
2023-02-23 23:58:24 +02:00
buildToolsVersion '33.0.2'
ndkVersion '25.2.9519653'
defaultConfig {
2020-09-04 20:04:28 +02:00
applicationId 'com.multicraft.game'
minSdkVersion 21
2022-08-06 23:03:24 +02:00
targetSdkVersion 33
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
versionCode project.versionCode
}
2020-09-04 20:04:28 +02:00
// load properties
Properties props = new Properties()
2020-09-04 20:04:28 +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 {
2020-09-04 20:04:28 +02:00
shrinkResources true
minifyEnabled true
signingConfig signingConfigs.release
}
2020-09-04 20:04:28 +02:00
debug {
debuggable true
minifyEnabled false
}
}
}
// for multiple APKs
splits {
abi {
enable true
reset()
include 'armeabi-v7a', 'arm64-v8a', 'x86_64'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
namespace = "com.multicraft.game"
}
2020-09-04 20:04:28 +02:00
import org.apache.tools.ant.taskdefs.condition.Os
task prepareAssetsFiles() {
def assetsFolder = "build/assets/Files"
def projRoot = "../.."
copy {
2020-09-04 20:04:28 +02:00
from "${projRoot}/builtin" into "${assetsFolder}/builtin" exclude '*.txt'
}
copy {
from "${projRoot}/client/shaders" into "${assetsFolder}/client/shaders"
2020-09-04 20:04:28 +02:00
}
copy {
from "../native/deps/irrlicht/shaders" into "${assetsFolder}/client/shaders/Irrlicht"
}
copy {
2022-01-24 01:23:43 +01:00
from "${projRoot}/fonts/MultiCraftFont.ttf" into "${assetsFolder}/fonts"
}
2020-09-04 20:04:28 +02:00
fileTree("${projRoot}/po").include("**/*.po").forEach { poFile ->
def moPath = "${assetsFolder}/locale/${poFile.parentFile.name}/LC_MESSAGES/"
file(moPath).mkdirs()
if (!Os.isFamily(Os.FAMILY_WINDOWS)) {
exec {
commandLine 'msgfmt', '-o', "${moPath}/minetest.mo", poFile
}
}
}
copy {
2020-09-04 20:04:28 +02:00
from "${projRoot}/textures" into "${assetsFolder}/textures" exclude '*.txt'
}
2020-09-04 20:04:28 +02:00
task zipAssetsFiles(type: Zip) {
archiveFileName = "Files.zip"
destinationDirectory = file("src/main/assets/data")
from "${assetsFolder}"
}
}
2020-09-04 20:04:28 +02:00
preBuild.dependsOn zipAssetsFiles
// Map for the version code that gives each ABI a value.
def abiCodes = ['armeabi-v7a': 0, 'arm64-v8a': 1, 'x86_64': 2]
android.applicationVariants.all { variant ->
variant.outputs.each {
output ->
2022-05-16 16:31:30 +03:00
def abiName = output.filters[0].identifier
output.versionCodeOverride = abiCodes.get(abiName, 0) + variant.versionCode
}
}
dependencies {
2020-09-04 20:04:28 +02:00
/* MultiCraft Native */
implementation project(':native')
2020-09-04 20:04:28 +02:00
/* Third-party libraries */
2023-02-23 23:58:24 +02:00
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.appcompat:appcompat-resources:1.6.1'
2022-08-06 23:03:24 +02:00
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
2023-02-23 23:58:24 +02:00
implementation 'androidx.work:work-runtime-ktx:2.8.0'
implementation 'com.google.android.material:material:1.8.0'
}