1- buildscript {
2- dependencies {
3- classpath group : ' net.minecraftforge.gradle' , name : ' ForgeGradle' , version : ' 6.0.23+' , changing : true
4- classpath(" io.github.goooler.shadow:shadow-gradle-plugin:8.1.7" )
5- classpath ' org.parchmentmc:librarian:1.+'
6- classpath ' org.spongepowered:mixingradle:0.7.+'
7- classpath group : ' com.modrinth.minotaur' , name : ' Minotaur' , version : ' 2.+'
8- classpath ' org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.20'
9- }
10- }
1+ import net.darkhax.curseforgegradle.TaskPublishCurseForge
112
123plugins {
13- id ' idea'
14- id ' net.minecraftforge.gradle' version ' [6.0,6.2)'
15- id ' org.spongepowered.mixin' version ' 0.7-SNAPSHOT'
16- id ' net.darkhax.curseforgegradle' version ' 1.+'
4+ id ' multiloader-loader'
5+ id ' net.minecraftforge.accesstransformers' version ' 5.0.2'
6+ id ' net.minecraftforge.gradle' version ' 7.0.0-beta.55'
7+ id " net.darkhax.curseforgegradle" version " 1.+"
8+ id " com.modrinth.minotaur" version " 2.+"
9+ id ' com.gradleup.shadow'
1710}
1811
19- apply plugin : ' org.jetbrains.kotlin.jvm'
20- apply plugin : ' kotlin'
21- apply plugin : ' io.github.goooler.shadow'
22- apply plugin : ' org.parchmentmc.librarian.forgegradle'
23- apply plugin : " com.modrinth.minotaur"
24- apply plugin : " maven-publish"
25-
26- def loaderName = " forge"
27- version = " ${ project.minecraft_version} -${ project.mod_version} "
28- def modVersion = " ${ project.mod_version} "
29-
30- group = project. group_id
31- archivesBaseName = " ${ project.base_name} -${ loaderName} "
32-
12+ repositories {
13+ maven minecraft. mavenizer
14+ maven fg. forgeMaven
15+ maven fg. minecraftLibsMaven
16+ mavenCentral()
17+ }
3318configurations {
3419 shade
3520}
3621
37- configurations. all {
38- // Check for snapshots more frequently than Gradle's default of 1 day. 0 = every build.
39- resolutionStrategy. cacheChangingModulesFor 0 , ' seconds'
40- }
41-
42- // jarJar.enable()
43- //
44- // tasks.jarJar.configure {
45- // archiveClassifier.set("")
46- // }
47- // tasks.named("assemble").configure {
48- // dependsOn("jarJar")
49- // }
50-
51- minecraft. reobf = false
5222dependencies {
53- minecraft " net.minecraftforge:forge:${ project.minecraft_version} -${ project.forge_version} "
54- annotationProcessor ' org.spongepowered:mixin:0.8.5:processor'
55- implementation(" net.sf.jopt-simple:jopt-simple:5.0.4" ) { version { strictly " 5.0.4" } }
56-
23+ implementation minecraft. dependency(" net.minecraftforge:forge:${ minecraft_version} -${ forge_version} " )
24+ annotationProcessor ' net.minecraftforge:eventbus-validator:7.0-beta.10'
5725 compileOnly group : ' info.journeymap' , name : ' journeymap-api-forge' , version : " ${ project.journeymap_api_version} -${ project.minecraft_version} -SNAPSHOT" , changing : true
58- implementation group : ' org.jetbrains.kotlin' , name : ' kotlin-stdlib' , version : ' 2.1.20 '
26+ implementation group : ' org.jetbrains.kotlin' , name : ' kotlin-stdlib' , version : ' 2.2.21 '
5927
6028 shade group : ' info.journeymap' , name : ' webmap-client' , version : project. journeymap_webmap_version, changing : true
6129
@@ -65,64 +33,34 @@ dependencies {
6533
6634 testCompileOnly group : ' info.journeymap' , name : ' journeymap-api-forge' , version : " ${ project.journeymap_api_version} -${ project.minecraft_version} -SNAPSHOT" , changing : true
6735
68- compileOnly project(" :common" )
69- }
70-
71- mixin {
72- add sourceSets. main, " journeymap-refmap.json"
7336}
7437
7538minecraft {
76- mappings channel : " official " , version : " ${ project.minecraft_version } "
39+ mappings channel : project . mappings_channel , version : " ${ project.mappings_mc_version } - ${ project.mappings_date } "
7740
78- copyIdeResources = true // Calls processResources when in dev
79-
80- if (file(" src/main/resources/META-INF/accesstransformer.cfg" ). exists()) {
81- accessTransformer = file(" src/main/resources/META-INF/accesstransformer.cfg" )
82- }
41+ accessTransformers = ' ../../../../common/src/main/resources/META-INF/accesstransformer.cfg'
8342
8443 runs {
85- client = {
86- // needed for deps with mixins.
87- property " mixin.debug.export" , " true"
88- property " mixin.env.remapRefMap" , " true"
89- property " mixin.env.refMapRemappingFile" , " ${ buildDir} /createSrgToMcp/output.srg"
90- properties " forge.logging.console.level" : " info"
91- properties " journeymap.map_testing" : " true"
92-
93-
94- workingDirectory project. file(" run/client" )
95- mods {
96- modClientRun {
97- source sourceSets. main
98- source project(" :common" ). sourceSets. main
99- }
100- }
44+ configureEach {
45+ systemProperty ' forge.logging.console.level' , ' debug'
46+ systemProperty ' eventbus.api.strictRuntimeChecks' , ' true'
10147 }
102- server = {
103- arg " nogui"
104- property " mixin.debug.export" , " true"
105- property " mixin.env.remapRefMap" , " true"
106- property " mixin.env.refMapRemappingFile" , " ${ buildDir} /createSrgToMcp/output.srg"
107- properties " forge.logging.console.level" : " info"
108- properties " mixin.env.disableRefMap" : " true"
109- properties " forge.logging.markers" : " SCAN,REGISTRIES,REGISTRYDUMP"
110- workingDirectory project. file(" run/server" )
111- mods {
112- modServerRun {
113- source sourceSets. main
114- source project(" :common" ). sourceSets. main
115- }
116- }
48+ register(' client' ) {
49+ workingDir. convention layout. projectDirectory. dir(" run/client" )
50+ }
51+ register(' server' ) {
52+ workingDir. convention layout. projectDirectory. dir(" run/server" )
53+ args " nogui"
11754 }
11855 }
11956}
120-
121- minecraft. runs. all {
122- lazyToken(' minecraft_classpath' ) {
123- configurations. library. copyRecursive(). resolve(). collect { it. absolutePath }. join(File . pathSeparator)
124- }
125- }
57+ // sourceSets.main.resources.srcDir 'src/generated/resources'
58+ //
59+ // sourceSets.each {
60+ // def dir = layout.buildDirectory.dir("sourcesSets/$it.name")
61+ // it.output.resourcesDir = dir
62+ // it.java.destinationDirectory = dir
63+ // }
12664
12765
12866shadowJar {
@@ -156,94 +94,13 @@ shadowJar {
15694 exclude ' LICENSE.txt'
15795}
15896
159- tasks. withType(JavaCompile ) {
160- source(project(" :common" ). sourceSets. main. allSource)
161- options. encoding = " UTF-8"
162- }
163-
164-
165- // This block of code expands all the gradle properties in the specified resource targets.
166- // It copies them into the targets and expands all the defined properties.
167- def resourceTargets = [' META-INF/mods.toml' , ' pack.mcmeta' , ' license.txt' ]
168- def intoTargets = [" $rootDir /out/production/resources/" , " $rootDir /out/production/${ project.name} .main/" , " $rootDir /bin/main/" ]
169- def replaceProperties = [
170- version : project. version,
171- modVersion : modVersion,
172- mcversion : project. minecraft_version,
173- date : getDate()
174- ]
175-
176- processResources() {
177- from project(" :common" ). sourceSets. main. resources
178- duplicatesStrategy = DuplicatesStrategy . EXCLUDE
179- // duplicatesStrategy = DuplicatesStrategy.INCLUDE
180- // this will ensure that this task is redone when the versions change.
181- inputs. properties replaceProperties
182- filesMatching(resourceTargets) {
183- expand replaceProperties
184- }
185-
186- intoTargets. each { target ->
187- if (file(target). exists()) {
188- copy {
189- from(sourceSets. main. resources) {
190- include resourceTargets
191- expand replaceProperties
192- }
193- into target
194- }
195- }
196- }
197- }
198-
199- task processDocs (type : Copy ) {
200- // update docs
201- from(file(" ../doc/" )) {
202- include ' *.html'
203- expand ' version' : project. version,
204- ' date' : getDate(),
205- ' mcversion' : project. minecraft_version,
206- ' loaderversion' : project. forge_version,
207- ' loadername' : " Forge"
208- }
209- into ' build/doc'
210- }
21197
21298tasks. assemble. dependsOn shadowJar
21399
214- clean. doFirst {
215- // Remove the Webpack bundled assets as part of the clean task
216- delete " $projectDir /src/main/resources/assets/journeymap/web/"
217- }
218-
219- jar {
220- archiveClassifier. set(' slim' )
221- dependsOn ' processDocs'
222- manifest {
223- attributes([
224- " Specification-Title" : project. name,
225- " Specification-Vendor" : project. group_id,
226- " Specification-Version" : " 1" , // We are version 1 of ourselves
227- " Implementation-Title" : project. name,
228- " Implementation-Version" : " ${ version} " ,
229- " Implementation-Vendor" : project. group_id,
230- " Implementation-URL" : " http://journeymap.info" ,
231- " Implementation-Timestamp" : getDate(),
232- " FMLAT" : " accesstransformer.cfg" ,
233- ])
234- }
235- }
236-
237-
238100artifacts {
239101 archives shadowJar
240102}
241103
242- def getDate () {
243- def date = new Date ()
244- def formattedDate = date. format(project. dateFormat)
245- return formattedDate
246- }
247104
248105// Automated upload to CurseForge for the win!
249106if (! project. hasProperty(" curseForgeApiKey" )) {
@@ -253,15 +110,14 @@ if (!project.hasProperty("modrinthApiKey")) {
253110 ext. modrinthApiKey = project. findProperty(" modrinth_api_key" ) ?: " notset"
254111}
255112
256- task publishCurseForge (type : net.darkhax.curseforgegradle.TaskPublishCurseForge ) {
257-
113+ tasks. register(" publishCurseForge" , TaskPublishCurseForge ) {
258114 apiToken = " ${ curseForgeApiKey} "
259115 def mainFile = upload(curseforge_project_id, shadowJar)
260- mainFile. displayName = " ${ project.mod_id} -${ version} +${ loaderName } "
116+ mainFile. displayName = " ${ project.mod_id} -${ version} +${ project.name } "
261117 mainFile. releaseType = release_type
262118 mainFile. addModLoader(" Forge" )
263119 mainFile. addJavaVersion(" Java 21" )
264- mainFile. addGameVersion(" ${ project.minecraft_version} " , " 1.21.1 " , " 1.21.5 " , " 1.21.8 " )
120+ mainFile. addGameVersion(" ${ project.minecraft_version} " , " 1.21.11 " )
265121 mainFile. addRelation(" journeymap" , " requiredDependency" )
266122 mainFile. changelogType = " html"
267123 mainFile. changelog = file(" $project . buildDir /doc/changelog.html" )
@@ -273,26 +129,17 @@ modrinth {
273129 token = " ${ modrinthApiKey} "
274130 projectId = modrinth_project_id
275131 versionNumber = " ${ version} -forge"
276- versionName = " ${ project.mod_id} -${ version} +${ loaderName } "
132+ versionName = " ${ project.mod_id} -${ version} +${ project.name } "
277133 versionType = release_type
278134 uploadFile = shadowJar
279- gameVersions = [" ${ project.minecraft_version} " , " 1.21.1 " , " 1.21.5 " , " 1.21.8 " ]
135+ gameVersions = [" ${ project.minecraft_version} " , " 1.21.11 " ]
280136 loaders = [" forge" ]
281137 changelog = file(' /build/doc/changelog.html' ). exists() ? file(' /build/doc/changelog.html' ). text : null
282138 dependencies {
283139 required. project " journeymap"
284140 }
285141}
286142
287- // Ensure build is done prior to cursegradle tasks
288- project. afterEvaluate {
289- project. tasks. findAll { task ->
290- (task. name. startsWith(' curseforge' ) || task. name. startsWith(' modrinth' ))
291- && (task. name != ' curseforge' || task. name != ' modrinth' )
292- }. each { projectTask ->
293- projectTask. dependsOn build
294- }
295- }
296143tasks. withType(PublishToMavenRepository ) { task ->
297144 task. dependsOn shadowJar
298145}
@@ -316,7 +163,7 @@ publishing {
316163 publications {
317164 mavenJava(MavenPublication ) {
318165 groupId project. group
319- artifactId project . archivesBaseName
166+ artifactId base . archivesName . get()
320167 version " ${ project.version} -forge"
321168 artifact shadowJar
322169 }
0 commit comments