jnetperf/build.gradle

100 lines
2.5 KiB
Groovy
Raw Normal View History

2023-06-20 07:34:33 +00:00
plugins {
2023-06-22 06:40:31 +00:00
id 'java'
2023-06-20 07:34:33 +00:00
id 'groovy'
id 'application'
2023-06-23 17:53:52 +00:00
id "net.nemerosa.versioning" version "3.0.0"
2023-06-22 06:40:31 +00:00
id "com.netflix.nebula.ospackage" version "11.2.0"
2023-06-23 17:53:52 +00:00
id "com.github.johnrengelman.shadow" version "7.1.2"
2023-06-20 07:34:33 +00:00
}
repositories {
mavenCentral()
}
dependencies {
testImplementation 'org.codehaus.groovy:groovy:3.0.13'
testImplementation 'org.spockframework:spock-core:2.2-groovy-3.0'
testImplementation 'junit:junit:4.13.2'
2023-06-23 17:53:52 +00:00
annotationProcessor 'info.picocli:picocli-codegen:4.7.4'
implementation 'info.picocli:picocli:4.7.4'
2023-06-20 07:34:33 +00:00
implementation 'org.slf4j:slf4j-api:2.0.7'
implementation 'ch.qos.logback:logback-classic:1.3.8'
}
// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
2023-06-23 17:53:52 +00:00
languageVersion = JavaLanguageVersion.of(8)
2023-06-20 07:34:33 +00:00
}
2023-06-23 17:53:52 +00:00
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
2023-06-20 07:34:33 +00:00
}
2023-06-23 17:53:52 +00:00
2023-06-20 07:34:33 +00:00
application {
// Define the main class for the application.
mainClass = 'biz.nellemann.jperf.App'
}
tasks.named('test') {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}
2023-06-22 06:40:31 +00:00
2023-06-23 17:53:52 +00:00
group = projectGroup
version = projectVersion
2023-06-22 06:40:31 +00:00
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(),
)
}
}
apply plugin: 'com.netflix.nebula.ospackage'
ospackage {
packageName = 'jperf'
release = '1'
user = 'root'
packager = "Mark Nellemann <mark.nellemann@gmail.com>"
into '/opt/jperf'
from(shadowJar.outputs.files) {
into 'lib'
}
from('build/scriptsShadow') {
into 'bin'
}
from(['README.md', 'LICENSE']) {
into 'doc'
}
}
buildDeb {
dependsOn build, startShadowScripts
}
buildRpm {
dependsOn build, startShadowScripts
os = org.redline_rpm.header.Os.LINUX
}
tasks.register("packages") {
group "build"
dependsOn ":buildDeb"
dependsOn ":buildRpm"
}