-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
150 lines (135 loc) · 4.4 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
import nebula.plugin.contacts.Contact
import java.util.Base64
plugins {
id("org.owasp.dependencycheck") version "7.1.1"
id("nebula.release") version "16.0.0"
id("nebula.maven-nebula-publish") version "18.4.0"
id("nebula.maven-developer") version "18.4.0"
id("nebula.maven-scm") version "18.4.0"
id("nebula.contacts") version "6.0.0"
id("nebula.info-scm") version "11.3.3"
id("nebula.source-jar") version "18.4.0"
id("nebula.javadoc-jar") version "18.4.0"
id("tylerthrailkill.nebula-mit-license") version "0.0.3"
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
jacoco
`java-library`
`maven-publish`
`project-report`
signing
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
repositories {
mavenCentral()
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
username.set(System.getenv("SONATYPE_USERNAME"))
password.set(System.getenv("SONATYPE_PASSWORD"))
}
}
}
signing {
val signingKeyId = System.getenv("SIGNING_KEY_ID")
val signingKey = System.getenv("SIGNING_KEY")
val signingKeyPassword = System.getenv("SIGNING_KEY_PASSWORD")
if (signingKeyId != null && signingKey != null) {
useInMemoryPgpKeys(signingKeyId, String(Base64.getDecoder().decode(signingKey)), signingKeyPassword)
sign(publishing.publications["nebula"])
}
}
contacts {
addPerson("[email protected]", delegateClosureOf<Contact> {
github = "jakubmalek"
moniker = "Jakub Małek"
role("owner")
})
}
sourceSets {
register("junit4Test") {
compileClasspath += sourceSets.main.get().output
runtimeClasspath += sourceSets.main.get().output
}
}
configurations {
"junit4TestImplementation" {
extendsFrom(implementation.get())
}
"junit4TestAnnotationProcessor" {
extendsFrom(annotationProcessor.get())
}
"junit4TestRuntimeOnly" {
extendsFrom(runtimeOnly.get())
}
}
group = "com.webfleet"
dependencies {
// api
api("org.assertj", "assertj-core", "[3.23.0,3.24.0[")
compileOnly("org.opentest4j", "opentest4j", "[1.2.0,1.3.0[")
// lombok
compileOnly(annotationProcessor("org.projectlombok", "lombok", "[1.18.0,2.0.0["))
testCompileOnly(testAnnotationProcessor("org.projectlombok", "lombok", "[1.18.0,2.0.0["))
// test
testImplementation("org.junit.jupiter", "junit-jupiter", "[5.8.0,6.0.0[")
testImplementation("org.mockito", "mockito-junit-jupiter", "[4.6.0,5.0.0[")
// junit4 test used to test optional dependency to opentest4j
"junit4TestImplementation"("junit", "junit", "4.13.2")
}
tasks {
withType<JavaCompile> {
options.encoding = "UTF-8"
}
// Test tasks
val junit4Test = register<Test>("junit4Test") {
group = LifecycleBasePlugin.VERIFICATION_GROUP
description = "Test checking compatibility with JUnit4 API"
systemProperty("file.encoding", "UTF-8")
testLogging {
events("passed", "skipped", "failed")
}
val sourceSet = sourceSets["junit4Test"]
testClassesDirs = sourceSet.output.classesDirs
classpath = configurations[sourceSet.runtimeClasspathConfigurationName] + sourceSet.output + sourceSets["main"].output
}
test {
useJUnitPlatform()
systemProperty("file.encoding", "UTF-8")
finalizedBy(junit4Test)
finalizedBy(jacocoTestReport)
testLogging {
events("passed", "skipped", "failed")
}
}
// Jacoco tasks
jacocoTestReport {
dependsOn(test)
dependsOn(junit4Test)
executionData(fileTree(project.buildDir).include("jacoco/*.exec"))
finalizedBy(jacocoTestCoverageVerification)
reports {
xml.required.set(false)
html.required.set(true)
csv.required.set(true)
}
}
jacocoTestCoverageVerification {
executionData(fileTree(project.buildDir).include("jacoco/*.exec"))
violationRules {
rule {
element = "PACKAGE"
includes = listOf("com.webfleet.*")
limit {
counter = "INSTRUCTION"
value = "COVEREDRATIO"
minimum = "0.8".toBigDecimal()
}
}
}
}
}