forked from 3arthqu4ke/headlessmc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
101 lines (84 loc) · 2.96 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
plugins {
id 'application'
}
def MAIN_CLASS = 'me.earth.headlessmc.launcher.Main'
application {
mainClass = MAIN_CLASS
}
repositories {
maven {
name 'OpenAuthMaven'
url 'https://litarvan.github.io/maven'
}
}
run {
standardInput = System.in
}
configurations {
includeJarInResources
}
dependencies {
jarLibsApi project(':headlessmc-api')
jarLibsApi project(':headlessmc-commons')
jarLibsApi project(':headlessmc-lwjgl')
jarLibs group: 'org.ow2.asm', name: 'asm', version: '9.6'
jarLibs group: 'org.ow2.asm', name: 'asm-tree', version: '9.6'
jarLibs group: 'com.google.code.gson', name: 'gson', version: '2.10.1'
jarLibs group: 'fr.litarvan', name: 'openauth', version: '1.1.6'
includeJarInResources ('net.kunmc.lab:forgecli:1.1.0:all') {
// this is to make it build, jar will still have legacy classes
exclude module: 'legacy'
exclude module: 'asm'
exclude module: 'asm-tree'
}
testImplementation(testFixtures(project(':headlessmc-commons')))
testImplementation 'org.apache.logging.log4j:log4j-api:2.22.0'
testImplementation 'org.apache.logging.log4j:log4j-core:2.22.0'
}
processResources {
into('headlessmc') {
from project(':headlessmc-runtime')['shadowJar']
from project(':headlessmc-lwjgl')['jar']
from configurations.includeJarInResources
rename 'forgecli(.*).jar', 'forge-cli.jar'
rename 'headlessmc-lwjgl(.*).jar', 'headlessmc-lwjgl.jar'
rename 'headlessmc-runtime(.*).jar', 'headlessmc-runtime.jar'
}
}
jar {
//noinspection GroovyAssignabilityCheck
manifest {
attributes('Main-Class': MAIN_CLASS)
}
exclude("module-info.class")
exclude("META-INF/maven/com.google.code.gson/**")
}
// shadowJar always explodes the contents of jars and cannot distinguish between
// a dependency and a jar in our resources, this works around that.
// https://github.com/johnrengelman/shadow/issues/111#issuecomment-317233031
tasks.register('shadowBugWorkaround', Jar) {
dependsOn jar
dependsOn project(':headlessmc-runtime')['shadowJar']
dependsOn project(':headlessmc-lwjgl')['jar']
destinationDirectory.set(layout.buildDirectory.dir('shadow-bug-workaround'))
into ('headlessmc') {
from configurations.includeJarInResources
from project(':headlessmc-runtime')['shadowJar']
from project(':headlessmc-lwjgl')['jar']
rename 'forgecli(.*).jar', 'forge-cli.jar'
rename 'headlessmc-lwjgl(.*).jar', 'headlessmc-lwjgl.jar'
rename 'headlessmc-runtime(.*).jar', 'headlessmc-runtime.jar'
}
}
shadowJar {
dependsOn shadowBugWorkaround
from shadowBugWorkaround
exclude("META-INF/maven/com.google.code.gson/**")
exclude("META-INF/versions/**")
exclude("headlessmc/META-INF/**")
exclude("me/earth/headlessmc/runtime/**")
exclude("dev/xdark/**")
exclude("net/kunmc/lab/**")
exclude("module-info.class")
exclude("LICENSE")
}