forked from spiffe/java-spiffe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
168 lines (138 loc) · 4.92 KB
/
build.gradle
File metadata and controls
168 lines (138 loc) · 4.92 KB
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
plugins {
id 'jacoco'
id 'com.google.osdetector' version '1.7.3'
id 'jvm-test-suite'
id 'com.vanniktech.maven.publish' version '0.35.0' apply false
}
allprojects {
repositories {
mavenCentral()
}
}
subprojects {
group = 'io.spiffe'
version = project.version
ext {
grpcVersion = '1.79.0'
jupiterVersion = '5.13.4'
mockitoVersion = '4.11.0'
nimbusVersion = '10.7'
shadowVersion = '9.0.0'
//IMPORTANT: This must be in sync with the shaded netty version in gRPC
nettyVersion = '4.2.9.Final'
}
apply plugin: 'java-library'
apply plugin: 'jacoco'
apply plugin: 'com.vanniktech.maven.publish'
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withSourcesJar()
}
javadoc {
exclude "**/grpc/**"
exclude "**/internal/**"
}
// Central Portal + signing configuration
mavenPublishing {
// Credentials come from:
// - ORG_GRADLE_PROJECT_mavenCentralUsername
// - ORG_GRADLE_PROJECT_mavenCentralPassword
publishToMavenCentral()
signAllPublications()
pom {
name.set(project.name)
url.set('https://github.com/spiffe/java-spiffe')
if (project.description) {
description.set(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"]
}
}
}
}
}
dependencies {
implementation "org.apache.commons:commons-lang3:3.20.0"
implementation "commons-validator:commons-validator:1.10.1"
testImplementation "org.junit.jupiter:junit-jupiter-api:${jupiterVersion}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${jupiterVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-params:${jupiterVersion}"
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
testRuntimeOnly "org.mockito:mockito-junit-jupiter:${mockitoVersion}"
if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
testImplementation "uk.org.webcompere:system-stubs-core:2.0.3"
} else {
testImplementation "uk.org.webcompere:system-stubs-core:2.1.8"
}
}
testing {
suites {
test {
useJUnitJupiter()
}
}
}
plugins.withId('com.vanniktech.maven.publish') {
tasks.matching { it.name == 'generateMetadataFileForMavenPublication' }.configureEach {
dependsOn(
tasks.matching { it.name == 'plainJavadocJar' }
)
}
}
// Disable per-module JaCoCo reports; generate a single aggregate report at root
tasks.withType(JacocoReport).configureEach {
enabled = false
}
}
tasks.register('jacocoTestReport', JacocoReport) {
dependsOn(subprojects.collect { it.tasks.named('test') })
jacocoClasspath = configurations.jacocoAnt
executionData = fileTree(rootDir) {
include '**/build/jacoco/*.exec'
include '**/build/jacoco/*.ec'
}
def mainSourceDirs = files(subprojects.collect { p -> p.sourceSets.main.allSource.srcDirs })
def mainClassDirs = files(subprojects.collect { p -> p.sourceSets.main.output })
sourceDirectories = mainSourceDirs
classDirectories = files(mainClassDirs.files.collect { dir ->
fileTree(dir: dir, exclude: [
'**/grpc/**',
'**/exception/**',
'**/internal/**'
])
})
reports {
xml.required = true
html.required = true
xml.outputLocation = layout.buildDirectory.file('reports/jacoco/jacoco.xml')
html.outputLocation = layout.buildDirectory.dir('reports/jacoco/html')
}
}
// copy submodules jars to a common folder for deploy
def copyJars = tasks.register('copyJars', Copy) {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
from(subprojects.collect { it.tasks.withType(Jar) })
into(layout.buildDirectory.dir("libs"))
}
tasks.named('assemble') {
finalizedBy(copyJars)
}