741494eb70
--- updated-dependencies: - dependency-name: org.junit.platform:junit-platform-launcher dependency-version: 1.13.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
151 lines
4.0 KiB
Groovy
151 lines
4.0 KiB
Groovy
import com.github.spotbugs.snom.SpotBugsTask
|
|
import java.text.SimpleDateFormat
|
|
|
|
plugins {
|
|
id 'checkstyle'
|
|
id "com.github.spotbugs" version "6.2.1"
|
|
id 'com.gradleup.shadow' version '8.3.8'
|
|
id 'java'
|
|
}
|
|
|
|
group = "dev.trixinity.eventmanager"
|
|
|
|
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")
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral() // MUSÍ být první!
|
|
maven {
|
|
name = 'papermc-repo'
|
|
url = 'https://repo.papermc.io/repository/maven-public/'
|
|
}
|
|
maven {
|
|
name = 'sk89q-repo'
|
|
url = 'https://maven.enginehub.org/repo/'
|
|
}
|
|
maven {
|
|
name = 'placeholderapi'
|
|
url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
compileOnly 'io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT'
|
|
compileOnly 'com.github.spotbugs:spotbugs-annotations:4.9.3'
|
|
implementation 'io.papermc:paperlib:1.0.8'
|
|
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.9'
|
|
compileOnly 'com.sk89q.worldedit:worldedit-bukkit:7.2.15'
|
|
compileOnly 'me.clip:placeholderapi:2.11.6'
|
|
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.14.0'
|
|
testCompileOnly 'com.github.spotbugs:spotbugs-annotations:4.9.3'
|
|
testImplementation 'io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT'
|
|
testImplementation 'org.junit.jupiter:junit-jupiter:5.13.1'
|
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.13.3'
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
}
|
|
|
|
processResources {
|
|
filesMatching("**/plugin.yml") {
|
|
expand ( NAME: rootProject.name, VERSION: version, PACKAGE: rootProject.group.toString() )
|
|
}
|
|
}
|
|
|
|
checkstyle {
|
|
toolVersion = '10.23.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')
|
|
}
|
|
}
|
|
}
|