From f3b43b3132da334acfe7a8efb5174c87ca2449a5 Mon Sep 17 00:00:00 2001 From: Johann Bernhardt Date: Sun, 7 Nov 2021 11:19:38 +0100 Subject: [PATCH] Provide manifest for dev and sources jar --- build.gradle | 77 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 61 insertions(+), 16 deletions(-) diff --git a/build.gradle b/build.gradle index 80a6cc3..46f5232 100644 --- a/build.gradle +++ b/build.gradle @@ -165,13 +165,11 @@ shadowJar { if(usesMixins.toBoolean()) { from refMap - manifest { - manifestAttributes += [ - "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", - "MixinConfigs" : mixinConfigJson, - "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false - ] - } + manifestAttributes += [ + "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", + "MixinConfigs" : mixinConfigJson, + "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false + ] } manifest { attributes(manifestAttributes) @@ -198,13 +196,11 @@ jar { if(usesMixins.toBoolean()) { from refMap - manifest { - manifestAttributes += [ - "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", - "MixinConfigs" : mixinConfigJson, - "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false - ] - } + manifestAttributes += [ + "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", + "MixinConfigs" : mixinConfigJson, + "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false + ] } manifest { attributes(manifestAttributes) @@ -296,13 +292,62 @@ processResources task sourcesJar(type: Jar) { from (sourceSets.main.allJava) from (file("$projectDir/LICENSE")) - getArchiveClassifier().set('sources') + + def manifestAttributes = [:] + if(containsMixinsAndOrCoreModOnly.toBoolean() == false) { + manifestAttributes += ["FMLCorePluginContainsFMLMod": true] + } + + if(accessTransformersFile) { + manifestAttributes += ["FMLAT" : accessTransformersFile.toString()] + } + + if(coreModClass) { + manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass] + } + + if(usesMixins.toBoolean()) { + from refMap + manifestAttributes += [ + "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", + "MixinConfigs" : mixinConfigJson, + "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false + ] + } + manifest { + attributes(manifestAttributes) + } } task devJar(type: Jar) { from sourceSets.main.output - archiveClassifier.set("dev") + getArchiveClassifier().set("dev") + + def manifestAttributes = [:] + if(containsMixinsAndOrCoreModOnly.toBoolean() == false) { + manifestAttributes += ["FMLCorePluginContainsFMLMod": true] + } + + if(accessTransformersFile) { + manifestAttributes += ["FMLAT" : accessTransformersFile.toString()] + } + + if(coreModClass) { + manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass] + } + + if(usesMixins.toBoolean()) { + from refMap + manifestAttributes += [ + "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", + "MixinConfigs" : mixinConfigJson, + "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false + ] + } + manifest { + attributes(manifestAttributes) + } } task apiJar(type: Jar) {