This repository has been archived by the owner on Nov 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
174 lines (150 loc) · 3.56 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
import com.diffplug.spotless.LineEnding
plugins {
java
`java-library`
`maven-publish`
signing
id("checkstyle")
alias(libs.plugins.spotless)
alias(libs.plugins.nexus)
}
group = "io.github.shiruka"
configurations {
testImplementation.get().extendsFrom(compileOnlyApi.get())
testAnnotationProcessor.get().extendsFrom(annotationProcessor.get())
}
checkstyle {
configFile = file("checkstyle.xml")
}
repositories {
mavenCentral()
maven("https://oss.sonatype.org/content/repositories/snapshots/")
mavenLocal()
}
dependencies {
compileOnlyApi(libs.nbt)
compileOnlyApi(libs.jackson.databind)
compileOnlyApi(libs.jackson.yaml)
compileOnlyApi(libs.log4j)
compileOnlyApi(libs.guice)
compileOnlyApi(libs.event)
annotationProcessor(libs.lombok)
annotationProcessor(libs.annotations)
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
tasks {
compileJava {
options.encoding = Charsets.UTF_8.name()
}
javadoc {
options.encoding = Charsets.UTF_8.name()
(options as StandardJavadocDocletOptions).tags("todo")
}
val javadocJar by creating(Jar::class) {
dependsOn("javadoc")
archiveClassifier.set("javadoc")
from(javadoc)
}
val sourcesJar by creating(Jar::class) {
dependsOn("classes")
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}
checkstyleMain {
dependsOn(spotlessApply)
}
build {
dependsOn(spotlessApply)
dependsOn(jar)
dependsOn(sourcesJar)
dependsOn(javadocJar)
}
test {
useJUnitPlatform()
}
checkstyleTest {
isEnabled = false
}
}
val spotlessApply = rootProject.property("spotless.apply").toString().toBoolean()
val signRequired = !rootProject.property("dev").toString().toBoolean()
if (spotlessApply) {
spotless {
lineEndings = LineEnding.UNIX
format("encoding") {
target("*.*")
encoding("UTF-8")
}
java {
target("**/src/**/java/**/*.java")
importOrder()
removeUnusedImports()
endWithNewline()
indentWithSpaces(2)
trimTrailingWhitespace()
prettier(
mapOf(
"prettier" to "2.7.1",
"prettier-plugin-java" to "1.6.2"
)
).config(
mapOf(
"parser" to "java",
"tabWidth" to 2,
"useTabs" to false
)
)
}
}
}
publishing {
publications {
val publication = create<MavenPublication>("mavenJava") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
artifact(tasks["sourcesJar"])
artifact(tasks["javadocJar"])
pom {
name.set("Api")
description.set("An Api project that helps developers to create unique plugins for Shiru ka.")
url.set("https://shiruka.github.io/")
licenses {
license {
name.set("MIT License")
url.set("https://mit-license.org/license.txt")
}
}
developers {
developer {
id.set("portlek")
name.set("Hasan Demirtaş")
email.set("utsukushihito@outlook.com")
}
}
scm {
connection.set("scm:git:git://github.com/shiruka/api.git")
developerConnection.set("scm:git:ssh://github.com/shiruka/api.git")
url.set("https://github.com/shiruka/api")
}
}
}
signing {
isRequired = signRequired
if (isRequired) {
useGpgCmd()
sign(publication)
}
}
}
}
nexusPublishing {
repositories {
sonatype()
}
}