-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
147 lines (127 loc) · 4.11 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
import com.diffplug.gradle.spotless.SpotlessPlugin
plugins {
java
`maven-publish`
`java-library`
alias(libs.plugins.spotless)
id("de.chojo.publishdata") version "1.4.0"
}
group = "de.chojo.universalis"
version = "1.4.2"
repositories {
maven("https://eldonexus.de/repository/maven-public")
maven("https://eldonexus.de/repository/maven-proxies")
}
dependencies {
api(project(":universalis-rest"))
api(project(":universalis-ws"))
}
subprojects {
apply {
// We want to apply several plugins to subprojects
plugin<JavaPlugin>()
plugin<de.chojo.PublishData>()
plugin<JavaLibraryPlugin>()
plugin<MavenPublishPlugin>()
plugin<SpotlessPlugin>()
}
}
allprojects {
repositories {
mavenCentral()
maven("https://eldonexus.de/repository/maven-public/")
maven("https://eldonexus.de/repository/maven-proxies/")
}
spotless {
java {
licenseHeaderFile(rootProject.file("HEADER.txt"))
target("**/*.java")
}
}
java {
withSourcesJar()
withJavadocJar()
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
dependencies {
val testlibs = rootProject.testlibs
testImplementation(testlibs.bundles.junit)
testImplementation(testlibs.mockito.core)
testImplementation(testlibs.slf4j.noop)
}
publishData {
useEldoNexusRepos()
publishComponent("java")
}
if (!project.name.contains("example")) {
publishing {
publications.create<MavenPublication>("maven") {
publishData.configurePublication(this)
pom {
url.set("https://github.com/rainbowdashlabs/universalis-java")
developers {
developer {
name.set("Florian Fülling")
url.set("https://github.com/rainbowdashlabs")
}
}
licenses {
license {
name.set("GNU Affero General Public License v3.0")
url.set("https://github.com/rainbowdashlabs/universalis-java/blob/main/LICENSE.md")
}
}
}
}
repositories {
maven {
authentication {
credentials(PasswordCredentials::class) {
username = System.getenv("NEXUS_USERNAME")
password = System.getenv("NEXUS_PASSWORD")
}
}
setUrl(publishData.getRepository())
name = "EldoNexus"
}
}
}
}
// We configure some general tasks for our modules
tasks {
test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
javadoc {
applyJavaDocOptions(options)
}
compileJava {
options.encoding = "UTF-8"
}
javadoc {
options.encoding = "UTF-8"
}
}
}
fun applyJavaDocOptions(options: MinimalJavadocOptions) {
val javaDocOptions = options as StandardJavadocDocletOptions
javaDocOptions.links(
"https://javadoc.io/doc/com.google.code.findbugs/jsr305/latest/",
"https://javadoc.io/doc/org.jetbrains/annotations/latest/",
"https://docs.oracle.com/en/java/javase/${java.toolchain.languageVersion.get().asInt()}/docs/api/"
)
}
tasks {
register<Javadoc>("alljavadoc") {
applyJavaDocOptions(options)
setDestinationDir(file("${layout.buildDirectory.get()}/docs/javadoc"))
val projects = project.rootProject.allprojects.filter { p -> !p.name.contains("example") }
setSource(projects.map { p -> p.sourceSets.main.get().allJava.filter{ p -> p.name != "module-info.java"} })
classpath = files(projects.map { p -> p.sourceSets.main.get().compileClasspath })
}
}