mirror of
https://github.com/GeyserMC/Floodgate.git
synced 2025-12-19 14:59:20 +00:00
Merge remote-tracking branch 'origin/dev/2.1.1' into feature/cumulus-1.1
# Conflicts: # build-logic/src/main/kotlin/Versions.kt
This commit is contained in:
@@ -26,15 +26,15 @@
|
||||
object Versions {
|
||||
const val geyserVersion = "2.0.1-cumulus-SNAPSHOT"
|
||||
const val cumulusVersion = "1.1-SNAPSHOT"
|
||||
const val spigotVersion = "1.13-R0.1-SNAPSHOT"
|
||||
const val configUtilsVersion = "1.0-SNAPSHOT"
|
||||
const valspigotVersion = "1.13-R0.1-SNAPSHOT"
|
||||
const val fastutilVersion = "8.5.3"
|
||||
const val lombokVersion = "1.18.20"
|
||||
const val guiceVersion = "5.0.1"
|
||||
const val nettyVersion = "4.1.49.Final"
|
||||
const val snakeyamlVersion = "1.28"
|
||||
const val cloudVersion = "1.5.0"
|
||||
const val adventureApiVersion = "4.9.1"
|
||||
const val adventurePlatformVersion = "4.0.0"
|
||||
const val bstatsVersion = "3.0.0"
|
||||
|
||||
const val javaWebsocketVersion = "1.5.2"
|
||||
|
||||
|
||||
@@ -23,30 +23,37 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import net.kyori.indra.git.IndraGitExtension
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.ProjectDependency
|
||||
import org.gradle.kotlin.dsl.named
|
||||
import org.gradle.kotlin.dsl.the
|
||||
|
||||
fun Project.isSnapshot(): Boolean =
|
||||
version.toString().endsWith("-SNAPSHOT")
|
||||
|
||||
fun Project.fullVersion(): String {
|
||||
var version = version.toString()
|
||||
if (version.endsWith("-SNAPSHOT")) {
|
||||
version += " (b${buildNumberAsString()}-${lastCommitHash()})"
|
||||
}
|
||||
return version
|
||||
}
|
||||
|
||||
fun Project.lastCommitHash(): String? =
|
||||
the<IndraGitExtension>().commit()?.name?.substring(0, 7)
|
||||
|
||||
// retrieved from https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project
|
||||
// some properties might be specific to Jenkins
|
||||
fun Project.branchName(): String =
|
||||
System.getProperty("GIT_BRANCH", "local/dev")
|
||||
System.getenv("GIT_BRANCH") ?: "local/dev"
|
||||
fun Project.buildNumber(): Int =
|
||||
Integer.parseInt(System.getProperty("BUILD_NUMBER", "-1"))
|
||||
Integer.parseInt(System.getenv("BUILD_NUMBER") ?: "-1")
|
||||
|
||||
fun Project.relocate(pattern: String) {
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
relocate(pattern, "org.geysermc.floodgate.shaded.$pattern")
|
||||
}
|
||||
}
|
||||
fun Project.buildNumberAsString(): String =
|
||||
buildNumber().takeIf { it != -1 }?.toString() ?: "??"
|
||||
|
||||
val providedDependencies = mutableMapOf<String, MutableSet<String>>()
|
||||
val relocatedPackages = mutableMapOf<String, MutableSet<String>>()
|
||||
|
||||
fun Project.provided(pattern: String, name: String, version: String, excludedOn: Int = 0b110) {
|
||||
providedDependencies.getOrPut(project.name) { mutableSetOf() }
|
||||
@@ -59,5 +66,10 @@ fun Project.provided(pattern: String, name: String, version: String, excludedOn:
|
||||
fun Project.provided(dependency: ProjectDependency) =
|
||||
provided(dependency.group!!, dependency.name, dependency.version!!)
|
||||
|
||||
|
||||
fun Project.relocate(pattern: String) =
|
||||
relocatedPackages.getOrPut(project.name) { mutableSetOf() }
|
||||
.add(pattern)
|
||||
|
||||
private fun calcExclusion(section: String, bit: Int, excludedOn: Int): String =
|
||||
if (excludedOn and bit > 0) section else ""
|
||||
@@ -2,6 +2,7 @@ plugins {
|
||||
`java-library`
|
||||
`maven-publish`
|
||||
// id("net.ltgt.errorprone")
|
||||
id("net.kyori.indra.git")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -14,7 +15,7 @@ tasks {
|
||||
expand(
|
||||
"id" to "floodgate",
|
||||
"name" to "floodgate",
|
||||
"version" to project.version,
|
||||
"version" to fullVersion(),
|
||||
"description" to project.description,
|
||||
"url" to "https://geysermc.org",
|
||||
"author" to "GeyserMC"
|
||||
@@ -31,12 +32,4 @@ java {
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications.create<MavenPublication>("mavenJava") {
|
||||
groupId = project.group as String
|
||||
artifactId = "floodgate-" + project.name
|
||||
version = project.version as String
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
plugins {
|
||||
id("floodgate.shadow-conventions")
|
||||
id("com.jfrog.artifactory")
|
||||
id("maven-publish")
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("mavenJava") {
|
||||
groupId = project.group as String
|
||||
artifactId = project.name
|
||||
version = project.version as String
|
||||
|
||||
artifact(tasks["shadowJar"])
|
||||
artifact(tasks["sourcesJar"])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
artifactory {
|
||||
setContextUrl("https://repo.opencollab.dev/artifactory")
|
||||
publish {
|
||||
repository {
|
||||
setRepoKey(if (isSnapshot()) "maven-snapshots" else "maven-releases")
|
||||
setMavenCompatible(true)
|
||||
}
|
||||
defaults {
|
||||
publications("mavenJava")
|
||||
setPublishArtifacts(true)
|
||||
setPublishPom(true)
|
||||
setPublishIvy(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
plugins {
|
||||
id("floodgate.base-conventions")
|
||||
id("com.github.johnrengelman.shadow")
|
||||
id("com.jfrog.artifactory")
|
||||
}
|
||||
|
||||
tasks {
|
||||
@@ -25,6 +24,12 @@ tasks {
|
||||
exclude(dependency(string))
|
||||
}
|
||||
}
|
||||
|
||||
// relocations made in included project dependencies are for whatever reason not
|
||||
// forwarded to the project implementing the dependency.
|
||||
// (e.g. a relocation in `core` will relocate for core. But when you include `core` in
|
||||
// for example Velocity, the relocation will be gone for Velocity)
|
||||
addRelocations(project, sJar)
|
||||
}
|
||||
}
|
||||
named("build") {
|
||||
@@ -32,24 +37,18 @@ tasks {
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications.named<MavenPublication>("mavenJava") {
|
||||
artifact(tasks["shadowJar"])
|
||||
artifact(tasks["sourcesJar"])
|
||||
fun addRelocations(project: Project, shadowJar: ShadowJar) {
|
||||
callAddRelocations(project.configurations.api.get(), shadowJar)
|
||||
callAddRelocations(project.configurations.implementation.get(), shadowJar)
|
||||
|
||||
relocatedPackages[project.name]?.forEach { pattern ->
|
||||
println("Relocating $pattern for ${shadowJar.project.name}")
|
||||
shadowJar.relocate(pattern, "org.geysermc.floodgate.shadow.$pattern")
|
||||
}
|
||||
}
|
||||
|
||||
artifactory {
|
||||
publish {
|
||||
repository {
|
||||
setRepoKey("maven-snapshots")
|
||||
setMavenCompatible(true)
|
||||
}
|
||||
defaults {
|
||||
publishConfigs("archives")
|
||||
setPublishArtifacts(true)
|
||||
setPublishPom(true)
|
||||
setPublishIvy(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
fun callAddRelocations(configuration: Configuration, shadowJar: ShadowJar) =
|
||||
configuration.dependencies.forEach {
|
||||
if (it is ProjectDependency)
|
||||
addRelocations(it.dependencyProject, shadowJar)
|
||||
}
|
||||
Reference in New Issue
Block a user