4444}
4545
4646ext {
47- versionProperties = [' version' : mod_version, ' mc_version' : minecraft_version_range, ' forge_version' : forge_version_range, ' loader_version' : loader_version_range]
48- jsonPatterns = [' **/*.json' , ' **/*.mcmeta' ]
4947 secondaryModules = [' additions' , ' defense' , ' generators' , ' tools' ]
5048 extraTypes = [' datagen' ]
5149}
@@ -186,48 +184,20 @@ for (String name : secondaryModules) {
186184}
187185
188186def setupTasks (SourceSet sourceSet ) {
189- def output = sourceSet. name
190187 def compileTask = tasks. named(sourceSet. compileJavaTaskName, JavaCompile )
191- // TODO: Replace with putting this in process resources and specifying the replacement properties as input to the task
192- def replaceResourceTask = tasks. register(sourceSet. getTaskName(' replace' , ' resources' ), Copy , {
193- setGroup(' replace resources' )
194- outputs. upToDateWhen { false }
195- def modsToml = copySpec {
196- from(sourceSet. resources) {
197- include(' META-INF/neoforge.mods.toml' )
198- expand(versionProperties)
199- }
200- }
201- // Copy it into the build dir
202- with(modsToml)
203- into layout. buildDirectory. dir(" resources/${ output} /" )
204- // If IntelliJ's output dir exists, copy it there as well
205- def intellijPath = sourceSet == project. sourceSets. main ? ' production' : output
206- if (new File (" $rootDir /out/${ intellijPath} /resources/" ). exists()) {
207- copy {
208- with(modsToml)
209- into(" $rootDir /out/${ intellijPath} /resources/" )
210- }
211- }
212- // If Eclipse's output dir exists, copy it there as well
213- if (new File (" $rootDir /bin/${ output} /" ). exists()) {
214- copy {
215- with(modsToml)
216- into(" $rootDir /bin/${ output} /" )
217- }
218- }
219- })
220188 // Set the various variables/settings for the different process resources tasks
221189 tasks. named(sourceSet. processResourcesTaskName, ProcessResources ). configure { ProcessResources process ->
222- setGroup(' process resources' )
190+ process . setGroup(' process resources' )
223191 process. duplicatesStrategy(DuplicatesStrategy . FAIL )
224- process. exclude(' META-INF/neoforge.mods.toml' )
192+ var versionProperties = [' version' : mod_version, ' mc_version' : minecraft_version_range, ' forge_version' : forge_version_range, ' loader_version' : loader_version_range]
193+ // Mark the properties as inputs so that when they change things update
194+ process. inputs. properties(versionProperties)
195+ process. filesMatching(' META-INF/neoforge.mods.toml' ) { expand(versionProperties) }
225196 process. from(" ${ projectDir} " ) { include(' logo.png' ) }
226197 // Depend on the compile task so that we can map the computer methods as needed
227- dependsOn(compileTask)
228- finalizedBy(replaceResourceTask)
229- def files = fileTree(dir : outputs. files. asPath, includes : jsonPatterns)
230- doLast {
198+ process. dependsOn(compileTask)
199+ def files = fileTree(dir : outputs. files. asPath, includes : [' **/*.json' , ' **/*.mcmeta' ])
200+ process. doLast {
231201 for (def file : files) {
232202 file. text = JsonOutput . toJson(new JsonSlurper (). parse(file))
233203 }
@@ -242,14 +212,12 @@ def setupTasks(SourceSet sourceSet) {
242212 }
243213 tasks. named(extraSourceSet. compileJavaTaskName, JavaCompile ). configure { setGroup(' compile' ) }
244214 }
245- // Make the various classes tasks depend on the corresponding replaceResources tasks in addition to the default processResources tasks they depend on
246- tasks. named(sourceSet. classesTaskName). configure { dependsOn(replaceResourceTask) }
247215 // Configure specific compile tasks to have the proper annotation processor info
248216 compileTask. configure { JavaCompile task ->
249217 setGroup(' compile' )
250218 task. options. annotationProcessorPath = configurations. annotationProcessor
251219 task. options. compilerArgs. addAll([
252- " -AmekanismModule=mekanism${ sourceSet == sourceSets.main ? '' : output } " ,// annotation processor param
220+ " -AmekanismModule=mekanism${ sourceSet == sourceSets.main ? '' : sourceSet.name } " ,// annotation processor param
253221 ' -parameters'
254222 ])
255223 }
@@ -715,6 +683,7 @@ if (System.getenv('CURSEFORGE_KEY') != null || project.hasProperty('curseforgeKe
715683 tasks. register(' curseforge' , TaskPublishCurseForge , { task ->
716684 setGroup(' publishing' )
717685 setDescription(' Upload Mekanism to CurseForge' )
686+ notCompatibleWithConfigurationCache(' Not yet compatible' )// TODO: Remove when possible
718687
719688 apiToken = System . getenv(' CURSEFORGE_KEY' ) ?: project. findProperty(' curseforgeKey' )
720689
@@ -782,6 +751,7 @@ if (System.getenv('MODRINTH_TOKEN') != null || project.hasProperty('modrinthToke
782751 tasks. named(' modrinth' ). configure {
783752 dependsOn(jar, apiJar)
784753 finalizedBy(additionsModrinth, /* defenseModrinth,*/ generatorsModrinth, toolsModrinth)
754+ notCompatibleWithConfigurationCache(' Not yet compatible' )// TODO: Remove when possible
785755 }
786756
787757 modrinth {
@@ -829,6 +799,7 @@ def createSecondaryModrinthUpload(String output, String targetProjectId, TaskPro
829799 setGroup(' publishing' )
830800 setDescription(" Upload Mekanism ${ output} to Modrinth" )
831801 dependsOn(tasks. named(' modrinth' ), sourceSetJar)
802+ notCompatibleWithConfigurationCache(' Not yet compatible' )// TODO: Remove when possible
832803 doFirst {
833804 // Run in do first to change the configured extension values before it starts applying
834805 modrinth {
0 commit comments