-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
237 lines (203 loc) · 6.95 KB
/
build.gradle.kts
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
import net.darkhax.curseforgegradle.Constants
import net.darkhax.curseforgegradle.TaskPublishCurseForge
import java.time.LocalDateTime
val mod_id: String by extra
val mod_name: String by extra
val mod_author: String by extra
val mod_version: String by extra
val release_type: String by extra
val repository: String by extra
val modrinth_project: String by extra
val curseforge_project: String by extra
val minecraft_version: String by extra
val forge_version: String by extra
val blueprint_version: String by extra
val mixin_version: String by extra
val mixin_extras_version: String by extra
val supplementaries_version: String by extra
val amendments_version: String by extra
val moonlight_lib_version: String by extra
val oreganized_version: String by extra
val dye_depot_version: String by extra
val jei_version: String by extra
plugins {
java
id("net.minecraftforge.gradle") version ("[6.0,6.2)")
id("org.parchmentmc.librarian.forgegradle") version ("1+")
id("org.spongepowered.mixin") version ("0.7-SNAPSHOT")
id("net.darkhax.curseforgegradle") version ("1.1.15")
id("com.modrinth.minotaur") version ("2.+")
}
base {
archivesName.set("$mod_name $minecraft_version")
}
mixin {
add(sourceSets.main.get(), "${mod_id}.refmap.json")
config("${mod_id}.mixins.json")
}
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
minecraft {
mappingChannel.set("parchment")
mappingVersion.set("2023.09.03-1.20.1")
accessTransformer(file("src/main/resources/META-INF/accesstransformer.cfg"))
runs {
create("client") {
taskName("Client")
}
create("server") {
taskName("Server")
}
create("data") {
args(
"--mod",
mod_id,
"--all",
"--output",
project.file("src/generated/resources/"),
"--existing",
project.file("src/main/resources/"),
"--existing-mod",
"blueprint"
)
taskName("Data")
}
forEach {
it.workingDirectory(project.file("run"))
it.args("-mixin.config=${mod_id}.mixins.json")
it.mods.create(mod_id) {
source(sourceSets.main.get())
}
}
}
}
sourceSets.main.get().resources {
srcDir("src/generated/resources")
}
repositories {
maven {
// location of the maven that hosts Blueprint
url = uri("https://maven.jaackson.me")
}
maven {
// location of the maven that hosts JEI files
url = uri("https://dvs1.progwml6.com/files/maven/")
}
maven {
// location of a maven mirror for JEI files, as a fallback
url = uri("https://modmaven.dev")
}
maven {
url = uri("https://www.cursemaven.com")
content {
includeGroup("curse.maven")
}
}
maven {
url = uri("https://api.modrinth.com/maven")
content {
includeGroup("maven.modrinth")
}
}
}
dependencies {
minecraft("net.minecraftforge:forge:${minecraft_version}-${forge_version}")
implementation(fg.deobf("com.teamabnormals:blueprint:${minecraft_version}-${blueprint_version}"))
annotationProcessor("org.spongepowered:mixin:${mixin_version}:processor")
compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:${mixin_extras_version}")!!)
implementation(jarJar("io.github.llamalad7:mixinextras-forge:${mixin_extras_version}")) {
jarJar.ranged(this, "[${mixin_extras_version},)")
}
// Compatibilities
implementation(fg.deobf("maven.modrinth:supplementaries:${supplementaries_version}"))
implementation(fg.deobf("maven.modrinth:amendments:${amendments_version}"))
implementation(fg.deobf("maven.modrinth:moonlight:${moonlight_lib_version}"))
// For dev testing
runtimeOnly(fg.deobf("maven.modrinth:oreganized:${oreganized_version}"))
runtimeOnly(fg.deobf("maven.modrinth:dye-depot:${dye_depot_version}"))
/// Utilities for the development environment
//runtimeOnly fg.deobf("curse.maven:jade-324717:${jade_version}")
// compile against the JEI API but do not include it at runtime
compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}"))
compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge-api:${jei_version}"))
// at runtime, use the full JEI jar for Forge
runtimeOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}"))
}
tasks.jar {
archiveClassifier.set("raw")
finalizedBy("reobfJar")
val now = LocalDateTime.now().toString()
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(rootProject.file("LICENSE")) {
rename { "${it}_${mod_name}" }
}
manifest {
attributes(
mapOf(
"Specification-Title" to mod_name,
"Specification-Vendor" to mod_author,
"Specification-Version" to mod_version,
"Implementation-Title" to mod_name,
"Implementation-Version" to mod_version,
"Implementation-Vendor" to mod_author,
"Implementation-Timestamp" to now,
)
)
}
}
tasks.jarJar {
archiveClassifier.set("")
}
tasks.withType<ProcessResources> {
// this will ensure that this task is redone when the versions change.
inputs.property("version", mod_version)
filesMatching(
listOf(
"META-INF/mods.toml",
"META-INF/neoforge.mods.toml",
"pack.mcmeta",
"fabric.mod.json",
"${mod_id}*.mixins.json",
)
) {
expand(
mapOf(
"mod_version" to mod_version,
"mod_name" to mod_name,
"mod_id" to mod_id,
"mod_author" to mod_author,
"repository" to repository,
)
)
}
}
val outputJar = tasks.jarJar.get().archiveFile.get().asFile
val changelogMarkdown = System.getenv("CHANGELOG")
modrinth {
token = System.getenv("MODRINTH_TOKEN")
projectId = modrinth_project
versionNumber = mod_version
versionType = release_type
versionName = "$mod_name $mod_version"
uploadFile = outputJar
gameVersions = listOf(minecraft_version)
loaders = listOf("forge")
changelog = changelogMarkdown
dependencies {
required.project("blueprint")
optional.project("oreganized")
}
}
tasks.register<TaskPublishCurseForge>("curseforge") {
group = "publishing"
apiToken = System.getenv("CURSEFORGE_TOKEN")
upload(curseforge_project, outputJar).apply {
changelogType = Constants.CHANGELOG_MARKDOWN
changelog = changelogMarkdown
releaseType = release_type
addModLoader("forge")
addGameVersion(minecraft_version)
displayName = "$mod_name $mod_version"
addRelation("blueprint", Constants.RELATION_REQUIRED)
addRelation("oreganized", Constants.RELATION_OPTIONAL)
}
}