-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
114 lines (92 loc) · 2.97 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
plugins {
id("dev.architectury.loom") version("1.7-SNAPSHOT")
id("com.gradleup.shadow") version("8.3.2")
}
def loader = property("loom.platform")
def isFabric = loader == "fabric"
def minecraft_version = property("deps.minecraft")
def mod_version = property("mod.version")
base {
archivesName = "${property("mod.name")}-${mod_version}-${minecraft_version}+${loader}"
}
repositories {
maven { url("https://maven.neoforged.net/releases") }
}
loom {
decompilers {
vineflower { // Adds names to lambdas - useful for mixins
options.put("mark-corresponding-synthetics", "1")
}
}
runConfigs.all {
ideConfigGenerated(true)
vmArgs("-Dmixin.debug.export=true")
runDir = "../../run"
}
}
configurations {
shadowBundle {
canBeResolved = true
canBeConsumed = false
}
}
dependencies {
minecraft("net.minecraft:minecraft:${minecraft_version}")
mappings loom.layered {
it.mappings("net.fabricmc:yarn:${property("deps.yarn")}:v2")
it.mappings("dev.architectury:yarn-mappings-patch-neoforge:${property("deps.yarn_mappings_neoforge_patch")}")
}
if (isFabric) {
modImplementation("net.fabricmc:fabric-loader:${property("deps.fabric_loader")}")
modImplementation("net.fabricmc.fabric-api:fabric-api:${property("deps.fabric_api")}")
} else {
neoForge("net.neoforged:neoforge:${property("deps.neoforge")}")
}
modImplementation("dev.architectury:architectury-${loader}:${property("deps.architectury_api")}")
shadowBundle(implementation("com.discord4j:discord4j-core:${property("deps.discord4j")}"))
}
tasks.processResources {
def props = [
version : mod_version,
minecraft: minecraft_version,
]
filesMatching("fabric.mod.json") { expand(props) }
filesMatching("META-INF/neoforge.mods.toml") { expand(props) }
filesMatching("cooptweaks.mixins.json") { expand(props) }
}
tasks.register('buildAndCollect', Copy) {
group = 'build'
from(tasks.remapJar.archiveFile)
into(rootProject.layout.buildDirectory.file("${minecraft_version}/"))
dependsOn('build')
}
shadowJar {
configurations = [project.configurations.shadowBundle]
archiveClassifier = "dev-shadow"
relocate('io.netty', 'shadow.io.netty')
relocate('org.checkerframework', 'shadow.org.checkerframework')
relocate('com.google', 'shadow.com.google')
}
remapJar {
dependsOn(shadowJar)
inputFile = tasks.shadowJar.archiveFile
}
afterEvaluate {
stonecutter {
stonecutter.const("fabric", loader == "fabric")
stonecutter.const("neoforge", loader == "neoforge")
}
}
if (stonecutter.current.isActive) {
rootProject.tasks.register("buildActive") {
group = "project"
dependsOn(tasks.named("build"))
}
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
tasks.withType(JavaCompile).configureEach {
it.options.release = 21
}