1
0

133 lines
3.2 KiB
Groovy
Raw Normal View History

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
2023-10-26 21:25:16 +06:00
compileSdkVersion 34
buildToolsVersion '34.0.0'
2023-02-23 23:58:24 +02:00
ndkVersion '25.2.9519653'
defaultConfig {
2020-09-04 20:04:28 +02:00
applicationId 'com.multicraft.game'
minSdkVersion 21
2023-10-26 21:25:16 +06:00
targetSdkVersion 34
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()
//noinspection ChromeOsAbiSupport
include 'armeabi-v7a', 'arm64-v8a', 'x86_64'
}
}
compileOptions {
2023-05-06 02:15:16 +03:00
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
2023-05-06 02:15:16 +03:00
kotlinOptions.jvmTarget = "17"
buildFeatures {
viewBinding true
}
namespace = "com.multicraft.game"
}
2020-09-04 20:04:28 +02:00
import org.apache.tools.ant.taskdefs.condition.Os
tasks.register('prepareAssetsFiles') {
2020-09-04 20:04:28 +02:00
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'
}
}
tasks.register('zipAssetsFiles', Zip) {
dependsOn prepareAssetsFiles
archiveFileName = 'assets.zip'
2023-10-26 21:25:16 +06:00
destinationDirectory = file('src/main/assets')
from('build/assets/Files')
}
tasks.named("preBuild") {
dependsOn(zipAssetsFiles)
}
2020-09-04 20:04:28 +02:00
// 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 ->
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'
2023-10-26 21:25:16 +06:00
implementation("androidx.browser:browser:1.6.0")
2023-10-05 20:32:47 +03:00
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
2023-05-06 02:15:16 +03:00
implementation 'androidx.work:work-runtime-ktx:2.8.1'
2023-10-26 21:25:16 +06:00
implementation 'com.google.android.material:material:1.10.0'
}