1
0
mirror of https://github.com/GeyserMC/Floodgate.git synced 2025-12-19 14:59:20 +00:00

Another attempt to make publishing work

This commit is contained in:
Tim203
2021-12-10 23:32:49 +01:00
parent 7f95e95227
commit 919332f3af
13 changed files with 112 additions and 53 deletions

View File

@@ -1,7 +1,12 @@
plugins {
`kotlin-dsl`
java
}
repositories {
gradlePluginPortal()
}
dependencies {
implementation("gradle.plugin.com.github.jengelman.gradle.plugins", "shadow", "7.0.0")
}

View File

@@ -0,0 +1,38 @@
plugins {
`java-library`
`maven-publish`
// id("net.ltgt.errorprone")
}
tasks {
processResources {
filesMatching(listOf("plugin.yml", "bungee.yml", "velocity-plugin.json")) {
expand(
"id" to "floodgate",
"name" to "floodgate",
"version" to project.version,
"description" to project.description,
"url" to "https://geysermc.org",
"author" to "GeyserMC"
)
}
}
compileJava {
options.encoding = Charsets.UTF_8.name()
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withSourcesJar()
}
publishing {
publications.create<MavenPublication>("mavenJava") {
groupId = rootProject.group as String
artifactId = project.name
version = rootProject.version as String
}
}

View File

@@ -0,0 +1,33 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id("floodgate.base-conventions")
id("com.github.johnrengelman.shadow")
}
tasks {
named<Jar>("jar") {
archiveClassifier.set("unshaded")
from(project.rootProject.file("LICENSE"))
}
val shadowJar = named<ShadowJar>("shadowJar") {
archiveBaseName.set("floodgate-${project.name}")
archiveVersion.set("")
archiveClassifier.set("")
configureRelocations()
}
named("build") {
dependsOn(shadowJar)
}
}
fun ShadowJar.configureRelocations() {
//todo platform-independent relocations
}
publishing {
publications.named<MavenPublication>("mavenJava") {
artifact(tasks["shadowJar"])
artifact(tasks["sourcesJar"])
}
}

View File

@@ -0,0 +1,9 @@
plugins {
id("floodgate.base-conventions")
}
publishing {
publications.named<MavenPublication>("mavenJava") {
from(components["java"])
}
}

View File

@@ -1,27 +1,24 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
`java-library`
`maven-publish`
id("floodgate.build-logic") apply false
// id("com.github.spotbugs") version "4.8.0" apply false
// id("net.kyori.indra")
// id("net.kyori.indra.checkstyle")
// id("net.kyori.indra.license-header")
id("com.github.johnrengelman.shadow") version "7.1.0" apply false
id("io.freefair.lombok") version "6.3.0" apply false
}
val platforms = setOf(
projects.bungee,
projects.spigot,
projects.velocity
).map { it.dependencyProject }
val api: Project = projects.api.dependencyProject
subprojects {
// apply(plugin = "pmd")
// apply(plugin = "com.github.spotbugs")
apply {
plugin("java-library")
plugin("maven-publish")
plugin("com.github.johnrengelman.shadow")
plugin("io.freefair.lombok")
plugin("floodgate.build-logic")
}
@@ -33,35 +30,13 @@ subprojects {
}
version = "2.1.1-SNAPSHOT"
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
when (this) {
in platforms -> plugins.apply("floodgate.shadow-conventions")
api -> plugins.apply("floodgate.base-conventions")
else -> plugins.apply("floodgate.standard-conventions")
}
dependencies {
compileOnly("org.checkerframework", "checker-qual", Versions.checkerQual)
}
tasks {
val shadowJar = named<ShadowJar>("shadowJar") {
archiveBaseName.set("floodgate-${project.name}")
archiveVersion.set("")
archiveClassifier.set("")
}
named("build") {
dependsOn(shadowJar)
}
compileJava {
options.encoding = Charsets.UTF_8.name()
}
}
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
}
}

View File

@@ -3,7 +3,7 @@ var gsonVersion = "2.8.0";
var guavaVersion = "21.0";
dependencies {
api(project(":core", "shadow"))
api(project(":core"))
implementation("cloud.commandframework", "cloud-bungee", "1.5.0")
implementation("net.kyori", "adventure-text-serializer-gson", Versions.adventureApiVersion)
implementation("net.kyori", "adventure-text-serializer-bungeecord", Versions.adventurePlatformVersion)

View File

@@ -1,5 +1,5 @@
name: ${project.parent.name}
description: ${project.description}
version: ${project.version}
author: ${project.organization.name}
name: ${name}
description: ${description}
version: ${version}
author: ${author}
main: org.geysermc.floodgate.BungeePlugin

View File

@@ -1,5 +1,5 @@
dependencies {
api(project(":api", "shadow"))
api(project(":api"))
api("com.google.inject", "guice", Versions.guiceVersion)
api("com.nukkitx.fastutil", "fastutil-short-object-maps", Versions.fastutilVersion)
api("com.nukkitx.fastutil", "fastutil-int-object-maps", Versions.fastutilVersion)

View File

@@ -1 +1,2 @@
org.gradle.caching=true
org.gradle.parallel=true

View File

@@ -39,14 +39,12 @@ dependencyResolutionManagement {
pluginManagement {
plugins {
id("net.kyori.blossom") version "1.2.0"
id("com.github.johnrengelman.shadow") version "7.1.0"
}
includeBuild("build-logic")
}
rootProject.name = "floodgate-parent"
includeBuild("build-logic")
include(":api")
include(":core")
include(":bungee")

View File

@@ -3,7 +3,7 @@ var guavaVersion = "21.0"
var gsonVersion = "2.8.5"
dependencies {
api(project(":core", "shadow"))
api(project(":core"))
implementation("com.google.guava", "guava", guavaVersion)
implementation("cloud.commandframework", "cloud-bukkit", Versions.cloudVersion)

View File

@@ -1,7 +1,7 @@
name: ${project.parent.name}
description: ${project.description}
version: ${project.version}
author: ${project.organization.name}
website: ${project.url}
name: ${name}
description: ${description}
version: ${version}
author: ${author}
website: ${url}
main: org.geysermc.floodgate.SpigotPlugin
api-version: 1.13

View File

@@ -1 +1 @@
{"id": "${project.parent.name}", "name": "${project.parent.name}", "version": "${project.version}", "description": "${project.description}", "url": "${project.url}", "authors": ["${project.organization.name}"], "main": "org.geysermc.floodgate.VelocityPlugin"}
{"id": "${id}", "name": "${name}", "version": "${version}", "description": "${description}", "url": "$url}", "authors": ["${author}"], "main": "org.geysermc.floodgate.VelocityPlugin"}