-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
128 lines (102 loc) · 3.46 KB
/
build.gradle
File metadata and controls
128 lines (102 loc) · 3.46 KB
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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id 'java'
id 'idea'
id 'eclipse'
id 'maven-publish'
alias libs.plugins.gradleutils
alias libs.plugins.gitversion
alias libs.plugins.changelog
alias libs.plugins.licenser
alias libs.plugins.shadow
alias libs.plugins.multirelease
}
gradleutils.displayName = 'Slime Launcher'
description = 'A slim launcher for Minecraft in the development environment.'
group = 'net.minecraftforge'
version = gitversion.tagOffset
println "Version: $version"
java {
// Even though older Minecraft supports as far back as 1.5, 8 is compatible with it, and SL is not compiling anything.
toolchain.languageVersion = JavaLanguageVersion.of(8)
withSourcesJar()
}
dependencies {
compileOnly libs.nulls
implementation libs.gson
implementation libs.jopt
implementation libs.srgutils
implementation libs.bundles.utils
}
license {
header rootProject.file('LICENSE-header.txt')
newLine false
exclude '**/*.properties'
}
tasks.named('jar', Jar) {
manifest {
attributes([
'Main-Class': 'net.minecraftforge.launcher.Main',
'Automatic-Module-Name': 'net.minecraftforge.launcher',
'Add-Opens': 'java.base/java.lang.invoke=net.minecraftforge.launcher'
])
gradleutils.manifestDefaults(it, 'net/minecraftforge/launcher/')
}
archiveClassifier = 'thin'
}
multiRelease.register {
add(JavaLanguageVersion.of(9), project(':slime-launcher-j9'))
}
def multiReleaseJar = tasks.named('multiReleaseJar', Jar) {
includeEmptyDirs = false
eachFile({
if (name == 'module-info.class')
path = 'module-info.class'
if (name == 'DummyForModule.class')
exclude()
})
}
tasks.named('shadowJar', ShadowJar) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
dependsOn multiReleaseJar
from({zipTree(multiReleaseJar.get().archiveFile.get().asFile)})
exclude('META-INF/maven/**')
exclude('META-INF/proguard/**')
enableAutoRelocation = true
relocationPrefix = 'net.minecraftforge.launcher.shadow'
relocate 'com.google.errorprone.annotations', 'net.minecraftforge.launcher.shadow.errorprone'
relocate 'com.google.gson', 'net.minecraftforge.launcher.shadow.gson'
relocate 'net.minecraftforge.util', 'net.minecraftforge.launcher.shadow.util'
relocate 'net.minecraftforge.srgutils', 'net.minecraftforge.launcher.shadow.srgutils'
// Rewrite JOpt's message files, so that help text is displayed nicely.
transform(com.github.jengelman.gradle.plugins.shadow.transformers.PropertiesFileTransformer) {
paths = [ 'Messages.properties$' ]
keyTransformer = { key -> 'net.minecraftforge.launcher.shadow.' + key }
}
archiveClassifier = ''
}
changelog {
fromBase()
}
publishing {
repositories {
maven gradleutils.publishingForgeMaven
}
publications.register('mavenJava', MavenPublication) {
from components.shadow
artifact sourcesJar
changelog.publish(it)
gradleutils.promote(it)
pom { pom ->
name = gradleutils.displayName
description = project.description
gradleutils.pom.addRemoteDetails(pom)
licenses {
license gradleutils.pom.licenses.LGPLv2_1
}
developers {
developer gradleutils.pom.developers.Jonathing
}
}
}
}