-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathbuild.gradle
231 lines (197 loc) · 6.94 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
plugins {
id 'com.android.application' version '8.7.2'
}
static def getDate() { return new Date().format('yyyyMMdd') }
static def getDateSeconds() {
if (System.getenv("GITHUB_ACTIONS") == "true") {
return 9934841 + Integer.parseInt(System.getenv("GITHUB_RUN_NUMBER"))
} else {
return 172005
}
}
def getVersionName = {
// Get the last version tag, as well as the short head of the last commit
ByteArrayOutputStream TAG = new ByteArrayOutputStream()
ByteArrayOutputStream BRANCH = new ByteArrayOutputStream()
// Used by the fallback for github actions
ByteArrayOutputStream TAG_PART_COMMIT = new ByteArrayOutputStream()
String TAG_STRING
exec {
try {
commandLine 'git', 'describe', '--tags'
ignoreExitValue true
standardOutput = TAG
} catch (Exception e) {
e.printStackTrace();
}
}
if (TAG.toString() == "") {
exec {
// Fallback for action builds
try {
commandLine 'git', 'describe', '--always', '--tags'
ignoreExitValue true
standardOutput = TAG_PART_COMMIT
} catch (Exception e) {
}
}
}
if(TAG.toString() != ""){
TAG_STRING = TAG.toString()
}else {
if(TAG_PART_COMMIT.toString().trim() == ""){
//Fallback no repo
return ("LOCAL-" + "${getDate()}")
}else {
// Used by github actions
TAG_STRING = 'foxglove-' + "${getDate()}" + "-" + TAG_PART_COMMIT.toString().trim()
}
}
exec {
try {
commandLine 'git', 'branch', '--show-current'
ignoreExitValue true
standardOutput = BRANCH
} catch (Exception e) {
e.printStackTrace();
}
}
return TAG_STRING.trim().replace("-g", "-") + "-" + BRANCH.toString().trim()
}
def getCFApiKey = {
String key = System.getenv("CURSEFORGE_API_KEY");
if(key != null) return key;
File curseforgeKeyFile = new File("./curseforge_key.txt");
if(curseforgeKeyFile.canRead() && curseforgeKeyFile.isFile()) {
return curseforgeKeyFile.text;
}
logger.warn('BUILD: You have no CurseForge key, the curseforge api will get disabled !');
return "DUMMY";
}
configurations {
instrumentedClasspath {
canBeConsumed = false
canBeResolved = true
}
}
android {
namespace 'net.kdt.pojavlaunch'
compileSdk = 34
lintOptions {
abortOnError false
}
signingConfigs {
customDebug {
storeFile file("debug.keystore")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
googlePlayBuild {
storeFile file("upload.jks")
storePassword System.getenv("GPLAY_KEYSTORE_PASSWORD")
keyAlias "upload"
keyPassword System.getenv("GPLAY_KEYSTORE_PASSWORD")
}
}
defaultConfig {
applicationId "net.kdt.pojavlaunch"
minSdkVersion 21
targetSdkVersion 34
versionCode getDateSeconds()
versionName getVersionName()
multiDexEnabled true //important
resValue 'string', 'curseforge_api_key', getCFApiKey()
}
buildTypes {
debug {
applicationIdSuffix '.debug'
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.customDebug
resValue 'string', 'application_package', 'net.kdt.pojavlaunch.debug'
resValue 'string', 'storageProviderAuthorities', 'net.kdt.pojavlaunch.scoped.gamefolder.debug'
resValue 'string', 'shareProviderAuthority', 'net.kdt.pojavlaunch.scoped.controlfolder.debug'
}
proguard {
initWith debug
minifyEnabled true
shrinkResources true
}
proguardNoDebug {
initWith proguard
debuggable false
}
release {
// Don't set to true or java.awt will be a.a or something similar.
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// defaultConfig already set
// multiDexEnabled = true
// debuggable = true
resValue 'string', 'storageProviderAuthorities', 'net.kdt.pojavlaunch.scoped.gamefolder'
resValue 'string', 'application_package', 'net.kdt.pojavlaunch'
}
gplay {
initWith release
signingConfig signingConfigs.googlePlayBuild
}
}
ndkVersion = "25.2.9519653"
externalNativeBuild {
ndkBuild {
path file('src/main/jni/Android.mk')
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
bundle {
language {
enableSplit = false
}
}
packagingOptions {
jniLibs {
useLegacyPackaging = true
}
pickFirst '**/libbytehook.so'
}
buildFeatures {
prefab true
buildConfig true
}
buildToolsVersion = '34.0.0'
}
afterEvaluate {
// Explicit dependencies for which the apk relies on
tasks.mergeDebugAssets.dependsOn(":forge_installer:jar", ":arc_dns_injector:jar", ":jre_lwjgl3glfw:jar")
}
dependencies {
implementation 'javax.annotation:javax.annotation-api:1.3.2'
implementation 'commons-codec:commons-codec:1.15'
// implementation 'com.wu-man:android-bsf-api:3.1.3'
implementation 'androidx.preference:preference:1.2.0'
//implementation 'androidx.core:core:1.7.0'
implementation 'androidx.drawerlayout:drawerlayout:1.2.0'
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01'
implementation 'androidx.annotation:annotation:1.5.0'
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation 'com.github.duanhong169:checkerboarddrawable:1.0.2'
implementation 'com.github.PojavLauncherTeam:portrait-sdp:ed33e89cbc'
implementation 'com.github.PojavLauncherTeam:portrait-ssp:6c02fd739b'
implementation 'com.github.Mathias-Boulay:ExtendedView:1.0.0'
implementation 'com.github.Mathias-Boulay:android_gamepad_remapper:2.0.3'
implementation 'com.github.Mathias-Boulay:virtual-joystick-android:1.14'
// implementation 'com.intuit.sdp:sdp-android:1.0.5'
// implementation 'com.intuit.ssp:ssp-android:1.0.5'
implementation 'org.tukaani:xz:1.8'
// Our version of exp4j can be built from source at
// https://github.com/PojavLauncherTeam/exp4j
implementation 'net.sourceforge.htmlcleaner:htmlcleaner:2.6.1'
implementation 'com.bytedance:bytehook:1.0.9'
// implementation 'net.sourceforge.streamsupport:streamsupport-cfuture:1.7.0'
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
}