113 lines
No EOL
2.9 KiB
Groovy
113 lines
No EOL
2.9 KiB
Groovy
import java.text.SimpleDateFormat
|
|
|
|
plugins {
|
|
id 'com.gradleup.shadow' version '8.3.6'
|
|
id 'java'
|
|
}
|
|
|
|
group = "dev.zontreck.ase"
|
|
|
|
println "Java version: ${JavaVersion.current()}"
|
|
|
|
static def getTime() {
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd-HHmm")
|
|
sdf.setTimeZone(TimeZone.getTimeZone("MST"))
|
|
return sdf.format(new Date()).toString()
|
|
}
|
|
|
|
// Set version to version property if supplied
|
|
String shortVersion = "v1.0"
|
|
if (hasProperty('ver')) {
|
|
if (ver.charAt(0) == "v") {
|
|
shortVersion = ver.substring(1).toUpperCase()
|
|
} else {
|
|
shortVersion = ver.toUpperCase()
|
|
}
|
|
}
|
|
|
|
// If the tag includes "-RC-" or no tag is supplied, append "-SNAPSHOT"
|
|
int rcIdx
|
|
if (shortVersion == null || shortVersion == "") {
|
|
version = getTime() + "-SNAPSHOT"
|
|
} else if ((rcIdx = shortVersion.indexOf("-RC-")) != -1) {
|
|
version = shortVersion.substring(0, rcIdx) + "-SNAPSHOT"
|
|
} else {
|
|
version = shortVersion + "-" + getTime() + "-SNAPSHOT"
|
|
}
|
|
|
|
java {
|
|
sourceCompatibility = JavaVersion.VERSION_11
|
|
targetCompatibility = JavaVersion.VERSION_21
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
name ='papermc'
|
|
url ='https://repo.papermc.io/repository/maven-public/'
|
|
content {
|
|
includeModule("io.papermc.paper", "paper-api")
|
|
includeModule("io.papermc", "paperlib")
|
|
includeModule("net.md-5", "bungeecord-chat")
|
|
}
|
|
}
|
|
|
|
maven {
|
|
name ='minecraft'
|
|
url ='https://libraries.minecraft.net'
|
|
content {
|
|
includeModule("com.mojang", "brigadier")
|
|
}
|
|
}
|
|
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
compileOnly 'io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT'
|
|
implementation 'io.papermc:paperlib:1.0.8'
|
|
testImplementation 'io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT'
|
|
testImplementation 'org.junit.jupiter:junit-jupiter:5.12.1'
|
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.12.1'
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
}
|
|
|
|
processResources {
|
|
filesMatching("**/plugin.yml") {
|
|
expand ( NAME: rootProject.name, VERSION: version, PACKAGE: project.group.toString() )
|
|
}
|
|
filesMatching("**/paper-plugin.yml") {
|
|
expand( NAME: rootProject.name, VERSION: version, PACKAGE: project.group.toString())
|
|
}
|
|
}
|
|
|
|
shadowJar {
|
|
archiveClassifier.set('')
|
|
relocate 'io.papermc.lib', 'shadow.io.papermc.paperlib'
|
|
minimize()
|
|
}
|
|
|
|
// Disable jar and replace with shadowJar
|
|
jar.enabled = false
|
|
assemble.dependsOn(shadowJar)
|
|
|
|
tasks.register('printProjectName') {
|
|
doLast {
|
|
println rootProject.name
|
|
}
|
|
}
|
|
|
|
tasks.register('release') {
|
|
dependsOn build
|
|
|
|
doLast {
|
|
if (!version.endsWith("-SNAPSHOT")) {
|
|
// Rename final JAR to trim off version information
|
|
shadowJar.archiveFile.get().getAsFile()
|
|
.renameTo(layout.buildDirectory.get().toString() + File.separator + 'libs' + File.separator
|
|
+ rootProject.name + '.jar')
|
|
}
|
|
}
|
|
} |