mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
FINALLY offline build SHOULD work
This commit is contained in:
parent
474ad0f1b2
commit
4ed9de3d3c
1 changed files with 25 additions and 42 deletions
|
|
@ -140,30 +140,21 @@ allprojects {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
|
|
||||||
// Online jar (use of libraries)
|
fun ShadowJar.configureBaseShadow(suffix: String, libraries: Array<String>) {
|
||||||
shadowJar {
|
val processedSuffix = if(suffix.isEmpty()) "" else "-$suffix"
|
||||||
// No suffix for this jar
|
val name = "${rootProject.name}-${effectiveVersion}${processedSuffix}.jar"
|
||||||
val name = "${rootProject.name}-${effectiveVersion}.jar"
|
|
||||||
archiveFileName.set(name)
|
archiveFileName.set(name)
|
||||||
|
|
||||||
// Exclude kotlin std, annotations and adventure api
|
|
||||||
exclude("*kotlin/**")
|
|
||||||
exclude("**/annotations/**")
|
|
||||||
exclude("net/kyori/**")
|
|
||||||
|
|
||||||
// Shadow necessary dependency
|
// Shadow necessary dependency
|
||||||
relocate("com.github.stefvanschie.inventoryframework", "xyz.alexcrea.inventoryframework")
|
relocate("com.github.stefvanschie.inventoryframework", "xyz.alexcrea.inventoryframework")
|
||||||
|
|
||||||
// Replace version and example fields in plugin.yml
|
|
||||||
filesMatching("plugin.yml") {
|
filesMatching("plugin.yml") {
|
||||||
expand(
|
expand(
|
||||||
"version" to effectiveVersion,
|
"version" to effectiveVersion + processedSuffix,
|
||||||
"libraries" to " \"org.jetbrains.kotlin:kotlin-stdlib:2.1.0\"" +
|
"libraries" to libraries.joinToString(transform = { "\"$it\"" }),
|
||||||
", \"net.kyori:adventure-text-minimessage:4.25.0\"" +
|
|
||||||
", \"net.kyori:adventure-text-serializer-plain:4.25.0\"" +
|
|
||||||
", \"net.kyori:adventure-text-serializer-legacy:4.25.0\""
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -171,36 +162,28 @@ tasks {
|
||||||
dependsOn(processResources)
|
dependsOn(processResources)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Offline jar (include kotlin std in the final jar fine)
|
// Online jar (use of libraries)
|
||||||
val offlineJar by // Shadow necessary dependency
|
shadowJar {
|
||||||
registering(
|
configureBaseShadow("",
|
||||||
|
arrayOf(
|
||||||
|
"org.jetbrains.kotlin:kotlin-stdlib:2.1.0",
|
||||||
|
"net.kyori:adventure-text-minimessage:4.25.0",
|
||||||
|
"net.kyori:adventure-text-serializer-plain:4.25.0",
|
||||||
|
"net.kyori:adventure-text-serializer-legacy:4.25.0",
|
||||||
|
))
|
||||||
|
|
||||||
// Include all project other dependencies
|
// Exclude kotlin std, annotations and adventure api
|
||||||
ShadowJar
|
exclude("*kotlin/**")
|
||||||
|
exclude("**/annotations/**")
|
||||||
// Add custom anvil compiled
|
exclude("net/kyori/**")
|
||||||
::class, fun ShadowJar.() {
|
|
||||||
val name = "${rootProject.name}-${effectiveVersion}-offline.jar"
|
|
||||||
archiveFileName.set(name)
|
|
||||||
|
|
||||||
// Shadow necessary dependency
|
|
||||||
relocate("com.github.stefvanschie.inventoryframework", "xyz.alexcrea.inventoryframework")
|
|
||||||
|
|
||||||
filesMatching("plugin.yml") {
|
|
||||||
expand(
|
|
||||||
"version" to "$effectiveVersion-offline",
|
|
||||||
"libraries" to ""
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Include all project other dependencies
|
val offlineJar by registering(ShadowJar::class) {
|
||||||
from(project.configurations.runtimeClasspath)
|
configureBaseShadow("offline", emptyArray())
|
||||||
|
|
||||||
// Add custom anvil compiled
|
|
||||||
from(sourceSets.main.get().output)
|
from(sourceSets.main.get().output)
|
||||||
|
configurations = listOf(project.configurations.runtimeClasspath.get())
|
||||||
dependsOn(processResources)
|
}
|
||||||
})
|
|
||||||
|
|
||||||
// Make the online and offline jar on build
|
// Make the online and offline jar on build
|
||||||
named("build") {
|
named("build") {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue