forked from RewisServer/NBTStorage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
104 lines (88 loc) · 2.85 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
val branch: String? = System.getenv("GITHUB_REF")
?.replace("refs/heads/", "")
?.replace("refs/tags/", "")
group = "net.playlegend"
version = if (System.getenv("CI") != null) {
if (branch.equals("stage") || branch.equals("prod")
|| branch!!.matches(Regex("v\\d+[.]\\d+[.]\\d+"))) {
branch.toString()
} else {
"$branch-SNAPSHOT"
}
} else {
"dev-SNAPSHOT"
}.replace("/", "-")
plugins {
java
`maven-publish`
checkstyle
id("com.github.johnrengelman.shadow") version "6.1.0"
id("com.gorylenko.gradle-git-properties") version "2.2.4"
id("com.github.spotbugs") version "4.6.2"
}
tasks.create<Copy>("copyHooks") {
from(file("./hooks/"))
into(file("./.git/hooks/"))
}
tasks.getByPath("prepareKotlinBuildScriptModel").dependsOn("copyHooks")
repositories {
maven("https://papermc.io/repo/repository/maven-public/")
mavenCentral()
}
dependencies {
compileOnly("com.destroystokyo.paper:paper-api:1.16.5-R0.1-SNAPSHOT")
compileOnly("org.projectlombok:lombok:1.18.18")
annotationProcessor("org.projectlombok:lombok:1.18.18")
}
checkstyle {
toolVersion = "8.40"
config = project.resources.text.fromUri("https://assets.playlegend.net/checkstyle.xml")
}
spotbugs {
ignoreFailures.set(true)
showProgress.set(true)
}
gitProperties {
gitPropertiesName = "git.properties"
dateFormat = "yyyy-MM-dd'T'HH:mm:ss"
keys = arrayOf("git.branch", "git.build.host", "git.build.version", "git.commit.id", "git.commit.id.abbrev",
"git.commit.message.full", "git.commit.message.short", "git.commit.time", "git.commit.user.email",
"git.commit.user.name", "git.remote.origin.url", "git.total.commit.count").toMutableList()
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
withSourcesJar()
}
tasks.javadoc {
options.encoding = "UTF-8"
if (JavaVersion.current().isJava9Compatible) {
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
}
}
tasks.withType<JavaCompile> { options.encoding = "UTF-8" }
val tokens = mapOf("VERSION" to project.version)
tasks.withType<ProcessResources> {
filesMatching("*.yml") {
filter<org.apache.tools.ant.filters.ReplaceTokens>("tokens" to tokens)
}
}
publishing {
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name.toLowerCase()
version = project.version.toString()
from(components["java"])
}
}
repositories {
maven {
credentials {
username = System.getenv("repositoryUser")
password = System.getenv("repositoryPassword")
}
url = uri("https://repository.playlegend.net/artifactory/opensource")
}
}
}