Skip to content

Commit

Permalink
Merge pull request #31 from MegavexNetwork/indra-publishing
Browse files Browse the repository at this point in the history
Add indra publishing plugin
  • Loading branch information
vytskalt authored Apr 5, 2024
2 parents 0229684 + fca17db commit f8f542e
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
`maven-publish`
`java-library`
id("net.kyori.indra")
id("net.kyori.indra.publishing")
}

val libs = extensions.getByType(org.gradle.accessors.dm.LibrariesForLibs::class)
Expand All @@ -27,10 +28,28 @@ dependencies {
}

indra {
github("MegavexNetwork", "scoreboard-library") {
ci(true)
}
mitLicense()

javaVersions {
target(8)
minimumToolchain(17)
}

configurePublications {
pom {
url = "https://github.com/MegavexNetwork/agones-kt"
developers {
developer {
id = "vytskalt"
name = "vytskalt"
email = "vytskalt@protonmail.com"
}
}
}
}
}

tasks.withType<JavaCompile>().configureEach {
Expand Down
43 changes: 34 additions & 9 deletions versions/modern/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,52 @@ dependencies {
}

tasks {
assemble {
dependsOn(reobfJar)
}

compileJava {
// Workaround to get it to compile targeting Java 8 while using NMS which targets 17
// Why does this work? I have no idea
options.release = null
}

// Based on https://github.com/unnamed/hephaestus-engine/blob/db6deabe1ddb0a549306b0c4b519c3e79e6f1ea8/runtime-bukkit/adapt-v1_20_R3/build.gradle.kts
reobfJar {
outputJar = file("build/libs/scoreboard-library-modern-$version-reobf.jar")
}

assemble {
dependsOn(reobfJar)
}

create<Sign>("signReobfJar") {
dependsOn(reobfJar)
description = "Signs the reobfuscated modern packet adapter jar"
val signature = Signature(
{ reobfJar.get().outputJar.get().asFile },
{ "reobf" },
this,
this
)
signatures += signature
outputs.files(signature.file)
}
}

java {
disableAutoTargetJvm()
}

indra {
includeJavaSoftwareComponentInPublications(false)
}

publishing {
publications.create<MavenPublication>("maven") {
publications.getByName<MavenPublication>("maven") {
artifact(tasks.reobfJar)
val signReobfJar = tasks.named("signReobfJar")
if (!signReobfJar.get().state.skipped) {
artifact(signReobfJar) {
classifier = "reobf"
extension = "asc"
}
}
}
}

indra {
includeJavaSoftwareComponentInPublications(false)
}

0 comments on commit f8f542e

Please sign in to comment.