-
-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
216 lines (191 loc) · 6.85 KB
/
build.gradle.kts
File metadata and controls
216 lines (191 loc) · 6.85 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
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
import java.util.*
import java.text.NumberFormat
import java.text.ParseException
plugins {
java
id("fabric-loom") version ("1.14-SNAPSHOT")
id("com.gradleup.shadow") version ("8.3.10")
id("io.freefair.lombok") version ("9.2.0")
}
ext {
if (project.hasProperty("runningOnCi")) {
val nf = NumberFormat.getIntegerInstance(Locale.US)
val buildNumber = project.property("buildNumber")
val runAttempt = project.property("runAttempt")
val includeRunAttempt = nf.parse(runAttempt as String).toInt() > 1
try {
if (includeRunAttempt) {
project.setProperty("buildNumber", "${buildNumber}.${nf.parse(runAttempt).toInt() - 1}")
}
set("formattedVersion", "${project.version}+" + project.property("buildNumber"))
} catch (e: ParseException) {
set("formattedVersion", project.version)
throw InvalidUserDataException("Build number could not be parsed (${e.message})", e)
}
} else {
set("formattedVersion", project.version)
}
}
base {
archivesName.set(project.name)
}
loom {
log4jConfigs.from(file(("log-config.xml")))
accessWidenerPath.set(project.file("src/main/resources/skyblockaddons.classtweaker"))
runConfigs {
getByName("client") {
vmArg("-Xmx4G")
property("mixin.debug", "true")
property("devauth.enabled", "false")
property("sba.data.online", "false")
}
remove(getByName("server"))
}
mixin.useLegacyMixinAp = false
}
fabricApi {
configureTests {
createSourceSet = true
modId = "skyblockaddons-test"
enableGameTests = false
eula = true
}
}
repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
maven("https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1") {
content {
includeGroup("me.djtheredstoner")
}
}
maven("https://repo.hypixel.net/repository/Hypixel/") {
content {
includeGroup("net.hypixel")
}
}
//maven("https://repo.nea.moe/releases")
maven("https://jitpack.io") {
content {
includeGroupByRegex("com\\.github\\..*")
}
}
maven("https://api.modrinth.com/maven") {
content {
includeGroup("maven.modrinth")
}
}
maven("https://maven.parchmentmc.org") {
content {
includeGroupByRegex("org\\.parchmentmc.*")
}
}
maven("https://maven.terraformersmc.com/") {
content {
includeGroup("com.terraformersmc")
}
}
maven("https://maven.shedaniel.me") {
content {
includeGroupByRegex("me\\.shedaniel.*")
includeGroup("dev.architectury")
}
}
}
val bundle : Configuration by configurations.creating {
configurations.modImplementation.get().extendsFrom(this)
}
dependencies {
// To change the versions see the gradle.properties file
minecraft("com.mojang:minecraft:${properties["minecraft_version"]}")
mappings(loom.layered {
officialMojangMappings()
if (properties["parchment_version"] != null) {
parchment("org.parchmentmc.data:parchment-${properties["minecraft_version"]}:${properties["parchment_version"]}@zip")
}
})
modImplementation("net.fabricmc:fabric-loader:${properties["loader_version"]}")
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation("net.fabricmc.fabric-api:fabric-api:${properties["fabric_version"]}")
modImplementation("com.terraformersmc:modmenu:${properties["modmenu_version"]}")
// REI compat
modCompileOnly("me.shedaniel:RoughlyEnoughItems-api-fabric:${properties["rei_version"]}") {
exclude("net.fabricmc.fabric-api")
}
modRuntimeOnly("me.djtheredstoner:DevAuth-fabric:1.2.2")
implementation("net.hypixel:mod-api:1.0.1")
modImplementation("maven.modrinth:hypixel-mod-api:1.0.1+build.1+mc1.21")
//bundle("moe.nea:libautoupdate:1.3.1")
bundle("com.github.nea89o:libautoupdate:841d9f7e78")
// Discord RPC for Java https://github.com/jagrosh/DiscordIPC
bundle("io.github.cdagaming:DiscordIPC:0.11.3") {
exclude(module = "log4j")
because("Different version conflicts with Minecraft's Log4J")
exclude(module = "gson")
because("Different version conflicts with Minecraft's GSON")
}
// Test
testImplementation(platform("org.junit:junit-bom:6.0.3"))
testImplementation("org.junit.jupiter:junit-jupiter-params")
testImplementation("net.fabricmc:fabric-loader-junit:${properties["loader_version"]}")
}
tasks.withType(JavaCompile::class).configureEach {
options.compilerArgs.add("-Xlint:unchecked")
options.compilerArgs.add("-Xlint:deprecation")
options.encoding = "UTF-8"
}
tasks.remapJar {
input = tasks.shadowJar.get().archiveFile
archiveFileName = "${project.name}-${ext.get("formattedVersion")}-for-MC-${properties["minecraft_version"]}.jar"
}
tasks.processResources {
dependsOn("copyLicenses")
inputs.property("version", ext.get("formattedVersion"))
filesMatching("fabric.mod.json") {
expand(mapOf(
"version" to ext.get("formattedVersion"),
"sbaJarName" to "${project.name}-${ext.get("formattedVersion")}-for-MC-${properties["minecraft_version"]}.jar",
"sbaBuildNumber" to project.property("buildNumber")
))
}
}
tasks.register("copyLicenses", Copy::class) {
from(project.projectDir) {
include(
"LICENSE",
"dependencyLicenses/**"
)
}
from(".github/docs/NOTICES.md").into(project.projectDir)
sourceSets.main.get().output.resourcesDir?.let { into(it) }
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(21)
}
tasks.jar {
destinationDirectory.set(layout.buildDirectory.dir("intermediates"))
from("LICENSE") {
rename { "${it}_${base.archivesName.get()}"}
}
manifest.attributes.run {
this["Main-Class"] = "SkyblockAddonsInstallerFrame"
}
}
tasks.shadowJar {
destinationDirectory.set(layout.buildDirectory.dir("intermediates"))
configurations = listOf(bundle)
val basePackage = "${project.group}.${project.name.lowercase(Locale.US)}"
relocate("com.jagrosh.discordipc", "${basePackage}.discordipc")
relocate("moe.nea.libautoupdate", "${basePackage}.libautoupdate")
}
tasks.test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
tasks.assemble.get().dependsOn(tasks.remapJar)