Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion surf-api-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {

group = groupId
version = buildString {
append("2.1.1")
append("2.1.2")
if (snapshot) append("-SNAPSHOT")
}

Expand Down Expand Up @@ -86,6 +86,12 @@ gradlePlugin {
id = "dev.slne.surf.api.gradle.minestom"
implementationClass = "dev.slne.surf.api.gradle.platform.minestom.MinestomSurfPlugin"
}

create("minestom-relocations") {
id = "dev.slne.surf.api.gradle.minestom-relocations"
implementationClass =
"dev.slne.surf.api.gradle.platform.minestom.MinestomRelocationsPlugin"
}
}

publishing {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package dev.slne.surf.api.gradle.platform.minestom

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import dev.slne.surf.api.gradle.generated.Constants
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.withType

/**
* Applies the Minestom runtime relocations to an existing Shadow JAR without configuring a
* complete Surf/Kotlin project. This is intended for final application assemblers that merge
* multiple Surf Minestom plugins into one executable JAR.
*/
internal class MinestomRelocationsPlugin : Plugin<Project> {
override fun apply(target: Project) = with(target) {
pluginManager.withPlugin("com.gradleup.shadow") {
tasks.withType<ShadowJar>().configureEach {
val prefix = Constants.RELOCATION_PREFIX

Comment on lines +16 to +19
relocate("org.spongepowered.configurate", "$prefix.configurate")
relocate("com.mojang.serialization", "$prefix.mojang.serialization")
relocate("com.mojang.datafixers", "$prefix.mojang.datafixers")
relocate("net.kyori.adventure.nbt", "$prefix.kyori.nbt") {
exclude("net.kyori.adventure.nbt.api.**")
}
relocate("it.unimi.dsi.fastutil", "$prefix.fastutil")
}
}
}
}