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"])
}
}