-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
124 lines (103 loc) · 3.92 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
124 lines (103 loc) · 3.92 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
plugins {
kotlin("jvm") version "2.4.0"
id("net.fabricmc.fabric-loom") version "1.17.11"
id("io.freefair.lombok") version "8.6"
id("com.gradleup.shadow") version "9.3.1"
}
val shadowModImpl = configurations.create("shadowModImpl")
val baseGroup: String = findProperty("baseGroup") as String
val mcVersion: String = findProperty("mcVersion") as String
val modVersion = project.version.toString()
val loomVersion: String = findProperty("loomVersion") as String
val loaderVersion: String = findProperty("loaderVersion") as String
val fabricApiVersion: String = findProperty("fabricApiVersion") as String
val kotlinLoaderVersion: String = findProperty("kotlinLoaderVersion") as String
val modmenuVersion: String = findProperty("modmenuVersion") as String
val mixinGroup = "$baseGroup.mixin"
val modid: String = findProperty("modid") as String
val modName: String = findProperty("modName") as String
group = baseGroup
// Toolchains:
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(25))
}
kotlin {
jvmToolchain(25)
}
// Minecraft configuration:
loom {
accessWidenerPath.set(file("src/main/resources/veinforge.accesswidener"))
}
// Dependencies:
repositories {
maven("https://maven.notenoughupdates.org/releases") {
content {
includeGroup("org.notenoughupdates.moulconfig")
}
}
maven("https://maven.fabricmc.net/")
maven("https://repo.spongepowered.org/maven/")
maven {
name = "TerraformersMC"
url = uri("https://maven.terraformersmc.com/")
}
}
dependencies {
minecraft("com.mojang:minecraft:$mcVersion")
implementation("net.fabricmc:fabric-loader:$loaderVersion")
implementation("net.fabricmc.fabric-api:fabric-api:$fabricApiVersion")
implementation("net.fabricmc:fabric-language-kotlin:$kotlinLoaderVersion")
compileOnly("org.notenoughupdates.moulconfig:modern-26.2:4.7.2")
add("shadowModImpl", "org.notenoughupdates.moulconfig:modern-26.2:4.7.2")
compileOnly("com.terraformersmc:modmenu:${modmenuVersion}")
compileOnly("org.jetbrains:annotations:26.0.1")
compileOnly("org.projectlombok:lombok:1.18.42")
annotationProcessor("org.projectlombok:lombok:1.18.42")
implementation("com.google.code.gson:gson:2.10.1")
implementation("com.google.guava:guava:33.2.1-jre")
implementation("com.typesafe.akka:akka-actor_2.13:2.6.20")
}
// Tasks:
val lintDeprecation: Boolean = (findProperty("lintDeprecation") as String?)?.toBoolean() ?: false
tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
if (lintDeprecation) {
options.compilerArgs.add("-Xlint:deprecation")
}
}
tasks.withType<Jar> {
archiveBaseName.set(modName)
}
tasks.jar {
dependsOn(tasks.shadowJar)
from(zipTree(tasks.shadowJar.get().archiveFile))
archiveBaseName.set(modName)
archiveClassifier.set("")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
tasks.processResources {
inputs.property("version", modVersion)
inputs.property("mcversion", mcVersion)
inputs.property("loaderVersion", loaderVersion)
inputs.property("modid", modid)
inputs.property("modName", modName)
inputs.property("mixinGroup", mixinGroup)
filesMatching(listOf("fabric.mod.json", "mixins.$modid.json", "version.properties")) {
expand(inputs.properties)
}
rename("(.+_at.cfg)", "META-INF/$1")
}
tasks.shadowJar {
configurations = listOf(shadowModImpl)
archiveClassifier.set("shadow")
destinationDirectory.set(layout.buildDirectory.dir("badjars"))
// relocate removed: shadow relocate only transforms the shadowed dependency classes,
// not references in the mod's own source. The original package name is used everywhere
// in the codebase, so relocating causes NoClassDefFoundError at runtime.
mergeServiceFiles()
}
tasks.assemble.get().dependsOn(tasks.jar)
tasks.withType<AbstractArchiveTask> {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}