188 lines
5.8 KiB
Groovy
188 lines
5.8 KiB
Groovy
plugins {
|
|
id 'com.github.kt3k.coveralls' version '2.12.2'
|
|
id 'com.google.osdetector' version '1.7.3'
|
|
}
|
|
|
|
allprojects {
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
apply plugin: 'jacoco'
|
|
}
|
|
|
|
subprojects {
|
|
group = 'io.spiffe'
|
|
version = project.version
|
|
|
|
ext {
|
|
grpcVersion = '1.61.1'
|
|
jupiterVersion = '5.10.2'
|
|
mockitoVersion = '4.11.0'
|
|
lombokVersion = '1.18.30'
|
|
nimbusVersion = '9.37.3'
|
|
shadowVersion = '8.1.1'
|
|
|
|
//IMPORTANT: This must be in sync with the shaded netty version in gRPC
|
|
nettyVersion = '4.1.107.Final'
|
|
}
|
|
|
|
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.14.0'
|
|
implementation group: 'commons-validator', name: 'commons-validator', version: "1.8.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}"
|
|
|
|
testImplementation group: 'uk.org.webcompere', name: 'system-stubs-core', version: '2.0.2'
|
|
|
|
// 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)"
|
|
}
|
|
}
|
|
}
|
|
|
|
finalizedBy jacocoTestReport
|
|
}
|
|
}
|
|
|
|
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"
|
|
}
|
|
|
|
task assemble {
|
|
dependsOn subprojects.assemble
|
|
}
|
|
|
|
assemble.finalizedBy copyJars
|
|
|
|
task clean {
|
|
dependsOn subprojects.clean
|
|
delete "$buildDir"
|
|
}
|