Update build files

This commit is contained in:
FlorianMichael committed 2025-06-27 14:52:56 +02:00
1 parent c98f0f8970
commit b6f89c9893
6 files changed
+102 -126

No files matched your search

-119
View File
@@ -1,119 +0,0 @@
plugins {
id "java-library"
id "maven-publish"
id "io.papermc.hangar-publish-plugin" version "0.1.2"
}
repositories {
maven {
url = uri("https://repo.viaversion.com")
}
maven {
url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
}
maven {
url = uri("https://repo.maven.apache.org/maven2/")
}
}
base {
version = project.maven_version
group = project.maven_group
}
dependencies {
compileOnly "com.viaversion:viaversion-api:4.10.0"
compileOnly "org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT"
}
java.sourceCompatibility = JavaVersion.VERSION_1_8
processResources {
inputs.property "version", project.version
filesMatching("plugin.yml") {
expand "version": project.version
}
}
java {
withSourcesJar()
}
publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
tasks.withType(Javadoc) {
options.encoding = "UTF-8"
}
// -----------------------------------------------------
// Publishing
def latestCommitHash() {
def byteOut = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = byteOut
}
return byteOut.toString('UTF-8').trim()
}
def latestCommitMessage() {
def byteOut = new ByteArrayOutputStream()
exec {
commandLine 'git', 'log', '-1', '--pretty=%B'
standardOutput = byteOut
}
return byteOut.toString('UTF-8').trim()
}
def branchName() {
def byteOut = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--abbrev-ref', 'HEAD'
standardOutput = byteOut
}
return byteOut.toString('UTF-8').trim()
}
def baseVersion = project.maven_version
def isRelease = !baseVersion.contains('-')
def suffixedVersion = isRelease ? baseVersion : baseVersion + "+" + System.getenv("GITHUB_RUN_NUMBER")
def commitHash = latestCommitHash()
def changelogContent = "[${commitHash}](https://github.com/ViaVersion/iaRewind-Legacy-Support/commit/${commitHash}) ${latestCommitMessage()}"
def branch = branchName()
def isMainBranch = branch == "master"
hangarPublish {
publications.register("plugin") {
version.set(suffixedVersion)
id.set("ViaRewindLegacySupport")
channel.set(isRelease ? "Release" : isMainBranch ? "Snapshot" : "Alpha")
changelog.set(changelogContent)
apiKey.set(System.getenv("HANGAR_TOKEN"))
platforms {
PAPER {
jar.set(tasks.jar.archiveFile)
platformVersions.set([property('mcVersionRange') as String])
dependencies.hangar("ViaVersion") {
required.set(true)
}
dependencies.hangar("ViaBackwards") {
required.set(false)
}
dependencies.hangar("ViaRewind") {
required.set(false)
}
}
}
}
}
+70
View File
@@ -0,0 +1,70 @@
import de.florianmichael.baseproject.*
plugins {
`java-library`
id("io.papermc.hangar-publish-plugin")
id("de.florianmichael.baseproject.BaseProject")
}
repositories {
maven("https://repo.viaversion.com")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven("https://repo.maven.apache.org/maven2/")
}
setupProject()
setupViaPublishing()
dependencies {
compileOnly("com.viaversion:viaversion-api:4.10.0")
compileOnly("org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT")
}
base {
archivesName.set("ViaRewind-Legacy-Support")
}
tasks {
processResources {
val projectVersion = project.version
val projectDescription = project.description
filesMatching("plugin.yml") {
expand("version" to projectVersion, "description" to projectDescription)
}
}
}
val branch = branchName()
val baseVersion = version as String
val isRelease = !baseVersion.contains('-')
val suffixedVersion = if (isRelease) baseVersion else baseVersion + "+" + System.getenv("GITHUB_RUN_NUMBER")
val commitHash = latestCommitHash()
val changelogContent = "[${commitHash}](https://github.com/ViaVersion/iaRewind-Legacy-Support/commit/${commitHash}) ${latestCommitMessage()}"
val isMainBranch = branch == "master"
hangarPublish {
publications.register("plugin") {
version.set(suffixedVersion)
id.set("ViaRewindLegacySupport")
channel.set(if (isRelease) "Release" else if (isMainBranch) "Snapshot" else "Alpha")
changelog.set(changelogContent)
apiKey.set(System.getenv("HANGAR_TOKEN"))
platforms {
paper {
jar.set(tasks.jar.flatMap { it.archiveFile })
platformVersions.set(listOf(property("minecraft_version_range") as String))
dependencies.hangar("ViaVersion") {
required.set(true)
}
dependencies.hangar("ViaBackwards") {
required.set(false)
}
dependencies.hangar("ViaRewind") {
required.set(false)
}
}
}
}
}
tasks.named("publishPluginPublicationToHangar") {
notCompatibleWithConfigurationCache("")
}
+14 -6
View File
@@ -1,10 +1,18 @@
# gradle
# Gradle Properties
org.gradle.jvmargs=-Xmx8G
org.gradle.parallel=true
org.gradle.configuration-cache=true
# project
maven_group=com.viaversion
maven_version=1.5.3-SNAPSHOT
# Project Details
project_jvm_version=8
# Smile emoji
mcVersionRange=1.8-1.21.6
project_group=com.viaversion
project_version=1.5.3-SNAPSHOT
project_description=Provides additional features for ViaRewind for Paper servers.
publishing_dev_id=FlorianMichael
publishing_dev_name=EnZaXD
publishing_dev_mail=florian.michael07@gmail.com
# Hangar Publishing
minecraft_version_range=1.8-1.21.6
-1
View File
@@ -1 +0,0 @@
rootProject.name = "ViaRewind-Legacy-Support"
+17
View File
@@ -0,0 +1,17 @@
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
plugins {
id("de.florianmichael.baseproject.BaseProject") version "1.1.1"
id("io.papermc.hangar-publish-plugin") version "0.1.3"
}
}
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
}
rootProject.name = "viarewind-legacy-support"
+1
View File
@@ -1,5 +1,6 @@
name: ViaRewind-Legacy-Support
version: ${version}
description: ${description}
main: com.viaversion.viarewind.legacysupport.BukkitPlugin
api-version: 1.13