Files
Event/build.gradle
T
dependabot[bot] 6e97a1727f deps: bump com.gradleup.shadow from 8.3.7 to 8.3.8
Bumps [com.gradleup.shadow](https://github.com/GradleUp/shadow) from 8.3.7 to 8.3.8.
- [Release notes](https://github.com/GradleUp/shadow/releases)
- [Commits](https://github.com/GradleUp/shadow/compare/8.3.7...8.3.8)

---
updated-dependencies:
- dependency-name: com.gradleup.shadow
  dependency-version: 8.3.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-03 20:16:56 +00:00

143 lines
3.6 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 = "com.crimsonwarpedcraft.exampleplugin"
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")
includeGroup("io.papermc.adventure")
}
}
maven {
name = 'minecraft'
url = 'https://libraries.minecraft.net'
content {
includeModule("com.mojang", "brigadier")
}
}
mavenCentral()
}
dependencies {
compileOnly 'io.papermc.paper:paper-api:1.21.7-R0.1-SNAPSHOT'
compileOnly 'com.github.spotbugs:spotbugs-annotations:4.9.3'
implementation 'io.papermc:paperlib:1.0.8'
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.7-R0.1-SNAPSHOT'
testImplementation 'org.junit.jupiter:junit-jupiter:5.13.2'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.13.2'
}
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')
}
}
}