Skip to content

Commit

Permalink
Use shadow plugin to embed libs, because old approach just randomly b…
Browse files Browse the repository at this point in the history
…roke after not touching it for a while...
  • Loading branch information
fnuecke committed Apr 14, 2024
1 parent 210c45a commit e176945
Showing 1 changed file with 28 additions and 17 deletions.
45 changes: 28 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -35,11 +37,6 @@ group = 'li.cil.sedna'

java.toolchain.languageVersion = JavaLanguageVersion.of(17)

configurations {
embed
implementation.extendsFrom embed
}

repositories {
mavenCentral()
final def GithubPackages = [
Expand All @@ -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 {
Expand Down Expand Up @@ -115,13 +112,7 @@ minecraft {
}

jar {
finalizedBy 'reobfJar'

configurations.embed.each {
from(project.zipTree(it)) {
exclude 'META-INF', 'META-INF/**'
}
}
finalizedBy 'shadowJar'

manifest {
attributes([
Expand All @@ -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 {
Expand Down

0 comments on commit e176945

Please sign in to comment.