@@ -14,7 +14,7 @@ import java.util.function.Consumer
14
14
15
15
plugins {
16
16
id(' org.ajoberstar.grgit.service' )// Version declared in buildSrc
17
- id(' net.darkhax.curseforgegradle' ) version(' 1.1.25 ' )
17
+ id(' net.darkhax.curseforgegradle' ) version(' 1.1.26 ' )
18
18
id(' com.modrinth.minotaur' ) version(' 2.8.7' )
19
19
id(' java' )
20
20
id(' eclipse' )
@@ -23,9 +23,9 @@ plugins {
23
23
id(' net.neoforged.gradle.userdev' ) version(' 7.0.154' )// https://projects.neoforged.net/neoforged/neogradle
24
24
}
25
25
26
- tasks. named(' wrapper' , Wrapper ). configure {
26
+ tasks. named(' wrapper' , Wrapper ) {
27
27
// Define wrapper values here so as to not have to always do so when updating gradlew.properties
28
- gradleVersion = ' 8.10 '
28
+ gradleVersion = ' 8.12 '
29
29
distributionType = Wrapper.DistributionType . ALL
30
30
}
31
31
@@ -184,43 +184,42 @@ for (String name : secondaryModules) {
184
184
}
185
185
186
186
def setupTasks (SourceSet sourceSet ) {
187
- def compileTask = tasks. named(sourceSet. compileJavaTaskName, JavaCompile )
187
+ def compileTask = tasks. named(sourceSet. compileJavaTaskName, JavaCompile ) {
188
+ // Configure specific compile tasks to have the proper annotation processor info
189
+ setGroup(' compile' )
190
+ options. annotationProcessorPath = configurations. annotationProcessor
191
+ options. compilerArgs. addAll([
192
+ " -AmekanismModule=mekanism${ sourceSet == sourceSets.main ? '' : sourceSet.name} " ,// annotation processor param
193
+ ' -parameters'
194
+ ])
195
+ }
188
196
// Set the various variables/settings for the different process resources tasks
189
- tasks. named(sourceSet. processResourcesTaskName, ProcessResources ). configure { ProcessResources process ->
190
- process . setGroup(' process resources' )
191
- process . duplicatesStrategy( DuplicatesStrategy . FAIL )
197
+ tasks. named(sourceSet. processResourcesTaskName, ProcessResources ) {
198
+ setGroup(' process resources' )
199
+ duplicatesStrategy = DuplicatesStrategy . FAIL
192
200
var versionProperties = [' version' : mod_version, ' mc_version' : minecraft_version_range, ' forge_version' : forge_version_range, ' loader_version' : loader_version_range,
193
201
' jei_version' : jei_version_range]
194
202
// Mark the properties as inputs so that when they change things update
195
- process . inputs. properties(versionProperties)
196
- process . filesMatching(' META-INF/neoforge.mods.toml' ) { expand(versionProperties) }
197
- process . from(" ${ projectDir} " ) { include(' logo.png' ) }
203
+ inputs. properties(versionProperties)
204
+ filesMatching(' META-INF/neoforge.mods.toml' ) { expand(versionProperties) }
205
+ from(" ${ projectDir} " ) { include(' logo.png' ) }
198
206
// Depend on the compile task so that we can map the computer methods as needed
199
- process . dependsOn(compileTask)
207
+ dependsOn(compileTask)
200
208
def files = fileTree(dir : outputs. files. asPath, includes : [' **/*.json' , ' **/*.mcmeta' ])
201
- process . doLast {
209
+ doLast {
202
210
for (def file : files) {
203
211
file. text = JsonOutput . toJson(new JsonSlurper (). parse(file))
204
212
}
205
213
}
206
214
}
207
- tasks. named(sourceSet. compileJavaTaskName, JavaCompile ). configure { setGroup(' compile' ) }
215
+ tasks. named(sourceSet. compileJavaTaskName, JavaCompile ) { setGroup(' compile' ) }
208
216
for (String extraType : extraTypes) {
209
217
def extraSourceSet = getExtraSourceSet(sourceSet, extraType). get()
210
- tasks. named(extraSourceSet. processResourcesTaskName, ProcessResources ). configure {
218
+ tasks. named(extraSourceSet. processResourcesTaskName, ProcessResources ) {
211
219
setGroup(' process resources' )
212
220
dependsOn(compileTask)
213
221
}
214
- tasks. named(extraSourceSet. compileJavaTaskName, JavaCompile ). configure { setGroup(' compile' ) }
215
- }
216
- // Configure specific compile tasks to have the proper annotation processor info
217
- compileTask. configure { JavaCompile task ->
218
- setGroup(' compile' )
219
- task. options. annotationProcessorPath = configurations. annotationProcessor
220
- task. options. compilerArgs. addAll([
221
- " -AmekanismModule=mekanism${ sourceSet == sourceSets.main ? '' : sourceSet.name} " ,// annotation processor param
222
- ' -parameters'
223
- ])
222
+ tasks. named(extraSourceSet. compileJavaTaskName, JavaCompile ) { setGroup(' compile' ) }
224
223
}
225
224
}
226
225
@@ -342,9 +341,9 @@ repositories { RepositoryHandler handler ->
342
341
exclusiveRepo(handler, ' https://maven.parchmentmc.org/' , ' org.parchmentmc.data' )
343
342
}
344
343
345
- tasks. named(' test' ). configure {
344
+ tasks. named(' test' ) {
346
345
// Disable builtin test task as we use and build uses testJunit so there is no point in having it also attempt to run an empty test task
347
- enabled( false )
346
+ enabled = false
348
347
}
349
348
350
349
dependencies {
@@ -438,39 +437,39 @@ def getManifestAttributes(String title) {
438
437
]
439
438
}
440
439
441
- tasks. named(' jar' , Jar ). configure { Jar jar ->
442
- jar . duplicatesStrategy( DuplicatesStrategy . FAIL )
443
- jar . from([sourceSets. api. output, sourceSets. main. output])
444
- jar . exclude(' crafttweaker_parameter_names.json' )
445
- jar . manifest. attributes(getManifestAttributes(' Mekanism' ))
440
+ tasks. named(' jar' , Jar ) {
441
+ duplicatesStrategy = DuplicatesStrategy . FAIL
442
+ from([sourceSets. api. output, sourceSets. main. output])
443
+ exclude(' crafttweaker_parameter_names.json' )
444
+ manifest. attributes(getManifestAttributes(' Mekanism' ))
446
445
}
447
446
448
- tasks. named(' sourcesJar' , Jar ). configure { Jar jar ->
447
+ tasks. named(' sourcesJar' , Jar ) {
449
448
dependsOn(classes, apiClasses, additionsClasses, generatorsClasses, toolsClasses)
450
- jar . duplicatesStrategy( DuplicatesStrategy . FAIL )
449
+ duplicatesStrategy = DuplicatesStrategy . FAIL
451
450
// Note: Already contains main source set's sources by default
452
- jar . from(sourceSets. api. allJava, sourceSets. additions. allJava, sourceSets. generators. allJava, sourceSets. tools. allJava)
453
- jar . manifest. attributes(getManifestAttributes(' Mekanism' ))
451
+ from(sourceSets. api. allJava, sourceSets. additions. allJava, sourceSets. generators. allJava, sourceSets. tools. allJava)
452
+ manifest. attributes(getManifestAttributes(' Mekanism' ))
454
453
}
455
454
456
455
def secondaryJar (SourceSet sourceSet , String title ) {
457
- return tasks. register(sourceSet. jarTaskName, Jar , {
458
- duplicatesStrategy( DuplicatesStrategy . FAIL )
456
+ return tasks. register(sourceSet. jarTaskName, Jar ) {
457
+ duplicatesStrategy = DuplicatesStrategy . FAIL
459
458
archiveClassifier. set(sourceSet. name)
460
459
from(sourceSet. output)
461
460
if (! title. isEmpty()) {
462
461
archiveFileName. set(" ${ title} -${ project.version} .jar" )
463
462
}
464
463
manifest. attributes(getManifestAttributes(title. isEmpty() ? ' Mekanism' : title))
465
- })
464
+ }
466
465
}
467
466
468
467
def apiJar = secondaryJar(sourceSets. api, ' ' )
469
468
def additionsJar = secondaryJar(sourceSets. additions, ' MekanismAdditions' )
470
469
def generatorsJar = secondaryJar(sourceSets. generators, ' MekanismGenerators' )
471
470
def toolsJar = secondaryJar(sourceSets. tools, ' MekanismTools' )
472
471
473
- def mergeModuleResources = tasks. register(' mergeModuleResources' , MergeModuleResources , {
472
+ def mergeModuleResources = tasks. register(' mergeModuleResources' , MergeModuleResources ) {
474
473
dependsOn(' classes' , ' apiClasses' , ' additionsClasses' , ' generatorsClasses' , ' toolsClasses' )
475
474
mustRunAfter(' clean' )
476
475
// Note: Get the resources from the output of process resources, so that any expands that need to happen we know have already happened
@@ -485,11 +484,11 @@ def mergeModuleResources = tasks.register('mergeModuleResources', MergeModuleRes
485
484
}
486
485
// Only look at generated service files as a restriction for our input
487
486
annotationGenerated = annotationGenerated. asFileTree. matching(serviceFilter)
488
- })
487
+ }
489
488
490
- def allJar = tasks. register(' allJar' , AllJar , {
489
+ def allJar = tasks. register(' allJar' , AllJar ) {
491
490
dependsOn(mergeModuleResources)
492
- duplicatesStrategy( DuplicatesStrategy . FAIL )
491
+ duplicatesStrategy = DuplicatesStrategy . FAIL
493
492
archiveClassifier. set(' all' )
494
493
manifest. attributes(getManifestAttributes(' MekanismAll' ))
495
494
pathsToExclude. set(mergeModuleResources. flatMap(m -> m. pathsToExclude))
@@ -498,7 +497,7 @@ def allJar = tasks.register('allJar', AllJar, {
498
497
for (String name : secondaryModules) {
499
498
secondaryModuleOutputs + = sourceSets. named(name). get(). output
500
499
}
501
- })
500
+ }
502
501
503
502
tasks. withType(JavaCompile ). configureEach({
504
503
options. encoding = ' UTF-8'
@@ -603,7 +602,7 @@ outputChangelog.configure { OutputChangelog out ->
603
602
604
603
if (System . getenv(' CURSEFORGE_KEY' ) != null || project. hasProperty(' curseforgeKey' )) {
605
604
logger. lifecycle(' Enabling Curseforge config' )
606
- tasks. register(' curseforge' , TaskPublishCurseForge , { task ->
605
+ tasks. register(' curseforge' , TaskPublishCurseForge ) { task ->
607
606
dependsOn(outputChangelog)
608
607
setGroup(' publishing' )
609
608
setDescription(' Upload Mekanism to CurseForge' )
@@ -655,7 +654,7 @@ if (System.getenv('CURSEFORGE_KEY') != null || project.hasProperty('curseforgeKe
655
654
logger. quiet(' https://www.curseforge.com/minecraft/mc-mods/mekanism-generators/files/{}' , (Object ) generatorsCfUpload. curseFileId)
656
655
logger. quiet(' https://www.curseforge.com/minecraft/mc-mods/mekanism-tools/files/{}' , (Object ) toolsCfUpload. curseFileId)
657
656
}
658
- })
657
+ }
659
658
}
660
659
661
660
void setGenericCurseArtifactData (UploadArtifact artifact , Provider<RegularFile > changelog ) {
@@ -679,7 +678,7 @@ if (System.getenv('MODRINTH_TOKEN') != null || project.hasProperty('modrinthToke
679
678
def additionsModrinth = createSecondaryModrinthUpload(' additions' , ' a6F3uASn' , additionsJar)
680
679
def generatorsModrinth = createSecondaryModrinthUpload(' generators' , ' OFVYKsAk' , generatorsJar)
681
680
def toolsModrinth = createSecondaryModrinthUpload(' tools' , ' tqQpq1lt' , toolsJar)
682
- tasks. named(' modrinth' ). configure {
681
+ tasks. named(' modrinth' ) {
683
682
dependsOn(jar, apiJar, outputChangelog)
684
683
finalizedBy(additionsModrinth, generatorsModrinth, toolsModrinth)
685
684
notCompatibleWithConfigurationCache(' Not yet compatible' )// TODO: Remove when possible
@@ -725,7 +724,7 @@ if (System.getenv('MODRINTH_TOKEN') != null || project.hasProperty('modrinthToke
725
724
}
726
725
727
726
def createSecondaryModrinthUpload (String output , String targetProjectId , TaskProvider<Jar > sourceSetJar ) {
728
- return tasks. register(" ${ output} Modrinth" , TaskModrinthUpload , {
727
+ return tasks. register(" ${ output} Modrinth" , TaskModrinthUpload ) {
729
728
setGroup(' publishing' )
730
729
setDescription(" Upload Mekanism ${ output} to Modrinth" )
731
730
dependsOn(tasks. named(' modrinth' ), sourceSetJar)
@@ -747,5 +746,5 @@ def createSecondaryModrinthUpload(String output, String targetProjectId, TaskPro
747
746
}
748
747
logger. lifecycle(' Updated Modrinth extension' )
749
748
}
750
- })
749
+ }
751
750
}
0 commit comments