Fix versioning not working on b1.7.3
This commit is contained in:
parent
5b3f7a4e56
commit
df450e1f9b
15 changed files with 362 additions and 123 deletions
|
|
@ -4,7 +4,7 @@ plugins {
|
|||
}
|
||||
|
||||
group = "org.adrianvictor"
|
||||
version = System.getenv("VERSION") ?: "unknown"
|
||||
version = "2.0"
|
||||
val buildEnv = System.getenv("BUILD_CHANNEL")
|
||||
?: if (System.getenv("JITPACK") != null) "jitpack" else "local"
|
||||
|
||||
|
|
@ -60,8 +60,8 @@ mcVersions.forEach { ver ->
|
|||
/* ----------------------------------------- */
|
||||
|
||||
dependencies {
|
||||
add("compileOnly", "io.papermc.paper:paper-api:1.21.10-R0.1-SNAPSHOT")
|
||||
add("r1_21CompileOnly", "io.papermc.paper:paper-api:1.21.10-R0.1-SNAPSHOT")
|
||||
add("compileOnly", "io.papermc.paper:paper-api:1.21.1-R0.1-SNAPSHOT")
|
||||
add("r1_21CompileOnly", "io.papermc.paper:paper-api:1.21.1-R0.1-SNAPSHOT")
|
||||
add("b1_7_3CompileOnly", files("libs/craftbukkit-1060.jar"))
|
||||
}
|
||||
|
||||
|
|
@ -103,22 +103,43 @@ val prepareServiceFiles = tasks.register("prepareServiceFiles") {
|
|||
doLast {
|
||||
val registrars = mutableSetOf<String>()
|
||||
inputFiles.forEach { file ->
|
||||
println("Checking file: ${file.absolutePath}, exists: ${file.exists()}")
|
||||
if (file.exists()) {
|
||||
val lines = file.readLines().filter { it.isNotBlank() }
|
||||
println("Found lines: $lines")
|
||||
registrars.addAll(lines)
|
||||
file.readLines().forEach { line ->
|
||||
val trimmed = line.trim()
|
||||
if (trimmed.isNotEmpty()) {
|
||||
registrars.add(trimmed)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val mergedFile = outputDir.get().file(serviceFile).asFile
|
||||
mergedFile.parentFile.mkdirs()
|
||||
mergedFile.writeText(registrars.joinToString("\n"))
|
||||
mergedFile.writeText(registrars.joinToString("\n") + "\n")
|
||||
println("Merged service file content: \n${registrars.joinToString("\n")}")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named<Jar>("jar") {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
from(sourceSets["main"].output)
|
||||
mcVersions.forEach { ver ->
|
||||
from(sourceSets[ver].output) {
|
||||
exclude("META-INF/services/org.adrianvictor.lib.versioning.VersionedServiceRegistrar")
|
||||
}
|
||||
}
|
||||
from(prepareServiceFiles)
|
||||
|
||||
manifest {
|
||||
attributes(
|
||||
"Implemented-Versions" to mcVersions.joinToString(",")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register<Jar>("bundleAll") {
|
||||
dependsOn("jar")
|
||||
// This is now redundant but we keep it for compatibility with previous instructions
|
||||
from(sourceSets["main"].output)
|
||||
mcVersions.forEach { ver ->
|
||||
from(sourceSets[ver].output) {
|
||||
|
|
@ -127,7 +148,7 @@ tasks.register<Jar>("bundleAll") {
|
|||
}
|
||||
|
||||
// Include the merged service file
|
||||
from(prepareServiceFiles.get().outputs.files.singleFile)
|
||||
from(prepareServiceFiles)
|
||||
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue