-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
147 lines (129 loc) · 4.45 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
// Plugins
plugins {
`java-library`
signing
`maven-publish`
id("io.freefair.lombok") version "8.12" apply false
jacoco
}
allprojects {
repositories {
mavenCentral()
google()
}
group = "io.github.xanthic.cache"
version = "0.7.1"
}
subprojects {
apply(plugin = "signing")
apply(plugin = "maven-publish")
if (project.name == "cache-bom") {
apply(plugin = "java-platform")
} else {
apply(plugin = "java-library")
apply(plugin = "io.freefair.lombok")
apply(plugin = "jacoco")
extensions.configure(io.freefair.gradle.plugins.lombok.LombokExtension::class.java) {
version.set("1.18.36")
disableConfig.set(true)
}
extensions.configure(JacocoPluginExtension::class.java) {
toolVersion = "0.8.10"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withSourcesJar()
withJavadocJar()
}
dependencies {
// annotations
compileOnly("org.jetbrains:annotations:26.0.2")
testCompileOnly("org.jetbrains:annotations:26.0.2")
// tests
testImplementation(platform("org.junit:junit-bom:5.11.4"))
testImplementation(group = "org.junit.jupiter", name = "junit-jupiter")
testRuntimeOnly(group = "org.junit.jupiter", name = "junit-jupiter-engine")
// logging and tests
api(group = "org.slf4j", name = "slf4j-api", version = "2.0.16")
testImplementation(group = "org.slf4j", name = "slf4j-simple", version = "2.0.16")
}
tasks {
// compile options
withType<JavaCompile> {
options.encoding = "UTF-8"
}
// javadoc & delombok
val delombok by getting(io.freefair.gradle.plugins.lombok.tasks.Delombok::class)
javadoc {
dependsOn(delombok)
source(delombok)
options {
title = "${project.name} (v${project.version})"
windowTitle = "${project.name} (v${project.version})"
encoding = "UTF-8"
overview = file("${rootDir}/buildSrc/overview-single.html").absolutePath
locale = "en"
this as StandardJavadocDocletOptions
// additional javadoc tags
tags = listOf(
"apiNote:a:API Note:",
"implSpec:a:Implementation Requirements:",
"implNote:a:Implementation Note:"
)
// hide javadoc warnings (a lot from delombok)
addStringOption("Xdoclint:none", "-quiet")
if (JavaVersion.current().isJava9Compatible) {
// javadoc / html5 support
addBooleanOption("html5", true)
}
}
}
// reproducible builds
withType<AbstractArchiveTask>().configureEach {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}
// testing
test {
useJUnitPlatform()
finalizedBy(jacocoTestReport)
}
jacocoTestReport {
dependsOn(test)
reports.xml.required.set(true)
}
}
}
publishing {
repositories {
maven {
name = "maven"
url = uri(project.mavenRepositoryUrl)
credentials {
username = project.mavenRepositoryUsername
password = project.mavenRepositoryPassword
}
}
}
publishing {
publications {
create<MavenPublication>("main") {
if (project.name == "cache-bom") {
from(components["javaPlatform"])
} else {
from(components["java"])
}
pom.default()
}
}
}
}
signing {
isRequired = false // only sign when credentials are configured
if (!project.hasProperty("gnupg.skip")) {
useGpgCmd()
}
sign(publishing.publications["main"])
}
}