Don't publish extra modules (#3901)

This commit is contained in:
EnZaXD 2024-06-03 15:22:59 +02:00 committed by GitHub
parent 8a826b88fb
commit 3f72e9ea47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 21 additions and 62 deletions

View File

@ -34,5 +34,3 @@ dependencies {
java {
withJavadocJar()
}
publishShadowJar()

View File

@ -1,34 +1,8 @@
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.named
import java.io.ByteArrayOutputStream
fun Project.publishShadowJar() {
configurePublication {
artifact(tasks["shadowJar"])
artifact(tasks["sourcesJar"])
}
}
fun Project.publishJavaComponents() {
configurePublication {
from(components["java"])
}
}
private fun Project.configurePublication(configurer: MavenPublication.() -> Unit) {
extensions.configure<PublishingExtension> {
publications.named<MavenPublication>("mavenJava") {
apply(configurer)
}
}
}
fun Project.latestCommitHash(): String {
return runGitCommand(listOf("rev-parse", "--short", "HEAD"))
}

View File

@ -1,6 +1,5 @@
plugins {
`java-library`
`maven-publish`
}
tasks {
@ -27,19 +26,3 @@ java {
javaTarget(17)
withSourcesJar()
}
publishing {
publications.create<MavenPublication>("mavenJava") {
groupId = rootProject.group as String
artifactId = project.name
version = rootProject.version as String
}
repositories.maven {
name = "Via"
url = uri("https://repo.viaversion.com/")
credentials(PasswordCredentials::class)
authentication {
create<BasicAuthentication>("basic")
}
}
}

View File

@ -3,6 +3,7 @@ import org.gradle.jvm.tasks.Jar
plugins {
id("via.base-conventions")
id("maven-publish")
id("com.github.johnrengelman.shadow")
}
@ -21,6 +22,25 @@ tasks {
}
}
publishing {
publications.create<MavenPublication>("mavenJava") {
groupId = rootProject.group as String
artifactId = project.name
version = rootProject.version as String
artifact(tasks["shadowJar"])
artifact(tasks["sourcesJar"])
}
repositories.maven {
name = "Via"
url = uri("https://repo.viaversion.com/")
credentials(PasswordCredentials::class)
authentication {
create<BasicAuthentication>("basic")
}
}
}
fun ShadowJar.configureRelocations() {
relocate("com.google.gson", "com.viaversion.viaversion.libs.gson")
relocate("it.unimi.dsi.fastutil", "com.viaversion.viaversion.libs.fastutil")

View File

@ -1,5 +0,0 @@
plugins {
id("via.base-conventions")
}
publishJavaComponents()

View File

@ -18,12 +18,9 @@ val main = setOf(
projects.viaversionFabric
).map { it.dependencyProject }
// val special = setOf().map { it.dependencyProject }
subprojects {
when (this) {
in main -> plugins.apply("via.shadow-conventions")
// in special -> plugins.apply("via.base-conventions")
else -> plugins.apply("via.standard-conventions")
else -> plugins.apply("via.base-conventions")
}
}

View File

@ -7,5 +7,3 @@ dependencies {
exclude("javax.persistence", "persistence-api")
}
}
publishShadowJar()

View File

@ -20,5 +20,3 @@ java {
tasks.named<Jar>("sourcesJar") {
from(project(":viaversion-api").sourceSets.main.get().allSource)
}
publishShadowJar()

View File

@ -30,8 +30,6 @@ tasks {
}
}
publishShadowJar()
val branch = rootProject.branchName()
val baseVersion = project.version as String
val isRelease = !baseVersion.contains('-')

View File

@ -6,5 +6,3 @@ dependencies {
}
annotationProcessor(libs.velocity)
}
publishShadowJar()