mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 08:14:00 +02:00
Better build script and create offline build
This commit is contained in:
parent
6fa7cc0168
commit
be53cbf5bd
2 changed files with 66 additions and 13 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import cn.lalaki.pub.BaseCentralPortalPlusExtension
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
|
||||
plugins {
|
||||
|
|
@ -14,7 +15,7 @@ plugins {
|
|||
}
|
||||
|
||||
group = "xyz.alexcrea"
|
||||
version = "1.6.3"
|
||||
version = "1.6.3-test"
|
||||
|
||||
repositories {
|
||||
// EcoEnchants
|
||||
|
|
@ -56,6 +57,9 @@ dependencies {
|
|||
implementation(project(":nms:v1_20R3", configuration = "reobf"))
|
||||
implementation(project(":nms:v1_20R4", configuration = "reobf"))
|
||||
implementation(project(":nms:v1_21R1", configuration = "reobf"))
|
||||
|
||||
// include kotlin for the offline jar
|
||||
implementation(kotlin("stdlib"))
|
||||
}
|
||||
|
||||
allprojects {
|
||||
|
|
@ -112,21 +116,66 @@ val fatJar = tasks.register<Jar>("fatJar") {
|
|||
manifest {
|
||||
attributes.apply { put("Main-Class", "io.delilaheve.CustomAnvil") }
|
||||
}
|
||||
archiveFileName.set("${rootProject.name}-${archiveVersion}.jar")
|
||||
archiveFileName.set("${rootProject.name}-${project.version}.jar")
|
||||
exclude("META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA")
|
||||
duplicatesStrategy = DuplicatesStrategy.WARN
|
||||
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
|
||||
with(tasks.jar.get() as CopySpec)
|
||||
}
|
||||
|
||||
// Ensure fatJar and copyJar are run
|
||||
tasks.getByName("build") {
|
||||
dependsOn(fatJar)
|
||||
}
|
||||
tasks {
|
||||
// Online jar (use of libraries)
|
||||
shadowJar {
|
||||
// No suffix for this jar
|
||||
archiveClassifier.set("")
|
||||
|
||||
// Exclude kotlin std and its annotation
|
||||
exclude("**/kotlin-stdlib*.jar")
|
||||
exclude("**/annotations*.jar")
|
||||
|
||||
// Shadow necessary dependency
|
||||
relocate("com.github.stefvanschie.inventoryframework", "xyz.alexcrea.inventoryframework")
|
||||
|
||||
// Replace version and example fields in plugin.yml
|
||||
filesMatching("plugin.yml") {
|
||||
expand(
|
||||
"version" to project.version,
|
||||
"libraries" to " \"org.jetbrains.kotlin:kotlin-stdlib:1.9.24\" "
|
||||
)
|
||||
}
|
||||
|
||||
// Process resource for plugin.yml
|
||||
dependsOn(processResources)
|
||||
}
|
||||
|
||||
// Offline jar (include kotlin std in the final jar fine)
|
||||
val offlineJar by creating(ShadowJar::class) {
|
||||
archiveClassifier.set("offline")
|
||||
|
||||
// Shadow necessary dependency
|
||||
relocate("com.github.stefvanschie.inventoryframework", "xyz.alexcrea.inventoryframework")
|
||||
|
||||
filesMatching("plugin.yml") {
|
||||
expand(
|
||||
"version" to "${project.version}-offline",
|
||||
"libraries" to ""
|
||||
)
|
||||
}
|
||||
|
||||
// Include all project other dependencies
|
||||
from(project.configurations.runtimeClasspath)
|
||||
|
||||
// Add custom anvil compiled
|
||||
from(sourceSets.main.get().output)
|
||||
|
||||
dependsOn(processResources)
|
||||
}
|
||||
|
||||
// Make the online and offline jar on build
|
||||
named("build") {
|
||||
dependsOn(shadowJar, offlineJar)
|
||||
}
|
||||
|
||||
// Shadow necessary dependency
|
||||
tasks.shadowJar {
|
||||
relocate("com.github.stefvanschie.inventoryframework", "xyz.alexcrea.inventoryframework")
|
||||
}
|
||||
|
||||
val sourcesJar by tasks.registering(Jar::class) {
|
||||
|
|
@ -152,7 +201,12 @@ signing {
|
|||
// PUBLISHING TO SONATYPE CONFIGURATION
|
||||
// ------------------------------------
|
||||
|
||||
val localMavenRepo = uri("E:\\WorkSpace\\Java\\Maven\\repo") // The path is recommended to be set to an empty directory
|
||||
// The path is recommended to be set to an empty directory
|
||||
val localMavenRepo = uri(
|
||||
project.findProperty("localMavenRepo") as String?
|
||||
?: rootProject.layout.buildDirectory.dir("local-maven-repo").get().asFile.toURI() // Convert to URI
|
||||
)
|
||||
|
||||
centralPortalPlus {
|
||||
url = localMavenRepo
|
||||
username = System.getenv("SONATYPE_USERNAME")
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
main: io.delilaheve.CustomAnvil
|
||||
name: CustomAnvil
|
||||
prefix: "Custom Anvil"
|
||||
version: 1.6.3
|
||||
version: ${version}
|
||||
folia-supported: true
|
||||
description: Allow to customise anvil mechanics
|
||||
api-version: 1.16
|
||||
load: POSTWORLD
|
||||
authors: [ DelilahEve, alexcrea ]
|
||||
libraries:
|
||||
- org.jetbrains.kotlin:kotlin-stdlib:1.9.24
|
||||
libraries: [${libraries}]
|
||||
|
||||
commands:
|
||||
anvilconfigreload:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue