Set up Shadow for bundling DFU

This commit is contained in:
Juuz
2023-11-01 01:18:19 +02:00
parent 74151c1171
commit 2bb8166744
2 changed files with 27 additions and 8 deletions

View File

@@ -11,6 +11,7 @@ plugins {
alias(libs.plugins.kotlin) apply false // Delay this so we can perform magic 🪄 first.
alias(libs.plugins.spotless)
alias(libs.plugins.retry)
alias(libs.plugins.shadow)
}
/**
@@ -91,6 +92,13 @@ configurations {
compileClasspath.extendsFrom bootstrap
runtimeClasspath.extendsFrom bootstrap
testRuntimeClasspath.extendsFrom bootstrap
bundled {
transitive = false
}
compileClasspath.extendsFrom bundled
runtimeClasspath.extendsFrom bundled
testCompileClasspath.extendsFrom bundled
testRuntimeClasspath.extendsFrom bundled
}
configurations.all {
@@ -187,7 +195,7 @@ dependencies {
implementation libs.mcinjector
implementation libs.opencsv
implementation libs.forge.diffpatch
implementation 'com.mojang:datafixerupper:6.0.8'
bundled libs.datafixerupper
// Forge mods.toml parsing
implementation libs.night.config.toml
@@ -223,6 +231,13 @@ jar {
from sourceSets.cfr.output.classesDirs
from sourceSets.fernflower.output.classesDirs
from sourceSets.vineflower.output.classesDirs
archiveClassifier = "slim"
}
shadowJar {
archiveClassifier = ""
configurations = [project.configurations.bundled]
relocate 'com.mojang', 'dev.architectury.loom.relocated.com.mojang'
}
base {
@@ -334,14 +349,14 @@ publishing {
publications {
if (isSnapshot) return
// Also publish a snapshot so people can use the latest version if they wish
snapshot(MavenPublication) { publication ->
groupId project.group
artifactId project.base.archivesName.get()
version baseVersion + '-SNAPSHOT'
// Also publish a snapshot so people can use the latest version if they wish
snapshot(MavenPublication) { publication ->
groupId project.group
artifactId project.base.archivesName.get()
version baseVersion + '-SNAPSHOT'
from components.java
}
shadow.component(publication)
}
// Manually crate the plugin marker for snapshot versions
snapshotPlugin(MavenPublication) {

View File

@@ -20,6 +20,7 @@ test-retry = "1.5.4"
checkstyle = "10.12.2"
codenarc = "3.3.0"
jacoco = "0.8.10"
shadow = "8.1.1"
# Forge libraries
forge-installer-tools = "1.2.0"
@@ -28,6 +29,7 @@ mcinjector = "3.8.0"
opencsv = "5.4"
forge-diffpatch = "2.0.7"
night-config = "3.6.6"
datafixerupper = "6.0.8"
[libraries]
# Loom compile libraries
@@ -60,11 +62,13 @@ mcinjector = { module = "de.oceanlabs.mcp:mcinjector", version.ref = "mcinjector
opencsv = { module = "com.opencsv:opencsv", version.ref = "opencsv" }
forge-diffpatch = { module = "net.minecraftforge:DiffPatch", version.ref = "forge-diffpatch" }
night-config-toml = { module = "com.electronwill.night-config:toml", version.ref = "night-config" }
datafixerupper = { module = "com.mojang:datafixerupper", version.ref = "datafixerupper" }
[plugins]
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
retry = { id = "org.gradle.test-retry", version.ref = "test-retry" }
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
[bundles]
asm = ["asm", "asm-analysis", "asm-commons", "asm-tree", "asm-util"]