1
0

150 lines
3.7 KiB
Groovy
Raw Normal View History

apply plugin: 'com.android.application'
android {
compileSdkVersion 29
2020-09-04 20:04:28 +02:00
buildToolsVersion '30.0.3'
ndkVersion '22.0.7026061'
defaultConfig {
2020-09-04 20:04:28 +02:00
applicationId 'com.multicraft.game'
minSdkVersion 16
2020-09-04 20:04:28 +02:00
//noinspection OldTargetApi
targetSdkVersion 29
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
versionCode project.versionCode
2020-09-04 20:04:28 +02:00
multiDexEnabled true
}
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'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
2020-09-04 20:04:28 +02:00
import com.android.build.OutputFile
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/Android/Irrlicht/shaders" into "${assetsFolder}/client/shaders/Irrlicht"
}
copy {
2020-09-04 20:04:28 +02:00
from "${projRoot}/fonts/Retron2000.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
task prepareAssetsGames() {
def assetsFolder = "build/assets/games"
def projRoot = "../../.."
def gameToCopy = "default"
2020-09-04 20:04:28 +02:00
copy {
from "${projRoot}/games/${gameToCopy}" into "${assetsFolder}/games/${gameToCopy}"
}
task zipAssetsGames(type: Zip) {
archiveFileName = "games.zip"
destinationDirectory = file("src/main/assets/data")
from "${assetsFolder}"
}
}
2020-09-04 20:04:28 +02:00
preBuild.dependsOn zipAssetsFiles
preBuild.dependsOn zipAssetsGames
// Map for the version code that gives each ABI a value.
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 {
2020-09-04 20:04:28 +02:00
/* MultiCraft Native */
implementation project(':native')
2020-09-04 20:04:28 +02:00
/* Third-party libraries */
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.preference:preference:1.1.1'
implementation 'com.google.android.play:core:1.9.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.20'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
//noinspection GradleDependency
implementation 'com.squareup.okhttp3:okhttp:3.12.12'
//noinspection GradleDependency
implementation 'commons-io:commons-io:2.5'
implementation 'gun0912.ted:tedpermission-rx2:2.2.3'
implementation 'com.google.code.gson:gson:2.8.6'
/* Analytics libraries */
//noinspection GradleDynamicVersion
/*implementation 'com.bugsnag:bugsnag-android-core:5.+'*/
}