forked from 00-Evan/shattered-pixel-dungeon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
107 lines (91 loc) · 4.34 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
apply plugin: 'com.android.application'
android {
namespace 'com.shatteredpixel.shatteredpixeldungeon.android'
compileSdk appAndroidCompileSDK
compileOptions.sourceCompatibility = compileOptions.targetCompatibility = appJavaCompatibility
sourceSets.main.assets.srcDirs = [new File(project(':core').projectDir, "/src/main/assets")]
defaultConfig {
manifestPlaceholders = [appName:appName]
applicationId appPackageName
versionCode appVersionCode
versionName appVersionName
//noinspection MinSdkTooLow
minSdkVersion appAndroidMinSDK
targetSdkVersion appAndroidTargetSDK
resourceConfigurations += ['en_US', 'cs', 'de', 'el', 'es', 'fr', 'hu', 'in', 'it', 'ja', 'ko', 'nl', 'pl', 'pt', 'ru', 'tr', 'uk', 'vi', 'zh_CN']
}
buildTypes {
debug {
applicationIdSuffix ".indev"
versionNameSuffix '-INDEV'
dependencies {
debugImplementation project(':services:updates:debugUpdates')
debugImplementation project(':services:news:debugNews')
}
}
release {
//These lines enable R8, which is a code shrinker/optimizer/obfuscator.
//This makes release APKs smaller and more efficient, but also makes debugging trickier
//as the information produced in stack traces must be de-obfuscated.
//See here: https://developer.android.com/studio/build/shrink-code#decode-stack-trace
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
dependencies {
releaseImplementation project(':services:updates:githubUpdates')
releaseImplementation project(':services:news:shatteredNews')
}
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
}
configurations { natives }
dependencies {
implementation project(':core')
// We are using the natives from 1.11.0 to maintain compatibility with Android 4.0-4.3 for now
// The 1.12.0+ natives are compiled with a version of the NDK which drops 4.3- support
// YES, THIS IS VERY DANGEROUS! 1.11.0 natives may only incidentally work with later libGDX versions
implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:1.11.0:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:1.11.0:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:1.11.0:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:1.11.0:natives-x86_64"
implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-freetype-platform:1.11.0:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:1.11.0:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:1.11.0:natives-x86"
natives "com.badlogicgames.gdx:gdx-freetype-platform:1.11.0:natives-x86_64"
implementation "com.badlogicgames.gdx-controllers:gdx-controllers-android:$gdxControllersVersion"
}
// called every time gradle gets executed, takes the native dependencies of
// the natives configuration, and extracts them to the proper libs/ folders
// so they get packed with the APK.
task copyAndroidNatives() {
doFirst {
file("libs/armeabi-v7a/").mkdirs()
file("libs/arm64-v8a/").mkdirs()
file("libs/x86/").mkdirs()
file("libs/x86_64/").mkdirs()
configurations.natives.copy().files.each { jar ->
def outputDir = null
if (jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")
if (jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a")
if (jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86")
if (jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64")
if (outputDir != null) {
copy {
from zipTree(jar)
into outputDir
include "*.so"
}
}
}
}
}
tasks.matching { it.name.contains("merge") && it.name.contains("JniLibFolders") }.configureEach { packageTask ->
packageTask.dependsOn 'copyAndroidNatives'
}