mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-25 03:25:11 +01:00
Make proper sources jar (#2495)
This commit is contained in:
parent
d5f56784e2
commit
03638028cd
@ -4,28 +4,38 @@ plugins {
|
|||||||
id("com.github.johnrengelman.shadow")
|
id("com.github.johnrengelman.shadow")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val platforms = setOf(
|
||||||
|
rootProject.projects.viaversionBukkit,
|
||||||
|
rootProject.projects.viaversionBungee,
|
||||||
|
rootProject.projects.viaversionFabric,
|
||||||
|
rootProject.projects.viaversionSponge,
|
||||||
|
rootProject.projects.viaversionVelocity
|
||||||
|
).map { it.dependencyProject }
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
shadowJar {
|
shadowJar {
|
||||||
archiveClassifier.set("")
|
archiveClassifier.set("")
|
||||||
archiveFileName.set("ViaVersion-${project.version}.jar")
|
archiveFileName.set("ViaVersion-${project.version}.jar")
|
||||||
destinationDirectory.set(rootProject.projectDir.resolve("build/libs"))
|
destinationDirectory.set(rootProject.projectDir.resolve("build/libs"))
|
||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
sequenceOf(
|
platforms.forEach { platform ->
|
||||||
rootProject.projects.viaversionBukkit,
|
val shadowJarTask = platform.tasks.named<ShadowJar>("shadowJar").forUseAtConfigurationTime().get()
|
||||||
rootProject.projects.viaversionBungee,
|
|
||||||
rootProject.projects.viaversionFabric,
|
|
||||||
rootProject.projects.viaversionSponge,
|
|
||||||
rootProject.projects.viaversionVelocity,
|
|
||||||
).map { it.dependencyProject }.forEach { subproject ->
|
|
||||||
val shadowJarTask = subproject.tasks.named<ShadowJar>("shadowJar").forUseAtConfigurationTime().get()
|
|
||||||
dependsOn(shadowJarTask)
|
dependsOn(shadowJarTask)
|
||||||
dependsOn(subproject.tasks.withType<Jar>())
|
dependsOn(platform.tasks.withType<Jar>())
|
||||||
from(zipTree(shadowJarTask.archiveFile))
|
from(zipTree(shadowJarTask.archiveFile))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
build {
|
build {
|
||||||
dependsOn(shadowJar)
|
dependsOn(shadowJar)
|
||||||
}
|
}
|
||||||
|
sourcesJar {
|
||||||
|
rootProject.subprojects.forEach { subproject ->
|
||||||
|
if (subproject == project) return@forEach
|
||||||
|
val platformSourcesJarTask = subproject.tasks.findByName("sourcesJar") as? Jar ?: return@forEach
|
||||||
|
dependsOn(platformSourcesJarTask)
|
||||||
|
from(zipTree(platformSourcesJarTask.archiveFile))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
publishShadowJar()
|
publishShadowJar()
|
||||||
|
Loading…
Reference in New Issue
Block a user