-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
201 lines (177 loc) · 6.2 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
import org.gradle.internal.os.OperatingSystem
import java.time.Duration
plugins {
id 'java'
id 'java-library'
id 'signing'
id 'maven-publish'
id 'jacoco'
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
// check dependency updates: ./gradlew dependencyUpdates -Drevision=release
id 'com.github.ben-manes.versions' version '0.52.0'
id 'com.github.hierynomus.license' version '0.16.1'
id 'com.github.spotbugs' version '6.1.6'
}
repositories {
mavenLocal()
mavenCentral()
}
group = 'nl.stokpop'
version = file("VERSION").readLines().first()
description = 'LogRater'
dependencies {
implementation 'org.apache.commons:commons-compress:1.27.1'
implementation 'org.xerial:sqlite-jdbc:3.49.1.0'
implementation 'com.beust:jcommander:1.82'
implementation 'joda-time:joda-time:2.13.1'
implementation 'org.hdrhistogram:HdrHistogram:2.2.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.18.2'
implementation 'net.jcip:jcip-annotations:1.0'
implementation 'org.apache.commons:commons-math3:3.6.1'
implementation 'com.healthmarketscience.jackcess:jackcess:4.0.8'
implementation 'com.opencsv:opencsv:5.10'
implementation 'net.sf.jchart2d:jchart2d:3.3.2'
compileOnly 'org.projectlombok:lombok:1.18.36'
compileOnly 'org.jetbrains:annotations:26.0.2'
compileOnly 'ch.qos.logback:logback-classic:1.5.17'
testImplementation 'org.slf4j:slf4j-simple:2.0.16'
testImplementation 'junit:junit:4.13.2'
annotationProcessor 'org.projectlombok:lombok:1.18.36'
}
publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
java {
withJavadocJar()
withSourcesJar()
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
dependencies {
constraints {
implementation('org.apache.xmlgraphics:xmlgraphics-commons:2.6') {
because 'version 2.4 and earlier has server-side request forgery , caused by improper input validation by the XMPParser. CVE-2020-11988'
}
implementation('com.jidesoft:jide-oss:3.6.18') {
because 'version 2.4.8 has corruption in pom: \'dependencies.dependency.systemPath\' for aqua:aqua:jar must specify an absolute path but is ${basedir}/libs/laf.jar in com.jidesoft:jide-oss:2.4.8'
}
}
}
license {
// license check is broken on windows, skip
if (OperatingSystem.current().isWindows()) ignoreFailures = true
ext.year = Calendar.getInstance().get(Calendar.YEAR)
ext.name = 'Peter Paul Bakker, Stokpop'
header = file("src/main/resources/META-INF/LICENSE.txt")
excludes(["**/*.txt", "src/main/resources/META-INF/services/**", "**/*.json"])
// the standard java style makes intellij complain about dangling javadoc
mapping {
java = "SLASHSTAR_STYLE"
}
ignoreFailures = false
strictCheck = true
}
// https://docs.gradle.org/current/userguide/signing_plugin.html
// this only configures signing if the key is found
def hasSigningKey = project.hasProperty("signingKeyId") || project.hasProperty("signingKey")
if(hasSigningKey) {
sign(project)
}
void sign(Project project) {
project.signing {
required { project.gradle.taskGraph.hasTask("publish") }
def signingKeyId = project.findProperty("signingKeyId")
def signingKey = project.findProperty("signingKey")
def signingPassword = project.findProperty("signingPassword")
if (signingKeyId) {
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
} else if (signingKey) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications.maven
}
}
// customize the pom so it complies to Maven central requirements https://central.sonatype.org/pages/requirements.html
// https://docs.gradle.org/current/userguide/maven_plugin.html#sec:maven_pom_generation
project.plugins.withType(MavenPublishPlugin).all {
PublishingExtension publishing = project.extensions.getByType(PublishingExtension)
publishing.publications.withType(MavenPublication).all { mavenPublication ->
mavenPublication.pom {
name = "${project.group}:${project.name}"
description = name
url = "https://github.com/stokpop/lograter.git"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0"
}
}
developers {
developer {
id = 'stokpop'
name = 'Peter Paul Bakker'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:https://github.com/stokpop/lograter.git'
developerConnection = 'scm:git:[email protected]:stokpop/lograter.git'
url = 'https://github.com/stokpop/lograter.git'
}
}
}
}
nexusPublishing {
repositories {
sonatype()
}
// Prevent "java.net.SocketTimeoutException: timeout", when Sonatype is slow.
connectTimeout = Duration.ofMinutes(3)
clientTimeout = Duration.ofMinutes(3)
}
processResources {
def props=["version":version]
filesMatching('lograter.properties') {
expand(props)
}
}
compileJava {
options.encoding = "UTF-8"
}
javadoc {
options.encoding = "UTF-8"
options.addStringOption('Xdoclint:none', '-quiet')
}
test {
finalizedBy jacocoTestReport // report is always generated after tests run
}
jacocoTestReport {
dependsOn test // tests are required to run before generating the report
reports {
xml.required = true
csv.required = false
html.outputLocation = file("${buildDir}/jacocoHtml")
}
}
spotbugs {
ignoreFailures.set(true)
}
task customFatJar(type: Jar) {
manifest {
attributes "Main-Class": "nl.stokpop.lograter.LogRater"
}
archiveBaseName.set("lograter-exec")
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
duplicatesStrategy DuplicatesStrategy.EXCLUDE
with jar
}