@@ -176,12 +176,15 @@ fancyGradle {
176176 }
177177}
178178
179+ processJarTask jar
180+
179181if (project. build_deobfJar. toBoolean()) {
180182 // Create deobf dev jars
181183 tasks. register(' deobfJar' , Jar ) {
182184 archiveClassifier. set ' deobf'
183185 from sourceSets. main. output
184186 }
187+ processJarTask deobfJar
185188}
186189
187190if (project. build_apiJar. toBoolean()) {
@@ -235,33 +238,6 @@ sourceSets {
235238 main. output. setResourcesDir(main. java. classesDirectory)
236239}
237240
238- jar {
239- manifest {
240- // noinspection GroovyAssignabilityCheck
241- def attribute_map = [:]
242- if (project. use_coremod. toBoolean()) {
243- attribute_map[' FMLCorePlugin' ] = project. coremod_plugin_class_name
244- if (project. include_mod. toBoolean()) {
245- attribute_map[' FMLCorePluginContainsFMLMod' ] = true
246- attribute_map[' ForceLoadAsMod' ] = project. gradle. startParameter. taskNames[0 ] == ' build'
247- }
248- }
249- if (project. use_mixins. toBoolean()) {
250- attribute_map[' TweakClass' ] = ' org.spongepowered.asm.launch.MixinTweaker'
251- }
252- if (project. has_access_transformer. toBoolean()) {
253- attribute_map[' FMLAT' ] = ' gregtech_at.cfg'
254- }
255- attributes(attribute_map)
256- }
257-
258- // exclude all files in src/api from being shipped in the jar
259- // this prevents crashes in obfuscated environments
260- file(' src/api/' ). eachDirRecurse { dir ->
261- exclude dir. name
262- }
263- }
264-
265241artifacts {
266242 if (project. build_deobfJar. toBoolean()) {
267243 archives deobfJar
@@ -313,6 +289,42 @@ test {
313289 useJUnitPlatform()
314290}
315291
292+ /**
293+ * Applies required processing to jar tasks
294+ * @param task the task to process
295+ */
296+ private void processJarTask (task ) {
297+ task. configure {
298+ manifest {
299+ // noinspection GroovyAssignabilityCheck
300+ def attribute_map = [:]
301+ if (project. use_coremod. toBoolean()) {
302+ attribute_map[' FMLCorePlugin' ] = project. coremod_plugin_class_name
303+ if (project. include_mod. toBoolean()) {
304+ attribute_map[' FMLCorePluginContainsFMLMod' ] = true
305+ attribute_map[' ForceLoadAsMod' ] = project. gradle. startParameter. taskNames[0 ] == ' build'
306+ }
307+ }
308+ if (project. use_mixins. toBoolean()) {
309+ attribute_map[' TweakClass' ] = ' org.spongepowered.asm.launch.MixinTweaker'
310+ }
311+ if (project. has_access_transformer. toBoolean()) {
312+ attribute_map[' FMLAT' ] = ' gregtech_at.cfg'
313+ }
314+ attributes(attribute_map)
315+ }
316+
317+ // exclude all files in src/api from being shipped in the jar
318+ // this prevents crashes in obfuscated environments
319+ file(' src/api/' ). eachDirRecurse { dir ->
320+ exclude dir. name
321+ }
322+ }
323+ }
324+
325+ /**
326+ * @return the current project version, parsed from the version file
327+ */
316328@SuppressWarnings (' GroovyAssignabilityCheck' )
317329private String getVersionFromJava () {
318330 def major = ' 0'
0 commit comments