-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathbuild.gradle
91 lines (73 loc) · 2.03 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import com.github.spotbugs.snom.SpotBugsTask
import java.util.concurrent.TimeUnit
plugins {
// Apply the application plugin to add support for building a CLI application in Java.
id 'application'
id 'checkstyle'
id 'com.github.spotbugs' version '6.0.13' apply false
id 'java'
}
// Global checkstyle file
ext.checkstyleConfigFile = new File(rootDir, "/config/checkstyle/sun_checks.xml")
subprojects {
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 {
html.required = true
}
}
}
dependencies {
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
}
def projectVersion = rootProject.file('VERSION').text.trim()
def buildTime = { ->
Date latestdate = new Date()
def time = latestdate.getTime()
long seconds = TimeUnit.MILLISECONDS.toSeconds(time)
return seconds
}
def gitHash = { ->
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"