From e17694533e0826183795a34bfe87c6fc76cdc748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Sun, 14 Apr 2024 12:29:47 +0200 Subject: [PATCH] Use shadow plugin to embed libs, because old approach just randomly broke after not touching it for a while... --- build.gradle | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/build.gradle b/build.gradle index 69b5105..de4392e 100644 --- a/build.gradle +++ b/build.gradle @@ -4,14 +4,16 @@ buildscript { mavenCentral() } dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '6+', changing: true } } plugins { + id 'java' id 'idea' id 'maven-publish' id 'com.matthewprenger.cursegradle' version '1.4.0' + id 'com.github.johnrengelman.shadow' version '8.1.1' } apply plugin: 'net.minecraftforge.gradle' @@ -35,11 +37,6 @@ group = 'li.cil.sedna' java.toolchain.languageVersion = JavaLanguageVersion.of(17) -configurations { - embed - implementation.extendsFrom embed -} - repositories { mavenCentral() final def GithubPackages = [ @@ -62,9 +59,9 @@ repositories { dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" - embed('li.cil.ceres:ceres:0.0.4') { transitive = false } - embed('li.cil.sedna:sedna:2.0.8') { transitive = false } - embed('li.cil.sedna:sedna-buildroot:0.0.8') { transitive = false } + implementation('li.cil.ceres:ceres:0.0.4') { transitive = false } + implementation('li.cil.sedna:sedna:2.0.8') { transitive = false } + implementation('li.cil.sedna:sedna-buildroot:0.0.8') { transitive = false } } minecraft { @@ -115,13 +112,7 @@ minecraft { } jar { - finalizedBy 'reobfJar' - - configurations.embed.each { - from(project.zipTree(it)) { - exclude 'META-INF', 'META-INF/**' - } - } + finalizedBy 'shadowJar' manifest { attributes([ @@ -136,13 +127,33 @@ jar { } } +shadowJar { + finalizedBy 'reobfJar' + + dependencies { + include(dependency('li.cil.ceres:ceres:.*')) + include(dependency('li.cil.sedna:sedna:.*')) + include(dependency('li.cil.sedna:sedna-buildroot:.*')) + } + + archiveClassifier.set('') +} + +reobf { + shadowJar {} +} + +artifacts { + archives shadowJar +} + publishing { publications { mavenJava(MavenPublication) { groupId = project.group artifactId = project.name version = semver - artifact jar + artifact shadowJar } } repositories {