mirror of
https://github.com/ViaVersion/ViaAprilFools.git
synced 2024-11-15 10:35:12 +01:00
155 lines
4.3 KiB
Groovy
155 lines
4.3 KiB
Groovy
plugins {
|
|
id "vaf.base-conventions"
|
|
|
|
id "io.papermc.hangar-publish-plugin" version "0.1.2"
|
|
id "com.modrinth.minotaur" version "2.+"
|
|
}
|
|
|
|
base {
|
|
archivesName = "ViaAprilFools"
|
|
}
|
|
|
|
configurations {
|
|
publishInclude
|
|
}
|
|
|
|
dependencies {
|
|
publishInclude project(":viaaprilfools-common")
|
|
publishInclude project(":viaaprilfools-bukkit")
|
|
publishInclude project(":viaaprilfools-fabric")
|
|
publishInclude project(":viaaprilfools-sponge")
|
|
publishInclude project(":viaaprilfools-velocity")
|
|
}
|
|
|
|
java {
|
|
withSourcesJar()
|
|
withJavadocJar()
|
|
}
|
|
|
|
jar {
|
|
dependsOn configurations.publishInclude
|
|
from {
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
configurations.publishInclude.collect {
|
|
zipTree(it)
|
|
}
|
|
} {
|
|
exclude "META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA"
|
|
}
|
|
manifest {
|
|
attributes(
|
|
"paperweight-mappings-namespace": "mojang"
|
|
)
|
|
}
|
|
from("LICENSE") {
|
|
rename { "${it}_${project.name ?: rootProject.name}" }
|
|
}
|
|
}
|
|
|
|
idea {
|
|
module {
|
|
["run"].each {
|
|
excludeDirs << file("$it")
|
|
}
|
|
}
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// 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 branch = branchName()
|
|
def baseVersion = project.maven_version
|
|
def isRelease = !baseVersion.contains('-')
|
|
if (!isRelease) { // Only publish releases from the main branch
|
|
def suffixedVersion = isRelease ? baseVersion : baseVersion + "+" + System.getenv("GITHUB_RUN_NUMBER")
|
|
def commitHash = latestCommitHash()
|
|
def changelogContent = "[${commitHash}](https://github.com/ViaVersion/ViaAprilFools/commit/${commitHash}) ${latestCommitMessage()}"
|
|
modrinth {
|
|
def mcVersions = project.mcVersions
|
|
.split(',')
|
|
.collect { it.trim() }
|
|
|
|
token.set(System.getenv("MODRINTH_TOKEN"))
|
|
projectId.set("viaaprilfools")
|
|
versionType.set(isRelease ? "release" : "beta")
|
|
versionNumber.set(suffixedVersion)
|
|
versionName.set(suffixedVersion)
|
|
changelog.set(changelogContent)
|
|
uploadFile.set(jar.archiveFile)
|
|
gameVersions.set(mcVersions)
|
|
loaders.add("fabric")
|
|
loaders.add("paper")
|
|
loaders.add("folia")
|
|
loaders.add("velocity")
|
|
autoAddDependsOn.set(false)
|
|
detectLoaders.set(false)
|
|
dependencies {
|
|
required.project("viaversion")
|
|
required.project("viabackwards")
|
|
optional.project("viafabric")
|
|
}
|
|
}
|
|
|
|
hangarPublish {
|
|
publications.register("plugin") {
|
|
version = suffixedVersion
|
|
id = "ViaAprilFools"
|
|
channel = isRelease ? "Release" : "Snapshot"
|
|
changelog = changelogContent
|
|
apiKey = System.getenv("HANGAR_TOKEN")
|
|
platforms {
|
|
PAPER {
|
|
jar = project.jar.archiveFile
|
|
platformVersions = [property('mcVersionRange') as String]
|
|
dependencies {
|
|
hangar("ViaVersion") {
|
|
required = true
|
|
}
|
|
hangar("ViaBackwards") {
|
|
required = true
|
|
}
|
|
}
|
|
}
|
|
VELOCITY {
|
|
jar = project.jar.archiveFile
|
|
platformVersions = [property("velocityVersion") as String]
|
|
dependencies {
|
|
hangar("ViaVersion") {
|
|
required = true
|
|
}
|
|
hangar("ViaBackwards") {
|
|
required = true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |