From b8b82494444a178a92a3e21cba5b486be3a0c471 Mon Sep 17 00:00:00 2001 From: bombcar Date: Thu, 23 Dec 2021 11:52:57 -0600 Subject: [PATCH 1/2] fixbuild --- build.gradle | 78 +++++++++++++++++++++++++++++++---------------- gradle.properties | 2 +- gradlew | 0 3 files changed, 53 insertions(+), 27 deletions(-) mode change 100644 => 100755 gradlew diff --git a/build.gradle b/build.gradle index 2ec9a2e..43dfa37 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: be36e1399d5622c152db7c530c48e17cde0ce1bb +//version: 8fa7883b6196c1765266f4e6ddf3118d5043aafb /* DO NOT CHANGE THIS FILE! @@ -195,7 +195,9 @@ if(file("addon.gradle").exists()) { apply from: 'repositories.gradle' configurations { - implementation.extendsFrom(shadowImplementation) + implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored + implementation.extendsFrom(shadowCompile) + implementation.extendsFrom(shadeCompile) } repositories { @@ -261,16 +263,28 @@ task relocateShadowJar(type: ConfigureShadowRelocation) { } shadowJar { + project.configurations.shadeCompile.each { dep -> + from(project.zipTree(dep)) { + exclude 'META-INF', 'META-INF/**' + } + } + manifest { attributes(getManifestAttributes()) } minimize() // This will only allow shading for actually used classes - configurations = [project.configurations.shadowImplementation] + configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile] dependsOn(relocateShadowJar) } jar { + project.configurations.shadeCompile.each { dep -> + from(project.zipTree(dep)) { + exclude 'META-INF', 'META-INF/**' + } + } + manifest { attributes(getManifestAttributes()) } @@ -344,31 +358,31 @@ tasks.withType(JavaExec).configureEach { } processResources - { - // this will ensure that this task is redone when the versions change. - inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.version +{ + // this will ensure that this task is redone when the versions change. + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version - // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' - // replace version and mcversion - expand "minecraftVersion": project.minecraft.version, - "modVersion": versionDetails().lastTag, - "modId": modId, - "modName": modName - } + // replace version and mcversion + expand "minecraftVersion": project.minecraft.version, + "modVersion": versionDetails().lastTag, + "modId": modId, + "modName": modName + } - if(usesMixins.toBoolean()) { - from refMap - } + if(usesMixins.toBoolean()) { + from refMap + } - // copy everything else, thats not the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } - } + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } +} def getManifestAttributes() { def manifestAttributes = [:] @@ -401,6 +415,12 @@ task sourcesJar(type: Jar) { } task shadowDevJar(type: ShadowJar) { + project.configurations.shadeCompile.each { dep -> + from(project.zipTree(dep)) { + exclude 'META-INF', 'META-INF/**' + } + } + from sourceSets.main.output getArchiveClassifier().set("dev") @@ -409,7 +429,7 @@ task shadowDevJar(type: ShadowJar) { } minimize() // This will only allow shading for actually used classes - configurations = [project.configurations.shadowImplementation] + configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile] } task relocateShadowDevJar(type: ConfigureShadowRelocation) { @@ -424,6 +444,12 @@ task circularResolverJar(type: Jar) { } task devJar(type: Jar) { + project.configurations.shadeCompile.each { dep -> + from(project.zipTree(dep)) { + exclude 'META-INF', 'META-INF/**' + } + } + from sourceSets.main.output getArchiveClassifier().set("dev") @@ -469,7 +495,7 @@ publishing { artifact source: sourcesJar, classifier: "src" artifact source: devJar, classifier: "dev" if (apiPackage) { - archives source: apiJar, classifier: "api" + artifact source: apiJar, classifier: "api" } groupId = System.getenv("ARTIFACT_GROUP_ID") ?: group diff --git a/gradle.properties b/gradle.properties index 312ac95..f52636a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,7 +19,7 @@ forgeVersion = 10.13.4.1614 # restart Minecraft in development. Choose this dependent on your mod: # Do you need consistent player progressing (for example Thaumcraft)? -> Select a name # Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty -developmentEnvironmentUserName = "Developer" +developmentEnvironmentUserName = Developer # Define a source file of your project with: # public static final String VERSION = "GRADLETOKEN_VERSION"; diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 From f0243fb3096ab32832e55a82b3ae7670738650bf Mon Sep 17 00:00:00 2001 From: bombcar Date: Thu, 23 Dec 2021 11:55:42 -0600 Subject: [PATCH 2/2] add version info --- gradle.properties | 4 ++-- src/main/java/fox/spiteful/forbidden/Forbidden.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index f52636a..124644d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -26,10 +26,10 @@ developmentEnvironmentUserName = Developer # The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's # version in @Mod([...], version = VERSION, [...]) # Leave these properties empty to skip individual token replacements -replaceGradleTokenInFile = +replaceGradleTokenInFile = Forbidden.java gradleTokenModId = gradleTokenModName = -gradleTokenVersion = +gradleTokenVersion = GRADLETOKEN_VERSION gradleTokenGroupName = # In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can diff --git a/src/main/java/fox/spiteful/forbidden/Forbidden.java b/src/main/java/fox/spiteful/forbidden/Forbidden.java index 352aa9e..556cede 100644 --- a/src/main/java/fox/spiteful/forbidden/Forbidden.java +++ b/src/main/java/fox/spiteful/forbidden/Forbidden.java @@ -25,7 +25,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent; import java.util.Collection; -@Mod(modid = "ForbiddenMagic", name = "Forbidden Magic", dependencies = "required-after:Thaumcraft@[4.2.2.0,);after:ThaumicTinkerer;after:AWWayofTime;after:Botania") +@Mod(modid = "ForbiddenMagic", name = "Forbidden Magic", version = "GRADLETOKEN_VERSION", dependencies = "required-after:Thaumcraft@[4.2.2.0,);after:ThaumicTinkerer;after:AWWayofTime;after:Botania") public class Forbidden { @Instance("ForbiddenMagic") public static Forbidden instance;