HIRS/build.gradle

94 lines
2.1 KiB
Groovy
Raw Normal View History

import com.github.spotbugs.snom.SpotBugsTask
import java.util.concurrent.TimeUnit
2023-03-07 01:48:51 +00:00
plugins {
// Apply the application plugin to add support for building a CLI application in Java.
id 'application'
id 'com.autonomousapps.dependency-analysis' version "2.5.0"
id 'checkstyle'
id 'com.github.spotbugs' version "6.0.4" apply false
id 'java'
2018-09-06 13:47:33 +00:00
}
// Global checkstyle file
2024-10-15 19:14:59 +00:00
ext.checkstyleConfigFile = new File(rootDir, "/config/checkstyle/sun_checks.xml")
subprojects {
apply plugin: 'com.autonomousapps.dependency-analysis'
apply plugin: "com.github.spotbugs"
apply plugin: "java"
apply plugin: "checkstyle"
repositories {
flatDir { dirs "lib" }
mavenCentral()
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
checkstyle {
toolVersion = '10.20.0'
configFile file("${rootDir}/config/checkstyle/checkstyle.xml")
}
checkstyleMain {
source = 'src/main/java'
}
checkstyleTest {
source = 'src/test/java'
}
tasks.withType(Checkstyle).configureEach {
reports {
xml.required = false
html.required = true
}
}
spotbugs {
excludeFilter = file('config/spotbugs/spotbugs-exclude.xml')
}
tasks.withType(SpotBugsTask).configureEach {
reports {
2024-10-15 19:14:59 +00:00
html.required = true
}
}
}
2024-10-15 19:14:59 +00:00
dependencies {
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
}
def projectVersion = rootProject.file('VERSION').text.trim()
def buildTime = { ->
2024-10-15 19:14:59 +00:00
Date latestdate = new Date()
def time = latestdate.getTime()
long seconds = TimeUnit.MILLISECONDS.toSeconds(time)
return seconds
}
def gitHash = { ->
2023-06-14 18:29:59 +00:00
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
}
project.ext["projVersion"] = "${projectVersion}"
project.ext["jarVersion"] = "${projectVersion}.${buildTime}.${gitHash}"
project.ext["packageVersion"] = "${projectVersion}.${buildTime}.${gitHash}.el8"