svci/build.gradle

131 lines
3.4 KiB
Groovy
Raw Normal View History

2022-11-28 13:56:34 +00:00
plugins {
id 'java'
id 'groovy'
id 'application'
id 'jacoco'
id "net.nemerosa.versioning" version "2.15.1"
2023-08-08 12:36:07 +00:00
id "com.netflix.nebula.ospackage" version "11.4.0"
2023-11-22 09:47:00 +00:00
id "com.github.johnrengelman.shadow" version "7.1.2"
2022-11-28 13:56:34 +00:00
}
repositories {
mavenCentral()
mavenLocal()
}
group = projectGroup
version = projectVersion
dependencies {
2023-11-22 09:47:00 +00:00
annotationProcessor 'info.picocli:picocli-codegen:4.7.5'
implementation 'info.picocli:picocli:4.7.5'
2023-08-08 12:36:07 +00:00
implementation 'com.influxdb:influxdb-client-java:6.10.0'
2023-11-22 09:47:00 +00:00
implementation 'org.slf4j:slf4j-api:2.0.9'
implementation 'org.slf4j:slf4j-simple:2.0.9'
2023-08-08 12:36:07 +00:00
implementation 'com.squareup.okhttp3:okhttp:4.11.0' // Also used by InfluxDB Client
2023-11-22 09:47:00 +00:00
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.3'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.15.3'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-toml:2.15.3'
2022-11-28 13:56:34 +00:00
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.spockframework:spock-core:2.3-groovy-4.0'
2023-11-22 09:47:00 +00:00
testImplementation "org.mock-server:mockserver-netty-no-dependencies:5.15.0"
2022-11-28 13:56:34 +00:00
}
application {
mainClass.set('biz.nellemann.svci.Application')
applicationDefaultJvmArgs = [ "-server", "-Xms64m", "-Xmx64m", "-XX:+UseG1GC", "-XX:+ExitOnOutOfMemoryError", "-XX:+AlwaysPreTouch" ]
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
test {
useJUnitPlatform()
}
ospackage {
packageName = 'svci'
release = '1'
user = 'root'
packager = "Mark Nellemann <mark.nellemann@gmail.com>"
into '/opt/svci'
from(shadowJar.outputs.files) {
into 'lib'
}
from('build/scriptsShadow') {
into 'bin'
}
from('doc/') {
into 'doc'
}
from(['README.md', 'LICENSE']) {
into 'doc'
}
}
buildRpm {
dependsOn startShadowScripts
os = "LINUX"
}
buildDeb {
dependsOn startShadowScripts
}
jacoco {
toolVersion = "0.8.8"
}
jacocoTestReport {
group = "verification"
reports {
xml.required = false
csv.required = false
html.destination file("${buildDir}/reports/coverage")
}
}
test.finalizedBy jacocoTestReport
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.1
}
}
}
}
check.dependsOn jacocoTestCoverageVerification
jar {
manifest {
attributes(
'Created-By' : "Gradle ${gradle.gradleVersion}",
'Build-OS' : "${System.properties['os.name']} ${System.properties['os.arch']} ${System.properties['os.version']}",
'Build-Jdk' : "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})",
'Build-User' : System.properties['user.name'],
'Build-Version' : versioning.info.tag ?: (versioning.info.branch + "-" + versioning.info.build),
'Build-Revision' : versioning.info.commit,
'Build-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ss.SSSZ").toString(),
'Add-Opens' : 'java.base/java.lang.invoke' // To ignore "Illegal reflective access by retrofit2.Platform" warnings
)
}
}
2023-01-04 14:22:29 +00:00
tasks.register("packages") {
2022-11-28 13:56:34 +00:00
group "build"
dependsOn ":build"
dependsOn ":buildDeb"
dependsOn ":buildRpm"
}