ViaRewind-Legacy-Support/build.gradle

121 lines
3.0 KiB
Groovy
Raw Permalink Normal View History

2023-09-22 13:59:37 +02:00
plugins {
id "java-library"
id "maven-publish"
2024-03-23 12:34:42 +01:00
id "io.papermc.hangar-publish-plugin" version "0.1.2"
2023-09-22 13:59:37 +02:00
}
repositories {
mavenLocal()
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/")
}
}
version = project.maven_version
group = project.maven_group
2023-09-22 13:59:37 +02:00
dependencies {
2024-04-26 15:39:58 +02:00
compileOnly "com.viaversion:viaversion-api:4.10.0"
2023-09-22 13:59:37 +02:00
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()
}
2023-09-22 13:59:37 +02:00
publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
tasks.withType(Javadoc) {
options.encoding = "UTF-8"
}
2023-09-25 16:43:07 +02:00
// -----------------------------------------------------
// 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()
}
2024-03-06 14:20:33 +01:00
def branchName() {
def byteOut = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--abbrev-ref', 'HEAD'
standardOutput = byteOut
}
return byteOut.toString('UTF-8').trim()
}
2023-09-25 16:43:07 +02:00
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()}"
2024-03-06 14:20:33 +01:00
def branch = branchName()
def isMainBranch = branch == "master"
2023-09-25 16:43:07 +02:00
hangarPublish {
publications.register("plugin") {
version.set(suffixedVersion)
id.set("ViaRewindLegacySupport")
2024-03-06 14:20:33 +01:00
channel.set(isRelease ? "Release" : isMainBranch ? "Snapshot" : "Alpha")
2023-09-25 16:43:07 +02:00
changelog.set(changelogContent)
apiKey.set(System.getenv("HANGAR_TOKEN"))
platforms {
2024-04-02 12:14:29 +02:00
PAPER {
2023-09-25 16:43:07 +02:00
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)
}
}
}
}
}