-
Notifications
You must be signed in to change notification settings - Fork 22
/
build.gradle
181 lines (153 loc) · 6.03 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
plugins {
id 'com.github.kt3k.coveralls' version '2.12.2'
id 'com.google.osdetector' version '1.7.3'
id 'jvm-test-suite'
}
allprojects {
repositories {
mavenCentral()
}
apply plugin: 'jacoco'
}
subprojects {
group = 'io.spiffe'
version = project.version
ext {
grpcVersion = '1.69.0'
jupiterVersion = '5.11.3'
mockitoVersion = '4.11.0'
lombokVersion = '1.18.36'
nimbusVersion = '9.47'
shadowVersion = '8.1.1'
//IMPORTANT: This must be in sync with the shaded netty version in gRPC
nettyVersion = '4.1.115.Final'
}
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withJavadocJar()
withSourcesJar()
}
javadoc {
exclude "**/grpc/**"
exclude "**/internal/**"
}
publishing {
repositories {
maven {
credentials {
username = project.properties["mavenDeployUser"] ?: System.getenv("NEXUS_USERNAME")
password = project.properties["mavenDeployPassword"] ?: System.getenv("NEXUS_TOKEN")
}
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 {
['maxlambrecht:Max Lambrecht', 'rturner3:Ryan Turner'].each { devData ->
developer {
def devInfo = devData.split(':')
id = devInfo[0]
name = devInfo[1]
url = 'https://github.com/' + devInfo[0]
roles = ["Maintainer"]
}
}
}
}
}
}
}
signing {
useInMemoryPgpKeys(System.getenv('PGP_PRIVATE_KEY'), System.getenv('PGP_KEY_PASSPHRASE'))
sign publishing.publications.mavenJava
}
dependencies {
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.17.0'
implementation group: 'commons-validator', name: 'commons-validator', version: "1.9.0"
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}"
if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
testImplementation group: 'uk.org.webcompere', name: 'system-stubs-core', version: '2.0.3' // Last version supporting Java 8
} else {
testImplementation group: 'uk.org.webcompere', name: 'system-stubs-core', version: '2.1.7'
}
// 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}"
}
testing {
suites {
test {
useJUnitJupiter()
}
}
}
}
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.required = true
html.required = true
}
}
jacocoTestReport.dependsOn {
subprojects.collectMany { project ->
project.tasks.matching { it.name in ['test'] }
}
}
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']
}
// 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"
}
assemble.finalizedBy copyJars