-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle.kts
375 lines (274 loc) · 11.7 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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
import org.apache.tools.ant.taskdefs.condition.Os
import org.gradle.jvm.toolchain.JvmVendorSpec
plugins {
`java-library`
idea
id("maven-publish")
id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.8"
id("com.gtnewhorizons.retrofuturagradle") version "1.3.35"
}
group = "btpos.dj2addons"
version = "1.2.1.1.1"
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
// Azul covers the most platforms for Java 8 toolchains, crucially including MacOS arm64
vendor.set(JvmVendorSpec.AZUL)
}
// Generate sources and javadocs jars when building and publishing
withSourcesJar()
withJavadocJar()
}
idea {
module {
isDownloadJavadoc = true
isDownloadSources = true
inheritOutputDirs = true // Fix resources in IJ-Native runs
}
}
tasks.register<Copy>("copyModToModpack") {
group = "dj2addons"
from(tasks.reobfJar)
into(File("C:\\Users\\impro_000\\AppData\\Roaming\\.mineyourmind\\instances\\divinejourney2\\minecraft\\mods"))
}
val pythonFile: File = if (Os.isFamily(Os.FAMILY_WINDOWS)) {
project.file("venv/Scripts/python.exe")
} else {
project.file("venv/bin/python3")
}
// Add an access tranformer
// tasks.deobfuscateMergedJarToSrg.configure {accessTransformerFiles.from("src/main/resources/META-INF/mymod_at.cfg")}
// Dependencies
repositories {
mavenLocal()
maven {
name = "CurseMaven"
url = uri("https://cursemaven.com")
}
maven {
name = "Spongepowered"
url = uri("https://repo.spongepowered.org/repository/maven-public/")
}
maven {
name = "JEI Maven"
url = uri("https://dvs1.progwml6.com/files/maven")
}
maven {
name = "BlameJared"
url = uri("https://maven.blamejared.com/")
}
maven {
name = "CoFH Maven"
url = uri("https://maven.covers1624.net")
}
maven {
url = uri("https://maven.cleanroommc.com")
}
mavenCentral()
}
dependencies {
annotationProcessor(modUtils.enableMixins(
"org.spongepowered:mixin:${project.properties["mixin_version"]}:processor",
"mixins.dj2addons.refmap.json"
))
compileOnly("zone.rong:mixinbooter:7.0") {
isTransitive = false
}
runtimeOnly(rfg.deobf("curse.maven:mixin-booter-419286:4090558"))
implementation("CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-+")
implementation("mezz.jei:jei_1.12.2:4.16.1.302")
implementation(rfg.deobf("curse.maven:ActuallyAdditions-228404:3117927"))
compileOnly(rfg.deobf("curse.maven:DraconicEvolution-223565:3431261"))
compileOnly(rfg.deobf("curse.maven:EnderIO-64578:3328811"))
compileOnly(rfg.deobf("curse.maven:ProjectIntelligence-306028:2833640"))
compileOnly(rfg.deobf("curse.maven:EnderCore-231868:2972849"))
compileOnly(rfg.deobf("curse.maven:BrandonsCore-231382:3408276"))
compileOnly(rfg.deobf("curse.maven:CodeChickenLib-242818:2779848"))
compileOnly("cofh:RedstoneFlux:1.12-2.0.0.1:universal")
compileOnly(rfg.deobf("curse.maven:Erebus-220698:3211974"))
// **CRAFTTWEAKER HOOKS**
implementation(rfg.deobf("curse.maven:Patchouli-306770:3162874"))
implementation(rfg.deobf("curse.maven:Baubles-227083:2518667"))
compileOnly(rfg.deobf("curse.maven:Botania-225643:3330934"))
compileOnly(rfg.deobf("curse.maven:ExtraUtils2-225561:2678374"))
compileOnly(rfg.deobf("curse.maven:Roots-246183:3484394"))
compileOnly(rfg.deobf("curse.maven:MysticalWorld-282940:3460961"))
compileOnly(rfg.deobf("curse.maven:MysticalLib-277064:3483816"))
compileOnly(rfg.deobf("curse.maven:AstralSorcery-241721:3044416"))
compileOnly(rfg.deobf("curse.maven:ImmersiveEngineering-231951:2974106"))
compileOnly(rfg.deobf("curse.maven:BloodMagic-224791:2822288"))
compileOnly(rfg.deobf("curse.maven:GuideAPI-228832:2645992"))
compileOnly(rfg.deobf("curse.maven:Totemic-237541:2700798"))
compileOnly(rfg.deobf("curse.maven:ExtremeReactors-250277:3194746"))
compileOnly(rfg.deobf("curse.maven:ZeroCore-247921:3194743"))
compileOnly(rfg.deobf("curse.maven:Bewitchment-285439:3256343") as String) {
exclude(group="org.spongepowered")
}
compileOnly(rfg.deobf("curse.maven:ModTweaker-220954:3840577"))
// **TWEAKS**
compileOnly(rfg.deobf("curse.maven:RFTools-224641:2861573"))
compileOnly(rfg.deobf("curse.maven:McJtyLib-233105:2745846"))
compileOnly(rfg.deobf("curse.maven:Forgelin-248453:2785465"))
compileOnly(rfg.deobf("curse.maven:TeslaCoreLib-254602:3438487"))
compileOnly(rfg.deobf("curse.maven:IndustrialForegoing-266515:2745321"))
compileOnly(rfg.deobf("curse.maven:AgriCraft-225635:3317747"))
compileOnly(rfg.deobf("curse.maven:InfinityLib-251396:3317119"))
// compileOnly(
// rfg.deobf("curse.maven:MysticalAgriculture-246640:2704562")
// )
compileOnly(rfg.deobf("curse.maven:MysticalAgriculture-246640:2704562"))
compileOnly(rfg.deobf("curse.maven:MoreTweaker-336569:3226142"))
compileOnly(rfg.deobf("curse.maven:MTLib-253211:3308160"))
compileOnly(rfg.deobf("curse.maven:AppleSkin-248787:2987247"))
compileOnly(rfg.deobf("curse.maven:ModularMachinery-270790:2713714"))
compileOnly(rfg.deobf("curse.maven:ModularMagic-324318:2737623"))
compileOnly(rfg.deobf("curse.maven:Thaumcraft-223628:2629023"))
compileOnly(rfg.deobf("curse.maven:Aether-255308:3280119"))
compileOnly(rfg.deobf("curse.maven:PackagedAuto-308380:3614585"))
compileOnly(rfg.deobf("curse.maven:ThermalExpansion-69163:2926431"))
compileOnly(rfg.deobf("curse.maven:ThermalFoundation-222880:2926428"))
compileOnly(rfg.deobf("curse.maven:CoFHCore-69162:2920433"))
compileOnly(rfg.deobf("curse.maven:Mekanism-268560:2835175"))
compileOnly(rfg.deobf("curse.maven:RadixCore-77286:2483855"))
compileOnly(rfg.deobf("curse.maven:VanillaFix-292785:2915154"))
// Dev Tools
testImplementation( // For ZenDoc
"org.reflections:reflections:0.10.2"
)
// Testing Framework
testImplementation("org.junit.jupiter:junit-jupiter-api:5.2.0")
testCompileOnly("org.junit.jupiter:junit-jupiter-api:5.2.0")
testCompileOnly("org.junit.platform:junit-platform-launcher:1.1.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.2.0")
}
configurations.compileClasspath {
this.allDependencies.forEach {
if (it.group != "org.spongepowered")
(it as ExternalDependency).exclude(group="org.spongepowered")
}
}
// Most RFG configuration lives here, see the JavaDoc for com.gtnewhorizons.retrofuturagradle.MinecraftExtension
minecraft {
mcVersion.set("1.12.2")
// Username for client run configurations
username.set("Developer")
// Generate a field named VERSION with the mod version in the injected Tags class
injectedTags.put("VERSION", project.version)
// If you need the old replaceIn mechanism, prefer the injectTags task because it doesn't inject a javac plugin.
// tagReplacementFiles.add("RfgExampleMod.java")
// Enable assertions in the mod's package when running the client or server
extraRunJvmArguments.add("-ea:${project.group}")
extraRunJvmArguments.addAll(listOf("-Dforge.logging.console.level=debug", "-Dmixin.debug.verbose=true", "-Dmixin.debug.export=true"))
// If needed, add extra tweaker classes like for mixins
extraTweakClasses.add("org.spongepowered.asm.launch.MixinTweaker")
// Exclude some Maven dependency groups from being automatically included in the reobfuscated runs
groupsToExcludeFromAutoReobfMapping.addAll("com.diffplug", "com.diffplug.durian", "net.industrial-craft")
}
// Generates a class named rfg.examplemod.Tags with the mod version in it, you can find it at
tasks.injectTags.configure {
outputClassName.set("${project.group}.Tags")
}
tasks.processIdeaSettings.configure {
dependsOn(tasks.injectTags)
}
// Create a new dependency type for runtime-only dependencies that don't get included in the maven publication
val runtimeOnlyNonPublishable: Configuration by configurations.creating {
description = "Runtime only dependencies that are not published alongside the jar"
isCanBeConsumed = false
isCanBeResolved = false
}
listOf(configurations.runtimeClasspath, configurations.testRuntimeClasspath).forEach {
it.configure {
extendsFrom(
runtimeOnlyNonPublishable
)
}
}
configurations.testImplementation {
extendsFrom(configurations.runtimeClasspath.get(), configurations.compileClasspath.get())
}
// Put the version from gradle into mcmod.info
tasks.processResources.configure {
val projVersion = project.version.toString() // Needed for configuration cache to work
inputs.property("version", projVersion)
val mcVersion = "1.12.2"
inputs.property("mc_version", mcVersion)
filesMatching("mcmod.info") {
expand(mapOf("modVersion" to projVersion, "minecraftVersion" to mcVersion))
}
}
tasks.jar.configure {
manifest {
attributes(mapOf(
"FMLCorePluginContainsFMLMod" to true,
"FMLCorePlugin" to "btpos.dj2addons.core.DJ2ALoadingPlugin",
"TweakerClass" to "org.spongepowered.asm.launch.MixinTweaker"
))
}
}
tasks.javadoc {
with (options as StandardJavadocDocletOptions) {
addBooleanOption("Xdoclint:none", true)
tags(
"apiNote:a:API Note:",
"implSpec:a:Implementation Requirements:",
"implNote:a:Implementation Note:",
"reason:a:Reason:"
)
}
}
tasks.register<Exec>("generateModpackZip") {
commandLine(pythonFile, "./python/GenerateModpackZip.py")
}
tasks.register<Exec>("updateModpack") {
dependsOn(tasks.build)
commandLine(pythonFile, "./python/UpdateModpack.py")
}
tasks.register<Exec>("updateCFModpack") {
dependsOn(tasks.build)
commandLine(pythonFile, "./python/UpdateCFModpack.py")
}
tasks.register<Exec>("removeShadedMixinLibraries") {
commandLine(pythonFile, rootProject.file("python/RemoveShadedMixinLibraries.py").toString())
}
tasks.register<Copy>("generateTestZS") {
from(rootProject.file("Test.zs"))
into(project.file("run/scripts"))
}
//tasks.register("runTests", JavaExec::class) {
// dependsOn("build", "generateTestZS")
// val modproject = project(":mod")
// val coremodproject = project(":coremod")
// classpath = sourceSets.main.output.classesDirs
// + sourceSets.main.compileClasspath
// + sourceSets.test.output.classesDirs
// + sourceSets.test.runtimeClasspath
// + coremodproject.sourceSets.main.output.classesDirs
// + coremodproject.sourceSets.main.compileClasspath
// + coremodproject.sourceSets.test.output.classesDirs
// + coremodproject.sourceSets.test.runtimeClasspath
// main = "GenerateTestZS"
// setArgsString(rootProject.projectDir.toPath().resolve("Test.zs").toString())
//}
tasks.register<Jar>("buildTestJar") {
from(sourceSets.test)
archiveBaseName.set("dj2addons-test")
}
// Publishing to a Maven repository
//publishing {
// publications {
// create<MavenPublication>("maven") {
// from(components["java"])
// }
// }
// repositories {
// // Example: publishing to the GTNH Maven repository
// maven {
// url = uri("https://nexus.gtnewhorizons.com/repository/releases/")
// credentials {
// username = System.getenv("MAVEN_USER") ?: "NONE"
// password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
// }
// }
// }
//}