182 lines
6.0 KiB
Groovy
182 lines
6.0 KiB
Groovy
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.73.0'
|
|
jupiterVersion = '5.13.2'
|
|
mockitoVersion = '4.11.0'
|
|
lombokVersion = '1.18.38'
|
|
nimbusVersion = '10.3.1'
|
|
shadowVersion = '8.1.1'
|
|
|
|
//IMPORTANT: This must be in sync with the shaded netty version in gRPC
|
|
nettyVersion = '4.2.2.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.18.0'
|
|
implementation group: 'commons-validator', name: 'commons-validator', version: "1.10.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.8'
|
|
}
|
|
|
|
// 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
|