-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
378 lines (319 loc) · 12.1 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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
import java.text.DateFormat
import java.text.SimpleDateFormat
version project.modVersion
group project.modGroup
buildscript {
repositories {
mavenCentral()
maven { url = 'https://maven.minecraftforge.net/' }
maven { url = 'https://repo.spongepowered.org/maven/' }
maven { url = "https://repo.spongepowered.org/repository/maven-public" }
jcenter()
maven { url = "https://repo.viaversion.com" }
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/repositories/snapshots/'
}
maven {
name = 'gradle plugins'
url "https://plugins.gradle.org/m2/"
}
maven {
url = "https://maven.architectury.dev"
content {
includeGroup "dev.architectury"
}
maven {
// saps.dev Maven (KubeJS and Rhino)
url = "https://maven.saps.dev/minecraft"
content {
includeGroup "dev.latvian.mods"
}
}
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:4.+'
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion"
classpath "com.viaversion:viaversion:4.0.1"
classpath "com.viaversion:viabackwards:4.0.1"
classpath "org.yaml:snakeyaml:1.29"
classpath 'gradle.plugin.com.matthewprenger:CurseGradle:1.0.9'
classpath 'com.guardsquare:proguard-gradle:7.1.0'
//classpath "space.vectrix.flare-fastutil:2.0.0"
}
}
apply plugin: 'idea'
apply plugin: 'kotlin'
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.jetbrains.dokka'
apply plugin: 'org.spongepowered.mixin'
apply plugin: "java"
apply plugin: "maven-publish"
apply plugin: 'com.matthewprenger.cursegradle'
apply plugin: 'application'
apply plugin: 'eclipse'
ext {
jmonkeyengine_version = '[3.1,)'
}
sourceSets.main.java {
srcDirs += 'src/main/cape-api'
srcDirs += 'src/main/command'
srcDirs += 'src/main/commons'
srcDirs += 'src/main/event'
srcDirs += 'src/main/java/family_fun_pack'
srcDirs += 'src/main/java/me/earth/earthhack/impl/'
}
configurations {
include
implementation.extendsFrom(include)
}
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
options.encoding = 'UTF-8'
}
compileKotlin.kotlinOptions {
freeCompilerArgs += '-Xlambdas=indy'
freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn'
freeCompilerArgs += '-Xopt-in=kotlin.contracts.ExperimentalContracts'
}
repositories {
maven { url = 'https://repo.spongepowered.org/maven/' }
maven { url = 'https://impactdevelopment.github.io/maven/' }
maven { url = "https://jitpack.io" }
mavenCentral()
maven { url = "https://repo.viaversion.com" }
ivy {
name = 'lunatrius\' ivy repo'
url 'http://mc.lunatri.us/files'
}
}
mainClassName = "me.earth.earthhack.installer.main.Main"
group project.modGroup //http://maven.apache.org/guides/mini/guide-naming-conventions.html
def getCheckedOutGitCommitHash() {
def gitFolder = "$projectDir/.git/"
def takeFromHash = 12
/*
* '.git/HEAD' contains either
* in case of detached head: the currently checked out commit hash
* otherwise: a reference to a file containing the current commit hash
*/
// def isRef = head.length > 1 // ref: refs/heads/master
}
// build constants
boolean INCREMENT = false // increments version
// NO APPEND THAT YOURSELF BITCH
boolean UNIQUE = false // adds a random 8-char string to the build number
// instead of incrementing the last number
// this is so that we don't get absurdly large numbers
// maybe only increment the number automatically if CI is ever added to the repo?
boolean HASH = true
boolean DATE = false // adds the date to the random string
boolean CLEAR = true // clears other jars in the build folder to stop it from being clogged up
boolean VANILLA = false
String title = getCheckedOutGitCommitHash()
//noinspection GroovyUnusedAssignment
sourceCompatibility = targetCompatibility = '1.8'
compileJava {
// idk this gets called when u do anything but whatever
File versionFile = file 'version'
String contents = versionFile.getText( 'UTF-8' )
String[] split = contents.split('\\.')
int lastVersion = Integer.parseInt(split[2].split('-')[0])
if (INCREMENT)
{
lastVersion++
}
if (!UNIQUE)
{
contents = split[0] + '.' + split[1] + '.' + (lastVersion)
}
else
{
String extra = ""
if (DATE)
{
Date date = Calendar.getInstance().getTime()
DateFormat dateFormat = new SimpleDateFormat('mm-dd-yy-hh-mm')
extra = dateFormat.format(date) + '-'
}
String generatedString = UUID.randomUUID().toString().split('-')[0]
String randomString = lastVersion + '-' + 'build-' + extra + generatedString
contents = split[0] + '.' + split[1] + '.' + randomString
}
if (HASH)
{
contents = split[0] + '.' + split[1] + '.' + lastVersion + '-' + title
}
versionFile.write( contents, 'UTF-8' )
version contents
sourceCompatibility = targetCompatibility = '1.8'
// Tbh it would be much easier if we could assign this differently
// instead of writing it, but StackOverflow didn't give a working
// solution for that. One looked promising but it caused duplicate classes.
if (CLEAR)
{
File libs = file buildDir.getAbsolutePath() + '/libs/'
if (libs.exists() && libs.isDirectory())
{
for (File file in libs.listFiles())
{
file.delete()
}
}
}
}
minecraft {
mappings channel: "$mappingsChannel", version: "$mappingsVersion"
runs {
client {
workingDirectory project.file('run')
property 'fml.coreMods.load', 'com.lambda.client.mixin.MixinLoaderForge'
property 'mixin.env.disableRefMap', 'true' // Disable refmap so we don't get trolled by Baritone
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
}
}
}
configurations {
jarLibs
// Force choosing the correct nightly build because Mac OS chooses an invalid one
all {
resolutionStrategy {
force 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209'
}
}
}
dependencies {
implementation "org.kitteh.irc:client-lib:8.0.0"
implementation "com.viaversion:viabackwards:4.0.2-SNAPSHOT"
implementation "com.viaversion:viaversion:4.0.2-SNAPSHOT"
implementation 'space.vectrix.flare:flare-fastutil:1.0.0'
implementation 'space.vectrix.flare:flare:1.0.0'
implementation 'fastutil:fastutil:5.0.9'
implementation 'org.slf4j:slf4j-api:1.7.32'
implementation 'org.json:json:20210307'
implementation 'org.joml:joml:1.10.3'
compile group: 'com.cosium.junixsocket', name: 'junixsocket-common', version: '2.0.4.3'
compile group: 'org.json', name: 'json', version: '20210307'
compile "org.jmonkeyengine:jme3-bullet:$jmonkeyengine_version"
compile group: 'com.formdev', name: 'flatlaf', version: '1.5'
compile group: 'org.slick2d', name: 'slick2d-core', version: '1.0.2'
compile group: 'org.joml', name: 'joml', version: '1.10.2'
compile group: 'us.ihmc', name: 'jassimp', version: '4.0.0-ihmc6'
compile group: 'us.ihmc', name: 'ihmc-native-library-loader', version: '1.3.1'
compile group: 'com.github.stephengold', name: 'Libbulletjme', version: '12.5.0'
compile group: 'de.fabmax', name: 'physx-jni', version: '0.4.15'
compile group: 'de.fabmax', name: 'physx-jni', version: '0.4.15:native-win64'
compile group: 'net.java.dev.jna', name: 'jna', version: '5.8.0'
compile group: 'net.java.dev.jna', name: 'jna-platform', version: '5.8.0'
compile group: 'com.badlogicgames.gdx', name: 'gdx', version: '1.10.0'
compile group: 'com.badlogicgames.gdx', name: 'gdx-bullet', version: '1.10.0'
compile group: 'com.badlogicgames.gdx', name: 'gdx-backend-lwjgl', version: '1.10.0'
compile "com.badlogicgames.gdx:gdx-platform:1.10.0:natives-desktop"
compile "com.badlogicgames.gdx:gdx-bullet-platform:1.10.0:natives-desktop"
compile 'com.github.zakgof:velvet-video:0.5.2'
compile 'com.github.zakgof:velvet-video-natives:0.2.8.full'
//deobfCompile group: group, name: 'LunatriusCore', version: "${project.version_minecraft}-${project.version_lunatriuscore}", classifier: 'universal'
// Forge
minecraft "net.minecraftforge:forge:$minecraftVersion-$forgeVersion"
jarLibs('org.spongepowered:mixin:0.7.11-SNAPSHOT') {
exclude module: 'launchwrapper'
exclude module: 'guava'
exclude module: 'gson'
exclude module: 'commons-io'
}
// Hacky way to get mixin work
annotationProcessor('org.spongepowered:mixin:0.8.2:processor') {
exclude module: 'gson'
}
jarLibs('org.reflections:reflections:0.9.12') {
exclude module: 'gson'
exclude module: 'guava'
}
// Kotlin libs
// kotlin-stdlib-common and annotations aren't required at runtime
jarLibs("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion") {
exclude module: 'kotlin-stdlib-common'
exclude module: 'annotations'
}
jarLibs("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion") {
exclude module: 'kotlin-stdlib-common'
exclude module: 'annotations'
}
jarLibs("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion") {
exclude module: 'kotlin-stdlib-common'
exclude module: 'annotations'
}
jarLibs("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion") {
exclude module: 'kotlin-stdlib-common'
exclude module: 'annotations'
}
jarLibs("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion") {
exclude module: 'kotlin-stdlib-common'
exclude module: 'annotations'
}
// Add them back to compileOnly (provided)
compileOnly "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlinVersion"
compileOnly 'org.jetbrains:annotations:20.1.0'
// This Baritone will NOT be included in the jar
implementation 'com.github.cabaletta:baritone:1.2.14'
// This Baritone WILL be included in the jar
jarLibs 'cabaletta:baritone-api:1.2'
// Add everything in jarLibs to implementation (compile)
implementation configurations.jarLibs
}
mixin {
defaultObfuscationEnv 'searge'
add sourceSets.main, 'mixins.lambda.refmap.json'
}
processResources {
inputs.property 'version', project.version
exclude '**/rawimagefiles'
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
include "com.viaversion:viaversion:4.0.2-SNAPSHOT"
include "com.viaversion:viabackwards:4.0.2-SNAPSHOT"
include "org.yaml:snakeyaml:1.29"
expand 'version': project.version
}
}
task sourceJar(type: Jar) { // Generate sources
group 'build'
description 'Assemble API library source archive'
archiveClassifier.set('api-source')
from sourceSets.main.allSource
}
task apiJar(type: Jar) {
group 'build'
description 'Assemble API library archive'
archiveClassifier.set('api')
from sourceSets.main.output
}
// Don't put baritone mixin here please c:
jar {
manifest.attributes(
'Manifest-Version': 1.0,
'MixinConfigs': 'mixins.lambda.json',
'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker',
'TweakOrder': 0,
'FMLCorePluginContainsFMLMod': 'true',
'FMLCorePlugin': 'com.lambda.client.mixin.MixinLoaderForge',
'ForceLoadAsMod': 'true',
'Main-Class': 'com.lambda.client.installer.Installer'
)
// Copy needed libs to jar
from {
configurations.jarLibs.collect {
it.isDirectory() ? it : zipTree(it)
}
}
}
task buildApi {
group 'build'
dependsOn sourceJar
dependsOn apiJar
description 'Assemble API library archives'
}