forked from Sukikui/BiomeMap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
131 lines (112 loc) · 3.49 KB
/
build.gradle
File metadata and controls
131 lines (112 loc) · 3.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import com.github.spotbugs.snom.SpotBugsTask
plugins {
id 'checkstyle'
id "com.github.spotbugs" version "6.4.2"
id 'com.gradleup.shadow' version '9.3.2'
id 'java'
}
group = "fr.sukikui.biomemap"
version = "0.1.4"
def paperApiVersion = '1.21.8-R0.1-SNAPSHOT'
def hyphenIndex = paperApiVersion.indexOf('-')
def minecraftVersion = hyphenIndex > 0 ? paperApiVersion.substring(0, hyphenIndex) : paperApiVersion
def archiveVersionLabel = "${version}+mc${minecraftVersion}"
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:${paperApiVersion}"
compileOnly 'com.github.spotbugs:spotbugs-annotations:4.9.6'
implementation 'io.papermc:paperlib:1.0.8'
implementation 'com.google.code.gson:gson:2.13.2'
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.14.0'
testCompileOnly 'com.github.spotbugs:spotbugs-annotations:4.9.6'
testImplementation "io.papermc.paper:paper-api:${paperApiVersion}"
testImplementation 'org.junit.jupiter:junit-jupiter:6.0.3'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:6.0.3'
}
test {
useJUnitPlatform()
}
processResources {
filesMatching("**/plugin.yml") {
expand(
NAME: rootProject.name,
VERSION: version,
PACKAGE: rootProject.group.toString(),
AUTHOR: "Sukikui",
DESCRIPTION: "Lightweight PaperMC plugin exporting dominant biomes from a selected area to JSON",
API_VERSION: minecraftVersion
)
}
}
checkstyle {
toolVersion = '12.0.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 {
archiveBaseName.set(rootProject.name)
archiveVersion.set(archiveVersionLabel)
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}-${archiveVersionLabel}.jar")
}
}
}