mirror of
https://github.com/zontreck/AutoMoneyPlugin
synced 2025-06-19 02:13:55 +00:00
144 lines
3.6 KiB
Groovy
144 lines
3.6 KiB
Groovy
import com.github.spotbugs.snom.SpotBugsTask
|
|
import java.text.SimpleDateFormat
|
|
|
|
plugins {
|
|
id 'checkstyle'
|
|
id "com.github.spotbugs" version "6.1.7"
|
|
id 'com.gradleup.shadow' version '8.3.6'
|
|
id 'java'
|
|
}
|
|
|
|
group = "dev.zontreck.amp"
|
|
|
|
static def getTime() {
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd-HHmm")
|
|
sdf.setTimeZone(TimeZone.getTimeZone("UTC"))
|
|
return sdf.format(new Date()).toString()
|
|
}
|
|
|
|
// Set version to version property if supplied
|
|
String shortVersion = null
|
|
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
|
|
}
|
|
|
|
java {
|
|
sourceCompatibility = JavaVersion.VERSION_21
|
|
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 { url 'https://jitpack.io' }
|
|
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'
|
|
compileOnly 'com.github.spotbugs:spotbugs-annotations:4.9.2'
|
|
implementation 'io.papermc:paperlib:1.0.8'
|
|
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.13.0'
|
|
testCompileOnly 'com.github.spotbugs:spotbugs-annotations:4.9.2'
|
|
testImplementation 'io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT'
|
|
testImplementation 'org.junit.jupiter:junit-jupiter:5.12.0'
|
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.12.0'
|
|
compileOnly "com.github.MilkBowl:VaultAPI:1.7"
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
}
|
|
|
|
processResources {
|
|
filesMatching("**/plugin.yml") {
|
|
expand ( NAME: rootProject.name, VERSION: version, PACKAGE: project.group.toString() )
|
|
}
|
|
}
|
|
|
|
checkstyle {
|
|
toolVersion '10.20.1'
|
|
maxWarnings = 0
|
|
}
|
|
|
|
configurations.checkstyle {
|
|
resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") {
|
|
select("com.google.guava:guava:23.0")
|
|
}
|
|
}
|
|
|
|
tasks.withType(Checkstyle).configureEach {
|
|
reports {
|
|
xml.required = false
|
|
html.required = true
|
|
}
|
|
}
|
|
|
|
tasks.withType(SpotBugsTask).configureEach {
|
|
reports.create("html") {
|
|
required = true
|
|
}
|
|
reports.create("xml") {
|
|
required = false
|
|
}
|
|
}
|
|
|
|
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')
|
|
}
|
|
}
|
|
}
|