forked from MockBukkit/MockBukkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
191 lines (166 loc) · 4.36 KB
/
build.gradle.kts
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
import java.io.ByteArrayOutputStream
plugins {
id("java-library")
id("jacoco")
id("maven-publish")
id("signing")
id("net.kyori.blossom") version "1.3.1"
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
}
group = "com.github.seeseemelk"
version = this.getFullVersion()
repositories {
mavenCentral()
maven("https://hub.spigotmc.org/nexus/content/repositories/public/")
maven("https://repo.md-5.net/content/groups/public/")
maven("https://repo.papermc.io/repository/maven-public/")
}
dependencies {
// Paper API
api("io.papermc.paper:paper-api:${property("paper.api.full-version")}")
// Dependencies for Unit Tests
implementation("org.junit.jupiter:junit-jupiter:5.10.0")
// General utilities for the project
implementation("net.kyori:adventure-platform-bungeecord:4.3.0")
implementation("org.jetbrains:annotations:24.0.1")
implementation("net.bytebuddy:byte-buddy:1.14.6")
// LibraryLoader dependencies
implementation("org.apache.maven:maven-resolver-provider:3.8.5")
implementation("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3")
implementation("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
}
tasks {
jar {
manifest {
attributes(
"Automatic-Module-Name" to "be.seeseemelk.mockbukkit"
)
}
}
java {
withSourcesJar()
withJavadocJar()
}
javadoc {
options {
(options as? StandardJavadocDocletOptions)?.apply {
encoding = "UTF-8"
// Custom options
addBooleanOption("html5", true)
addStringOption("-release", "17")
links("https://jd.papermc.io/paper/${project.property("paper.api.version")}/")
}
}
}
publishToMavenLocal {
doLast {
println("Published to Maven local with version $version")
}
}
test {
dependsOn(project(":extra:TestPlugin").tasks.jar)
useJUnitPlatform()
}
check {
dependsOn(jacocoTestReport)
}
jacocoTestReport {
dependsOn(test)
reports {
xml.required.set(true)
html.required.set(true)
html.outputLocation.set(layout.buildDirectory.dir("jacocoHtml"))
}
}
jacoco {
toolVersion = "0.8.10"
}
}
blossom {
val metadata = "src/main/java/be/seeseemelk/mockbukkit/MockBukkit.java"
fun repl(token: String) {
replaceToken("\"{$token}\"", "\"${project.property(token)}\"", metadata)
}
repl("paper.api.full-version")
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
signing {
isRequired = !isFork() && isAction()
sign(publishing.publications)
}
nexusPublishing {
this.repositories {
sonatype {
username.set(findProperty("ossrhUsername") as String?)
password.set(findProperty("ossrhPassword") as String?)
}
}
}
publishing {
publications {
create<MavenPublication>("maven") {
artifactId = "MockBukkit-v${property("paper.api.version")}"
from(components.getByName("java"))
pom {
name.set("MockBukkit-v${property("paper.api.version")}")
description.set("MockBukkit is a mocking framework for bukkit to allow the easy unit testing of Bukkit plugins.")
url.set("https://github.com/MockBukkit/MockBukkit")
scm {
connection.set("scm:git:git://github.com/MockBukkit/MockBukkit.git")
developerConnection.set("scm:git:ssh://github.com:MockBukkit/MockBukkit.git")
url.set("https://github.com/MockBukkit/MockBukkit/tree/v${property("paper.api.version")}")
}
licenses {
license {
name.set("MIT License")
url.set("https://github.com/MockBukkit/MockBukkit/blob/v${property("paper.api.version")}/LICENSE")
}
}
developers {
developer {
id.set("seeseemelk")
name.set("Sebastiaan de Schaetzen")
email.set("sebastiaan.de.schaetzen@gmail.com")
}
developer{
id.set("thebusybiscuit")
name.set("TheBusyBiscuit")
}
developer {
id.set("insprill")
name.set("Pierce Thompson")
}
developer {
id.set("thelooter")
name.set("Eve Kolb")
}
}
}
}
}
}
fun isFork(): Boolean {
return run("git", "config", "--get", "remote.origin.url").contains("MockBukkit/MockBukkit")
}
fun isAction(): Boolean {
return System.getenv("CI") != null
}
fun getFullVersion(): String {
return if (!isAction()) {
"dev-${run("git", "rev-parse", "--verify", "--short", "HEAD")}"
} else {
property("mockbukkit.version") as String
}
}
fun run(vararg cmd: String): String {
val stdout = ByteArrayOutputStream()
exec {
commandLine(*cmd)
standardOutput = stdout
}
return stdout.toString().trim()
}