@@ -20,7 +20,7 @@ plugins {
2020 id(' eclipse' )
2121 id(' idea' )
2222 id(' maven-publish' )
23- id(' net.neoforged.gradle.userdev' ) version(' 7.0.138 ' )// https://projects.neoforged.net/neoforged/neogradle
23+ id(' net.neoforged.gradle.userdev' ) version(' 7.0.142 ' )// https://projects.neoforged.net/neoforged/neogradle
2424}
2525
2626tasks. named(' wrapper' , Wrapper ). configure {
@@ -157,7 +157,7 @@ SourceSet setupExtraSourceSet(SourceSet baseSourceSet, String extra) {
157157 extraSourceSet. compileClasspath + = project. sourceSets. main. output
158158 if (baseSourceSet != project. sourceSets. main) {
159159 // If the base sourceSet is main it already is the extra source set and has a reference to the base one from before this if statement
160- extraSourceSet. compileClasspath + = getExtraSourceSet(project. sourceSets. main, extra). output
160+ extraSourceSet. compileClasspath + = getExtraSourceSet(project. sourceSets. main, extra). get() . output
161161 extraSourceSet. compileClasspath + = baseSourceSet. output
162162 extraSourceSet. runs. modIdentifier = name
163163 }
@@ -170,12 +170,12 @@ static void extendConfigurations(Configuration base, Configuration... configurat
170170 }
171171}
172172
173- SourceSet getExtraSourceSet (String base , String name ) {
174- return getExtraSourceSet( project. sourceSets. named(base). get() , name)
173+ Provider< SourceSet > getExtraSourceSet (String base , String name ) {
174+ return project. sourceSets. named(base). flatMap(sourceSet -> getExtraSourceSet(sourceSet , name) )
175175}
176176
177- SourceSet getExtraSourceSet (SourceSet base , String name ) {
178- return project. sourceSets. named(base. getTaskName(name, null )). get()
177+ Provider< SourceSet > getExtraSourceSet (SourceSet base , String name ) {
178+ return project. sourceSets. named(base. getTaskName(name, null ))
179179}
180180
181181setupTasks(sourceSets. main)
@@ -205,7 +205,7 @@ def setupTasks(SourceSet sourceSet) {
205205 }
206206 tasks. named(sourceSet. compileJavaTaskName, JavaCompile ). configure { setGroup(' compile' ) }
207207 for (String extraType : extraTypes) {
208- def extraSourceSet = getExtraSourceSet(sourceSet, extraType)
208+ def extraSourceSet = getExtraSourceSet(sourceSet, extraType). get()
209209 tasks. named(extraSourceSet. processResourcesTaskName, ProcessResources ). configure {
210210 setGroup(' process resources' )
211211 dependsOn(compileTask)
@@ -267,22 +267,22 @@ static void setupClientAcc(Run run) {
267267}
268268
269269runs {
270- configureEach { Run run ->
271- if (run . project . hasProperty(' forge_force_ansi' )) {
270+ configureEach {
271+ if (hasProperty(' forge_force_ansi' )) {
272272 // Force ansi if declared as a gradle variable, as the auto detection doesn't detect IntelliJ properly
273273 // or eclipse's plugin that adds support for ansi escape in console
274- run . jvmArguments. add(" -Dterminal.ansi=${ run.project. property('forge_force_ansi')} " )
274+ jvmArguments. add(" -Dterminal.ansi=${ property('forge_force_ansi')} " )
275275 }
276276
277- run . modSources. addAll ((SourceSet []) [sourceSets. main, sourceSets. api])
277+ modSources. add ((SourceSet []) [sourceSets. main, sourceSets. api])
278278
279279 for (String name : secondaryModules) {
280- run . modSources. add((SourceSet ) sourceSets. getByName (name))
280+ modSources. add((SourceSet ) sourceSets. named (name) . get( ))
281281 }
282282
283283 // if the selected toolchain is a JBR, enable DCEVM
284- if (run . project . javaToolchains. launcherFor(java. toolchain). map { it. metadata. vendor }. getOrElse(' ' ). contains(' JetBrains' )) {
285- run . jvmArguments. add(' -XX:+AllowEnhancedClassRedefinition' )
284+ if (javaToolchains. launcherFor(java. toolchain). map { it. metadata. vendor }. getOrElse(' ' ). contains(' JetBrains' )) {
285+ jvmArguments. add(' -XX:+AllowEnhancedClassRedefinition' )
286286 }
287287 }
288288 client { Run run -> setupClientAcc(run) }
@@ -314,13 +314,12 @@ runs {
314314 modSources. add((SourceSet ) sourceSets. datagenMain)
315315
316316 for (String name : secondaryModules) {
317- def modName = " mekanism${ name} "
318- modSources. add(getExtraSourceSet(name, ' datagen' ))
319- programArguments. addAll((String []) [' --mod' , modName, ' --existing' , file(" src/${ name} /resources/" ). absolutePath])
317+ modSources. add(getExtraSourceSet(name, ' datagen' ). get())
318+ programArguments. addAll((String []) [' --mod' , " mekanism${ name} " , ' --existing' , file(" src/${ name} /resources/" ). absolutePath])
320319 }
321320
322321 dependencies {
323- runtime(project . configurations. datagenNonMod)
322+ runtime(configurations. datagenNonMod)
324323 }
325324 }
326325}
@@ -505,8 +504,8 @@ def mergeModuleResources = tasks.register('mergeModuleResources', MergeModuleRes
505504 annotationGenerated = sourceSets. main. output. classesDirs
506505 for (String name : secondaryModules) {
507506 SourceSet secondarySourceSet = sourceSets. named(name). get()
508- resources = resources + tasks. named(secondarySourceSet. processResourcesTaskName). get(). outputs. files
509- annotationGenerated = annotationGenerated + secondarySourceSet. output. classesDirs
507+ resources + = tasks. named(secondarySourceSet. processResourcesTaskName). get(). outputs. files
508+ annotationGenerated + = secondarySourceSet. output. classesDirs
510509 }
511510 // Only look at generated service files as a restriction for our input
512511 annotationGenerated = annotationGenerated. asFileTree. matching(serviceFilter)
@@ -521,7 +520,7 @@ def allJar = tasks.register('allJar', AllJar, {
521520 apiOutput = sourceSets. api. output
522521 mainOutput = sourceSets. main. output
523522 for (String name : secondaryModules) {
524- secondaryModuleOutputs = secondaryModuleOutputs + sourceSets. named(name). get(). output
523+ secondaryModuleOutputs + = sourceSets. named(name). get(). output
525524 }
526525})
527526
@@ -531,6 +530,7 @@ tasks.withType(JavaCompile).configureEach({
531530})
532531
533532tasks. withType(Javadoc ). configureEach({
533+ options. encoding = ' UTF-8'
534534 options. tags = [
535535 ' apiNote:a:<em>API Note:</em>' ,
536536 ' implSpec:a:<em>Implementation Requirements:</em>' ,
0 commit comments