2024-11-26 19:37:57 +00:00
|
|
|
import com.github.spotbugs.snom.SpotBugsTask
|
|
|
|
|
2023-03-14 20:45:33 +00:00
|
|
|
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'
|
2024-11-27 21:05:42 +00:00
|
|
|
id 'com.autonomousapps.dependency-analysis' version "2.5.0"
|
2024-11-25 20:34:27 +00:00
|
|
|
id 'checkstyle'
|
2024-11-27 21:05:42 +00:00
|
|
|
id 'com.github.spotbugs' version "6.0.4" apply false
|
2024-11-26 19:37:57 +00:00
|
|
|
id 'java'
|
2018-09-06 13:47:33 +00:00
|
|
|
}
|
|
|
|
|
2023-03-14 20:45:33 +00:00
|
|
|
// Global checkstyle file
|
2024-10-15 19:14:59 +00:00
|
|
|
ext.checkstyleConfigFile = new File(rootDir, "/config/checkstyle/sun_checks.xml")
|
2023-03-14 20:45:33 +00:00
|
|
|
|
2023-12-20 17:55:50 +00:00
|
|
|
subprojects {
|
2024-11-27 21:05:42 +00:00
|
|
|
apply plugin: 'com.autonomousapps.dependency-analysis'
|
2023-12-20 17:55:50 +00:00
|
|
|
apply plugin: "com.github.spotbugs"
|
2024-11-26 19:37:57 +00:00
|
|
|
apply plugin: "java"
|
|
|
|
apply plugin: "checkstyle"
|
|
|
|
|
2024-11-27 00:49:30 +00:00
|
|
|
repositories {
|
|
|
|
flatDir { dirs "lib" }
|
|
|
|
mavenCentral()
|
|
|
|
}
|
|
|
|
|
2024-11-26 19:37:57 +00:00
|
|
|
java {
|
|
|
|
toolchain {
|
|
|
|
languageVersion = JavaLanguageVersion.of(17)
|
|
|
|
}
|
|
|
|
}
|
2023-12-20 17:55:50 +00:00
|
|
|
|
2024-11-25 20:34:27 +00:00
|
|
|
checkstyle {
|
|
|
|
toolVersion = '10.20.0'
|
|
|
|
configFile file("${rootDir}/config/checkstyle/checkstyle.xml")
|
|
|
|
}
|
|
|
|
|
|
|
|
checkstyleMain {
|
|
|
|
source = 'src/main/java'
|
|
|
|
}
|
|
|
|
checkstyleTest {
|
|
|
|
source = 'src/test/java'
|
|
|
|
}
|
2024-11-26 19:37:57 +00:00
|
|
|
|
2024-11-25 20:34:27 +00:00
|
|
|
tasks.withType(Checkstyle).configureEach {
|
|
|
|
reports {
|
|
|
|
xml.required = false
|
|
|
|
html.required = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-20 17:55:50 +00:00
|
|
|
spotbugs {
|
|
|
|
excludeFilter = file('config/spotbugs/spotbugs-exclude.xml')
|
|
|
|
}
|
|
|
|
|
2024-11-26 19:37:57 +00:00
|
|
|
tasks.withType(SpotBugsTask).configureEach {
|
2023-12-20 17:55:50 +00:00
|
|
|
reports {
|
2024-10-15 19:14:59 +00:00
|
|
|
html.required = true
|
2023-12-20 17:55:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-10-15 19:14:59 +00:00
|
|
|
|
2023-03-14 20:45:33 +00:00
|
|
|
dependencies {
|
|
|
|
repositories {
|
2023-12-20 17:55:50 +00:00
|
|
|
// Use Maven Central for resolving dependencies.
|
|
|
|
mavenCentral()
|
|
|
|
}
|
2023-03-14 20:45:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2023-03-14 20:45:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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()
|
2023-03-14 20:45:33 +00:00
|
|
|
}
|
|
|
|
|
2024-04-24 19:40:46 +00:00
|
|
|
project.ext["projVersion"] = "${projectVersion}"
|
2023-03-17 18:47:10 +00:00
|
|
|
project.ext["jarVersion"] = "${projectVersion}.${buildTime}.${gitHash}"
|
2023-03-14 20:45:33 +00:00
|
|
|
project.ext["packageVersion"] = "${projectVersion}.${buildTime}.${gitHash}.el8"
|
|
|
|
|