From ee8f651d723e142a25e7653b7b8667b99e968c98 Mon Sep 17 00:00:00 2001 From: Johann Bernhardt Date: Sun, 21 Nov 2021 19:14:36 +0100 Subject: [PATCH] Update build script to import fix for shadow in dev and sources artifacts --- build.gradle | 74 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 25 deletions(-) diff --git a/build.gradle b/build.gradle index 5a906de1..7f294621 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: c6baa89c674cfdf4789c3a5e8cb654153efb1b10 +//version: ce57b88f4e61acd8b360c8e1777e707054d79b17 /* DO NOT CHANGE THIS FILE! @@ -31,7 +31,7 @@ buildscript { } } dependencies { - classpath 'com.github.TheElan:ForgeGradle:1.2.2' + classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.3' } } @@ -45,9 +45,11 @@ apply plugin: 'scala' apply plugin: 'forge' apply plugin: 'idea' +def projectJavaVersion = JavaLanguageVersion.of(8) + java { toolchain { - languageVersion.set(JavaLanguageVersion.of(8)) + languageVersion.set(projectJavaVersion) } } @@ -186,6 +188,10 @@ configurations { } repositories { + maven { + name = "Overmind forge repo mirror" + url = "https://gregtech.overminddl1.com/" + } if(usesMixins.toBoolean()) { maven { name = "sponge" @@ -351,7 +357,7 @@ runClient { runServer { def arguments = [] - if(usesMixins.toBoolean()) { + if (usesMixins.toBoolean()) { arguments += [ "--mods=../build/libs/$modId-${version}.jar", "--tweakClass org.spongepowered.asm.launch.MixinTweaker" @@ -361,29 +367,37 @@ runServer { args(arguments) } -processResources -{ - // 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 version and mcversion - expand "minecraftVersion": project.minecraft.version, - "modVersion": versionDetails().lastTag, - "modId": modId, - "modName": modName - } - - // copy everything else, thats not the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } +tasks.withType(JavaExec).configureEach { + javaLauncher.set( + javaToolchains.launcherFor { + languageVersion = projectJavaVersion + } + ) } +processResources + { + // 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 version and mcversion + expand "minecraftVersion": project.minecraft.version, + "modVersion": versionDetails().lastTag, + "modId": modId, + "modName": modName + } + + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } + } + task sourcesJar(type: Jar) { from (sourceSets.main.allJava) from (file("$projectDir/LICENSE")) @@ -413,6 +427,11 @@ task sourcesJar(type: Jar) { manifest { attributes(manifestAttributes) } + + if(usesShadowedDependencies.toBoolean()) { + dependsOn(shadowJar) + enabled = false + } } task devJar(type: Jar) { @@ -443,6 +462,11 @@ task devJar(type: Jar) { manifest { attributes(manifestAttributes) } + + if(usesShadowedDependencies.toBoolean()) { + dependsOn(shadowJar) + enabled = false + } } task apiJar(type: Jar) {