This repository has been archived by the owner on Apr 21, 2024. It is now read-only.
forked from SuK-IT/Monitoring
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
219 lines (178 loc) · 6.65 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
//file:noinspection GroovyAssignabilityCheck
//file:noinspection GrUnresolvedAccess
import java.text.SimpleDateFormat
import org.siouan.frontendgradleplugin.infrastructure.gradle.RunNpm
plugins {
id 'java'
id 'idea'
id 'jacoco'
id "com.github.ben-manes.versions" version '0.46.0'
id 'edu.sc.seis.launch4j' version '3.0.1'
id 'org.siouan.frontend-jdk8' version '6.0.0'
id 'org.springframework.boot' version '2.6.3'
id 'io.spring.dependency-management' version '1.1.0'
}
group = 'de.griefed'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
sourceSets {
main {
java {
srcDirs = ['backend/main/java']
}
resources {
srcDirs = ['backend/main/resources']
}
}
test {
java {
srcDirs = ['backend/test/java']
}
resources {
srcDirs = ['backend/test/resources']
}
}
}
configurations {
all {
// Exclude logging from dependencies because we already have logging set up
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
}
embed
implementation.extendsFrom(embed)
}
dependencies {
// Production dependencies
embed 'de.griefed:versionchecker:1.1.5'
embed 'org.springframework.boot:spring-boot-starter-mail:2.6.4'
embed 'org.springframework.boot:spring-boot-starter-quartz:2.6.4'
embed 'org.springframework.boot:spring-boot-starter-web:2.6.4'
embed 'org.springframework.boot:spring-boot-starter-log4j2:2.6.4'
embed 'commons-io:commons-io:2.12.0'
implementation 'org.jetbrains:annotations:24.0.1'
embed 'org.apache.logging.log4j:log4j-api:2.20.0'
embed 'org.apache.logging.log4j:log4j-core:2.17.2'
embed 'org.apache.logging.log4j:log4j-slf4j-impl:2.20.0'
embed 'org.apache.logging.log4j:log4j-web:2.20.0'
embed 'org.apache.logging.log4j:log4j-jul:2.20.0'
// Dev dependencies
developmentOnly 'org.springframework.boot:spring-boot-devtools:2.6.4'
// Testing dependencies
testImplementation 'org.springframework.boot:spring-boot-starter-test:2.6.4'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.3'
testImplementation 'org.junit.platform:junit-platform-commons:1.9.3'
}
// Configure frontend plugin. See documentation at https://siouan.github.io/frontend-gradle-plugin/.
frontend {
packageJsonDirectory = file("${projectDir}/frontend")
nodeVersion = '16.9.1'
nodeInstallDirectory = file("${projectDir}/frontend/node")
yarnEnabled = false
//yarnVersion = "1.22.11"
//yarnInstallDirectory = file("${projectDir}/frontend/yarn")
cleanScript = 'run clean'
assembleScript = 'run build'
// Print the architecture we are running on.
System.out.println(String.format("I am running on: %s", System.getProperty("os.arch")))
// If we are running on arm, specify Node path pattern so arm-builds succeed.
if (System.getProperty("os.arch").equals("arm")) {
nodeDistributionUrlPathPattern = 'vVERSION/node-vVERSION-linux-armv7l.TYPE'
} else if (System.getProperty("os.arch").equals("aarch64")) {
nodeDistributionUrlPathPattern = 'vVERSION/node-vVERSION-linux-arm64.TYPE'
}
}
def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}
tasks.named("dependencyUpdates").configure {
checkForGradleUpdate = true
outputFormatter = "json"
resolutionStrategy {
componentSelection {
all {
if (isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)) {
reject('Release candidate')
}
}
}
}
}
test {
useJUnitPlatform()
// Mention test result in logs
testLogging {
events "passed",
"skipped",
"failed"
}
finalizedBy jacocoTestReport
}
jacocoTestReport {
dependsOn test // tests are required to run before generating the report
reports {
xml.required = true
//csv.required = false
//html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
}
}
jacoco {
toolVersion = "0.8.10"
reportsDirectory = layout.buildDirectory.dir('jacoco')
}
// Include specific files in resources folder, like the license and readme.
tasks.register('about', Copy) {
dependsOn tasks.named('clean')
from layout.projectDirectory.file("README.md") into layout.projectDirectory.dir("backend/main/resources")
}
tasks.register('installQuasar', RunNpm) {
dependsOn tasks.named('installNode')
script = 'install -g @quasar/cli'
}
// Custom task to build and copy an up-to-date version of our frontend to SpringBoot.
tasks.register('copyDist', Copy) {
dependsOn tasks.named('assembleFrontend')
// Delete old frontend files from SpringBoot.
def dirName = "backend/main/resources/static"
file( dirName ).list().each{
f ->
delete "${dirName}/${f}"
}
// Copy new frontend files to SpringBoot.
from layout.projectDirectory.dir("frontend/dist/spa")
into layout.projectDirectory.dir("backend/main/resources/static")
}
// Make sure everything is included in our JavaDoc.
// Since this project is open source, we can include private etc. classes and methods docs.
tasks.withType(Javadoc) {
options.addStringOption('encoding', 'UTF-8')
}
javadoc {
options.memberLevel = JavadocMemberLevel.PRIVATE
classpath = sourceSets.main.runtimeClasspath
}
// Build JavaDoc and JavaSources JARs.
java {
withSourcesJar()
withJavadocJar()
}
bootJar {
// Customize MANIFEST to include relevant information.
manifest {
attributes "Start-Class" : "de.griefed.monitoring.Main",
"Description" : "Simple monitoring app.",
"Built-By" : System.getProperty("user.name"),
"Build-Timestamp": new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date()),
"Created-By" : "Gradle ${gradle.gradleVersion}",
"Build-Jdk" : "${System.getProperty('java.version')} (${System.getProperty('java.vendor')} ${System.getProperty('java.vm.version')})",
"Build-OS" : "${System.getProperty('os.name')} ${System.getProperty('os.arch')} ${System.getProperty('os.version')}",
"Implementation-Version" : "${project.version}",
"Implementation-Title" : "monitoring",
"Application-Name": "Monitoring"
}
}