diff --git a/build.gradle b/build.gradle index 7f294621..ff55b4df 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: ce57b88f4e61acd8b360c8e1777e707054d79b17 +//version: 1fc864ac9e3945981c864c3492bdd57330f9fe70 /* DO NOT CHANGE THIS FILE! @@ -8,6 +8,7 @@ Please check https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/build.gradl import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import java.util.concurrent.TimeUnit @@ -31,19 +32,19 @@ buildscript { } } dependencies { - classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.3' + classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.4' } } plugins { + id 'idea' + id 'scala' id("org.ajoberstar.grgit") version("3.1.1") id("com.github.johnrengelman.shadow") version("4.0.4") id("com.palantir.git-version") version("0.12.3") } -apply plugin: 'scala' apply plugin: 'forge' -apply plugin: 'idea' def projectJavaVersion = JavaLanguageVersion.of(8) @@ -224,11 +225,6 @@ dependencies { apply from: 'dependencies.gradle' -task relocateShadowJar(type: ConfigureShadowRelocation) { - target = tasks.shadowJar - prefix = modGroup + ".shadow" -} - def mixinConfigJson = "mixins." + modId + ".json" def mixingConfigRefMap = "mixins." + modId + ".refmap.json" def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap @@ -250,61 +246,24 @@ task generateAssets { } } +task relocateShadowJar(type: ConfigureShadowRelocation) { + target = tasks.shadowJar + prefix = modGroup + ".shadow" +} + shadowJar { - 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) + attributes(getManifestAttributes()) } - minimize() + minimize() // This will only allow shading for actually used classes configurations = [project.configurations.shadowImplementation] dependsOn(relocateShadowJar) } jar { - 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) + attributes(getManifestAttributes()) } if(usesShadowedDependencies.toBoolean()) { @@ -398,11 +357,7 @@ processResources } } -task sourcesJar(type: Jar) { - from (sourceSets.main.allJava) - from (file("$projectDir/LICENSE")) - getArchiveClassifier().set('sources') - +def getManifestAttributes() { def manifestAttributes = [:] if(containsMixinsAndOrCoreModOnly.toBoolean() == false) { manifestAttributes += ["FMLCorePluginContainsFMLMod": true] @@ -417,54 +372,55 @@ task sourcesJar(type: Jar) { } if(usesMixins.toBoolean()) { - from refMap manifestAttributes += [ "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", "MixinConfigs" : mixinConfigJson, "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false ] } + return manifestAttributes +} + +task sourcesJar(type: Jar) { + from (sourceSets.main.allJava) + from (file("$projectDir/LICENSE")) + getArchiveClassifier().set('sources') +} + +task shadowDevJar(type: ShadowJar) { + from sourceSets.main.output + getArchiveClassifier().set("dev") + manifest { - attributes(manifestAttributes) + attributes(getManifestAttributes()) } - if(usesShadowedDependencies.toBoolean()) { - dependsOn(shadowJar) - enabled = false - } + minimize() // This will only allow shading for actually used classes + configurations = [project.configurations.shadowImplementation] + //dependsOn(relocateShadowDevJar) +} + +task relocateShadowDevJar(type: ConfigureShadowRelocation) { + target = tasks.shadowDevJar //gradle.taskGraph.getAllTasks().find {it.name.equals("shadowDevJar") } // + prefix = modGroup + ".shadow" +} + +task feongweosn(type: Jar) { + dependsOn(relocateShadowDevJar) + dependsOn(shadowDevJar) + enabled = false } task devJar(type: Jar) { from sourceSets.main.output 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) + attributes(getManifestAttributes()) } if(usesShadowedDependencies.toBoolean()) { - dependsOn(shadowJar) + dependsOn(shadowDevJar) enabled = false } } @@ -487,7 +443,7 @@ task apiJar(type: Jar) { artifacts { archives sourcesJar - archives devJar + archives feongweosn if(apiPackage) { archives apiJar }