-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
199 lines (158 loc) · 6.81 KB
/
build.gradle
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
192
193
194
195
196
197
198
199
plugins {
id "java"
id "java-library"
id "com.gradleup.shadow" version "8.3.3"
id "maven-publish"
}
group = "io.github.kale_ko"
version = project_version
repositories {
maven {
name = "Kales-Maven"
url = "https://maven.kaleko.dev/public-snapshot/"
}
mavenCentral()
}
dependencies {
api "com.fasterxml.jackson.core:jackson-core:${jackson_version}"
api "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${jackson_version}"
api "com.fasterxml.jackson.dataformat:jackson-dataformat-smile:${jackson_version}"
testImplementation "org.junit.jupiter:junit-jupiter:${junit_jupiter_version}"
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
compileOnly "org.jetbrains:annotations:${annotations_version}"
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(java_version)
}
withSourcesJar()
withJavadocJar()
}
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
}
jar {
manifest {
attributes "Name": "io/github/kale_ko/bjsl/",
"Specification-Title": "BJSL",
"Specification-Version": project_version,
"Specification-Vendor": "Kale-Ko",
"Implementation-Title": "io.github.kale_ko.bjsl",
"Implementation-Version": project_version,
"Implementation-Vendor": "Kale-Ko",
"Sealed": true
}
}
shadowJar {
archiveClassifier = "fat"
}
build {
finalizedBy tasks.shadowJar
}
javadoc {
title = project.name + " " + project.version
options.encoding = "UTF-8"
options.locale = "en"
options.source = JavaLanguageVersion.of(java_version).asInt()
options.showFromProtected()
options.linkSource = true
options.noDeprecatedList = true
options.author = true
options.version = true
int javaVersion = JavaLanguageVersion.of(java_version).asInt()
options.links = [javaVersion < 11 ? ("https://docs.oracle.com/javase/" + javaVersion + "/docs/api/") : ("https://docs.oracle.com/en/java/javase/" + javaVersion + "/docs/api/"),
"https://javadoc.io/doc/com.fasterxml.jackson.core/jackson-core/" + jackson_version + "/",
"https://javadoc.io/doc/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/" + jackson_version + "/",
"https://javadoc.io/doc/com.fasterxml.jackson.dataformat/jackson-dataformat-xml/" + jackson_version + "/",
"https://javadoc.io/doc/com.fasterxml.jackson.dataformat/jackson-dataformat-smile/" + jackson_version + "/",
"https://javadoc.io/doc/org.jetbrains/annotations/" + annotations_version + "/"]
options.tags = ["apiNote:TCMF:API note:", "implNote:TCMF:Implementation note:"]
doFirst {
mkdir "build/"
mkdir "build/docs/"
file("build/docs/overview.html").text = "<html><body><p class=\"overview\">" + project_description + "</p></body></html>"
}
options.overview "build/docs/overview.html"
}
test {
useJUnitPlatform()
}
publishing {
repositories {
mavenLocal()
maven {
name = "Kales-Maven-Snapshot"
url = "https://maven.kaleko.dev/public-snapshot/"
credentials {
username = System.getenv("MAVEN_USER")
password = System.getenv("MAVEN_TOKEN")
}
}
if ("release".equalsIgnoreCase(System.getenv("MAVEN_TYPE"))) {
maven {
name = "Kales-Maven-Release"
url = "https://maven.kaleko.dev/public-release/"
credentials {
username = System.getenv("MAVEN_USER")
password = System.getenv("MAVEN_TOKEN")
}
}
maven {
name = "GitHub-Packages-Release"
url = "https://maven.pkg.github.com/Kale-Ko/BJSL/"
credentials {
username = System.getenv("GH_PACKAGES_USER")
password = System.getenv("GH_PACKAGES_TOKEN")
}
}
}
}
publications {
main(MavenPublication) {
groupId = group
artifactId = "bjsl"
version = project_version
artifact tasks.jar
artifact tasks.shadowJar
artifact tasks.sourcesJar
artifact tasks.javadocJar
pom.withXml {
def node = asNode()
node.appendNode("packaging", "jar")
def licenseNode = node.appendNode("licenses").appendNode("license")
licenseNode.appendNode("name", "MIT")
licenseNode.appendNode("url", "https://opensource.org/licenses/MIT")
def developerNode = node.appendNode("developers").appendNode("developer")
developerNode.appendNode("id", "kale-ko")
developerNode.appendNode("name", "Kale Ko")
developerNode.appendNode("url", "https://www.kaleko.dev/")
developerNode.appendNode("email", "[email protected]")
def scmNode = node.appendNode("scm")
scmNode.appendNode("connection", "scm:git:[email protected]:Kale-Ko/BJSL.git")
scmNode.appendNode("developerConnection", "scm:git:[email protected]:Kale-Ko/BJSL.git")
scmNode.appendNode("tag", "main")
scmNode.appendNode("url", "https://github.com/Kale-Ko/BJSL/")
def dependenciesNode = node.appendNode("dependencies")
def compileDependencies = []
configurations.compileClasspath.resolvedConfiguration.getFirstLevelModuleDependencies().each {
def dependencyNode = dependenciesNode.appendNode("dependency")
dependencyNode.appendNode("groupId", it.moduleGroup)
dependencyNode.appendNode("artifactId", it.moduleName)
dependencyNode.appendNode("version", it.moduleVersion)
dependencyNode.appendNode("scope", "compile")
compileDependencies.push(it.moduleGroup + ":" + it.moduleName + ":" + it.moduleVersion)
}
configurations.runtimeClasspath.resolvedConfiguration.getFirstLevelModuleDependencies().each {
if (compileDependencies.contains(it.moduleGroup + ":" + it.moduleName + ":" + it.moduleVersion)) {
return
}
def dependencyNode = dependenciesNode.appendNode("dependency")
dependencyNode.appendNode("groupId", it.moduleGroup)
dependencyNode.appendNode("artifactId", it.moduleName)
dependencyNode.appendNode("version", it.moduleVersion)
dependencyNode.appendNode("scope", "runtime")
}
}
}
}
}