132 lines
3.1 KiB
Groovy
132 lines
3.1 KiB
Groovy
apply plugin: 'com.android.application'
|
|
apply plugin: 'kotlin-android'
|
|
|
|
android {
|
|
compileSdkVersion 33
|
|
buildToolsVersion '33.0.2'
|
|
ndkVersion '25.2.9519653'
|
|
defaultConfig {
|
|
applicationId 'com.multicraft.game'
|
|
minSdkVersion 21
|
|
targetSdkVersion 33
|
|
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
|
|
versionCode project.versionCode
|
|
}
|
|
|
|
// load properties
|
|
Properties props = new Properties()
|
|
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 {
|
|
shrinkResources true
|
|
minifyEnabled true
|
|
signingConfig signingConfigs.release
|
|
}
|
|
debug {
|
|
debuggable true
|
|
minifyEnabled false
|
|
}
|
|
}
|
|
}
|
|
|
|
// for multiple APKs
|
|
splits {
|
|
abi {
|
|
enable true
|
|
reset()
|
|
//noinspection ChromeOsAbiSupport
|
|
include 'armeabi-v7a', 'arm64-v8a', 'x86_64'
|
|
}
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_17
|
|
targetCompatibility JavaVersion.VERSION_17
|
|
}
|
|
|
|
kotlinOptions.jvmTarget = "17"
|
|
|
|
buildFeatures {
|
|
viewBinding true
|
|
}
|
|
namespace = "com.multicraft.game"
|
|
}
|
|
|
|
import org.apache.tools.ant.taskdefs.condition.Os
|
|
|
|
tasks.register('prepareAssetsFiles') {
|
|
def assetsFolder = "build/assets/Files"
|
|
def projRoot = "../.."
|
|
|
|
copy {
|
|
from "${projRoot}/builtin" into "${assetsFolder}/builtin" exclude '*.txt'
|
|
}
|
|
copy {
|
|
from "${projRoot}/client/shaders" into "${assetsFolder}/client/shaders"
|
|
}
|
|
copy {
|
|
from "../native/deps/irrlicht/shaders" into "${assetsFolder}/client/shaders/Irrlicht"
|
|
}
|
|
copy {
|
|
from "${projRoot}/fonts/MultiCraftFont.ttf" into "${assetsFolder}/fonts"
|
|
}
|
|
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 {
|
|
from "${projRoot}/textures" into "${assetsFolder}/textures" exclude '*.txt'
|
|
}
|
|
}
|
|
|
|
tasks.register('zipAssetsFiles', Zip) {
|
|
dependsOn prepareAssetsFiles
|
|
archiveFileName = 'assets.zip'
|
|
destinationDirectory = file('src/main/assets/data')
|
|
from('build/assets/Files')
|
|
}
|
|
|
|
tasks.named("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.configureEach { variant ->
|
|
variant.outputs.each {
|
|
output ->
|
|
def abiName = output.filters[0].identifier
|
|
output.versionCodeOverride = abiCodes.get(abiName, 0) + variant.versionCode
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
/* MultiCraft Native */
|
|
implementation project(':native')
|
|
|
|
/* Third-party libraries */
|
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
|
implementation 'androidx.appcompat:appcompat-resources:1.6.1'
|
|
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
|
|
implementation 'androidx.work:work-runtime-ktx:2.8.1'
|
|
implementation 'com.google.android.material:material:1.9.0'
|
|
}
|