Compare commits

...
4 Commits
Author SHA1 Message Date
Jikoo d564773be6 Bump version to 5.1.9 for release 2025-02-14 11:33:31 -05:00
Adam e834e940e2 Convert to precompiled task (#289) 2025-02-14 01:02:24 -05:00
Jikoo cd73430bb2 Try to resolve remote cache issues
The weird part is that I don't have any of these problems locally. Remote is executing tasks in a really weird order, common adapter is building after Spigot adapter despite Spigot adapter depending on an output from it.
May just have to disable caching, but would like to avoid that if possible.
2025-02-13 12:19:03 -05:00
Jikoo 1c1dc9505b Bump version to 5.1.9-SNAPSHOT for development 2025-02-13 11:49:04 -05:00
6 changed files with 85 additions and 65 deletions

No files matched your search

+1 -1
View File
@@ -29,7 +29,7 @@ jobs:
- uses: gradle/actions/setup-gradle@v4
- name: Build with Gradle
run: ./gradlew build
run: ./gradlew clean build
# Upload artifacts
- name: Upload Distributable Jar
+60
View File
@@ -0,0 +1,60 @@
import org.gradle.api.file.RegularFile
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.bundling.Jar
import java.io.File
import java.nio.file.Path
import java.nio.file.Paths
abstract class ReobfTask: Jar() {
@get:Input
open val spigotVersion: Property<String> = objectFactory.property(String::class.java)
@get:InputFile
open val inputFile: Property<RegularFile> = objectFactory.fileProperty()
@get:Input
open val intermediaryClassifier: Property<String> = objectFactory.property(String::class.java).convention("mojang-mapped")
init {
archiveClassifier.convention("reobf")
}
@TaskAction
override fun copy() {
val spigotVer = spigotVersion.get()
val inFile = inputFile.get().asFile
val obfPath = inFile.resolveSibling(inFile.name.replace(".jar", "-${intermediaryClassifier.get()}.jar"))
// https://www.spigotmc.org/threads/510208/#post-4184317
val specialsource = project.configurations.named("spigotRemap").get().incoming.artifacts.artifacts
.first { it.id.componentIdentifier.toString() == "net.md-5:SpecialSource:1.11.4" }.file.path
val repo = Paths.get(project.repositories.mavenLocal().url)
val spigotDir = repo.resolve("org/spigotmc/spigot/$spigotVer/")
val mappingDir = repo.resolve("org/spigotmc/minecraft-server/$spigotVer/")
// Remap original Mojang-mapped jar to obfuscated intermediary
val mojangServer = spigotDir.resolve("spigot-$spigotVer-remapped-mojang.jar")
val mojangMappings = mappingDir.resolve("minecraft-server-$spigotVer-maps-mojang.txt")
remapPartial(specialsource, mojangServer, mojangMappings, inFile, obfPath, true)
// Remap obfuscated intermediary jar to Spigot and replace original
val obfServer = spigotDir.resolve("spigot-$spigotVer-remapped-obf.jar")
val spigotMappings = mappingDir.resolve("minecraft-server-$spigotVer-maps-spigot.csrg")
remapPartial(specialsource, obfServer, spigotMappings, obfPath, archiveFile.get().asFile, false)
}
private fun remapPartial(specialSource: String, serverJar: Path, mapping: Path, input: File, output: File, reverse: Boolean) {
project.providers.exec {
commandLine("java", "-cp", "$specialSource${File.pathSeparator}$serverJar",
"net.md_5.specialsource.SpecialSource", "--live",
"-i", input.path, "-o", output.path,
"-m", "$mapping",
if (reverse) "--reverse" else "")
}.result.get()
}
}
@@ -1,55 +0,0 @@
import java.nio.file.Path
import java.nio.file.Paths
val spigotRemap = configurations.create("spigotRemap")
repositories {
mavenCentral()
}
dependencies {
spigotRemap("net.md-5:SpecialSource:1.11.4:shaded")
}
abstract class RemapTask
@Inject constructor(private val project: Project): DefaultTask() {
@get:Input
abstract var spigotVersion: String
@TaskAction
fun remapInputs() {
inputs.files.forEach {
remap(spigotVersion, it.toPath(), it.toPath().resolveSibling(it.name.replace(".jar", "-obf.jar")))
}
}
private fun remap(spigotVersion: String, jarPath: Path, obfPath: Path) {
// https://www.spigotmc.org/threads/510208/#post-4184317
val specialsource = project.configurations.named("spigotRemap").get().incoming.artifacts.artifacts
.first { it.id.componentIdentifier.toString() == "net.md-5:SpecialSource:1.11.4" }.file.path
val repo = Paths.get(project.repositories.mavenLocal().url)
val spigotDir = repo.resolve("org/spigotmc/spigot/$spigotVersion/")
val mappingDir = repo.resolve("org/spigotmc/minecraft-server/$spigotVersion/")
// Remap original Mojang-mapped jar to obfuscated intermediary
val mojangServer = spigotDir.resolve("spigot-$spigotVersion-remapped-mojang.jar")
val mojangMappings = mappingDir.resolve("minecraft-server-$spigotVersion-maps-mojang.txt")
remapPartial(specialsource, mojangServer, mojangMappings, jarPath, obfPath, true)
// Remap obfuscated intermediary jar to Spigot and replace original
val obfServer = spigotDir.resolve("spigot-$spigotVersion-remapped-obf.jar")
val spigotMappings = mappingDir.resolve("minecraft-server-$spigotVersion-maps-spigot.csrg")
remapPartial(specialsource, obfServer, spigotMappings, obfPath, jarPath, false)
}
private fun remapPartial(specialSource: String, serverJar: Path, mapping: Path, input: Path, output: Path, reverse: Boolean) {
project.providers.exec {
commandLine("java", "-cp", "$specialSource${File.pathSeparator}$serverJar",
"net.md_5.specialsource.SpecialSource", "--live",
"-i", "$input", "-o", "$output",
"-m", "$mapping",
if (reverse) "--reverse" else "")
}.result.get()
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
# Project meta
group=com.lishid.openinv
version=5.1.8
version=5.1.9
description=A Bukkit plugin for opening normally-inaccessible inventories.
# Gradle configuration
+22 -6
View File
@@ -1,5 +1,4 @@
plugins {
`remap-spigot`
`openinv-base`
alias(libs.plugins.shadow)
}
@@ -9,6 +8,7 @@ repositories {
}
val spigotVer = "1.21.4-R0.1-SNAPSHOT"
rootProject.extra["spigotVersion"] = spigotVer
rootProject.extra["craftbukkitPackage"] = "v1_21_R3"
configurations.all {
@@ -25,7 +25,10 @@ configurations.all {
}
}
val spigotRemap = configurations.create("spigotRemap")
dependencies {
spigotRemap("net.md-5:SpecialSource:1.11.4:shaded")
compileOnly(libs.spigotapi)
compileOnly(create("org.spigotmc", "spigot", spigotVer, classifier = "remapped-mojang"))
@@ -40,11 +43,24 @@ tasks.shadowJar {
relocate("com.lishid.openinv.internal.common", "com.lishid.openinv.internal.reobf")
}
// TODO this appears to be a deprecated way to do things
// may want to just move all helper methods here.
tasks.register<Remap_spigot_gradle.RemapTask>("reobf") {
val reobfTask = tasks.register<ReobfTask>("reobfTask") {
notCompatibleWithConfigurationCache("gradle is hard")
dependsOn(tasks.shadowJar)
inputs.files(tasks.shadowJar.get().outputs.files.files)
spigotVersion = spigotVer
inputFile.value(tasks.shadowJar.get().archiveFile.get())
spigotVersion.value(spigotVer)
}
configurations {
consumable("reobf") {
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.LIBRARY))
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.EXTERNAL))
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR))
}
}
}
artifacts {
add("reobf", reobfTask)
}
+1 -2
View File
@@ -13,7 +13,7 @@ dependencies {
implementation(project(":openinvadaptercommon"))
implementation(project(":openinvadapterpaper1_21_3"))
implementation(project(":openinvadapterpaper1_21_1"))
implementation(project(":openinvadapterspigot", configuration = "shadow"))
implementation(project(":openinvadapterspigot", configuration = "reobf"))
implementation(libs.planarwrappers)
}
@@ -26,7 +26,6 @@ tasks.jar {
}
tasks.shadowJar {
dependsOn(":openinvadapterspigot:reobf")
minimize {
exclude(":openinv**")
}