forked from spiffe/java-spiffe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
179 lines (149 loc) · 5.55 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
plugins {
id 'com.github.kt3k.coveralls' version '2.12.0'
id 'com.google.osdetector' version '1.6.2'
}
allprojects {
repositories {
mavenCentral()
}
apply plugin: 'jacoco'
}
subprojects {
group = 'io.spiffe'
version = '0.8.0'
ext {
grpcVersion = '1.49.0'
jupiterVersion = '5.7.0'
mockitoVersion = '3.5.15'
lombokVersion = '1.18.20'
nimbusVersion = '9.24.2'
}
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
java {
withJavadocJar()
withSourcesJar()
}
javadoc {
exclude "**/grpc/**"
exclude "**/internal/**"
}
publishing {
repositories {
maven {
credentials {
username = project.properties["mavenDeployUser"]
password = project.properties["mavenDeployPassword"]
}
url = project.properties["mavenDeployUrl"]
}
}
publications {
mavenJava(MavenPublication) {
groupId project.group
version "${project.version}"
from components.java
pom {
name = project.name
artifactId = project.name
url = 'https://github.com/spiffe/java-spiffe'
afterEvaluate {
// description is not available until evaluated.
description = project.description
}
scm {
connection = 'scm:git:https://github.com/spiffe/java-spiffe.git'
developerConnection = 'scm:git:git@github.com:spiffe/java-spiffe.git'
url = 'https://github.com/spiffe/java-spiffe'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'maxlambrecht'
name = 'Max Lambrecht'
email = 'maxlambrecht@gmail.com'
}
}
}
}
}
}
signing {
sign publishing.publications.mavenJava
}
dependencies {
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.11'
implementation group: 'commons-validator', name: 'commons-validator', version: "1.7"
testCompileOnly group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: "${jupiterVersion}"
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: "${jupiterVersion}"
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: "${jupiterVersion}"
testCompileOnly group: 'org.mockito', name: 'mockito-core', version: "${mockitoVersion}"
testRuntimeOnly group: 'org.mockito', name: 'mockito-junit-jupiter', version: "${mockitoVersion}"
// Project Lombok dependency
compileOnly group: 'org.projectlombok', name: 'lombok', version: "${lombokVersion}"
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: "${lombokVersion}"
testCompileOnly group: 'org.projectlombok', name: 'lombok', version: "${lombokVersion}"
testAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: "${lombokVersion}"
}
test {
useJUnitPlatform()
testLogging {
afterSuite { desc, result ->
if (!desc.parent) {
println "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
}
}
}
}
}
task jacocoTestReport(type: JacocoReport) {
// Gather execution data from all subprojects
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
// Add all relevant sourcesets from the subprojects
subprojects.each {
sourceSets it.sourceSets.main
}
// Filter out autogenerated or internal code
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: ['**/grpc/**', '**/exception/**', '**/internal/**'])
}))
}
reports {
xml.enabled true
html.enabled true
}
}
coveralls {
jacocoReportPath 'build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml'
sourceDirs = ['java-spiffe-core/src/main/java',
'java-spiffe-helper/src/main/java',
'java-spiffe-provider/src/main/java']
}
// always run the tests before generating the report
jacocoTestReport.dependsOn {
subprojects*.test
copyJars // workaround to prevent deleting the build folder before generating the reports
}
// copy submodules jars to a common folder for deploy
task copyJars(type: Copy) {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
from subprojects.collect { it.tasks.withType(Jar) }
into "$buildDir/libs"
}
task assemble {
dependsOn subprojects.assemble
}
assemble.finalizedBy copyJars
task clean {
dependsOn subprojects.clean
delete "$buildDir"
}