-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
172 lines (151 loc) · 4.87 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
// SPDX-FileCopyrightText: 2023-2024 Mark Rotteveel
// SPDX-License-Identifier: Apache-2.0
import java.time.Year
import org.asciidoctor.gradle.jvm.AsciidoctorTask
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'application'
id 'com.intershop.gradle.jaxb' version '7.0.0'
id 'org.asciidoctor.jvm.convert' version '4.0.3'
}
group 'nl.lawinegevaar'
version '3.0-SNAPSHOT'
application {
mainModule = 'nl.lawinegevaar.exttablegen'
mainClass = 'nl.lawinegevaar.exttablegen.ExtTableGenMain'
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
jaxb {
javaGen {
extTableGenConfig {
schema = file('src/main/resources/ext-table-gen-1.0.xsd')
packageName = 'nl.lawinegevaar.exttablegen.xmlconfig'
}
}
}
testing {
suites {
configureEach {
useJUnitJupiter()
dependencies {
implementation.bundle(testLibs.bundles.junit)
implementation(project('test-common'))
implementation libs.opencsv
}
targets {
configureEach {
testTask.configure {
testLogging {
events "passed", "skipped", "failed"
}
systemProperty 'file.encoding', 'UTF-8'
}
}
}
}
test {
dependencies {
implementation.bundle(testLibs.bundles.hamcrest)
}
}
integrationTest(JvmTestSuite) {
dependencies {
implementation project()
implementation testLibs.jaybird
implementation.bundle(libs.bundles.jaxb)
implementation libs.jspecify
}
targets {
configureEach {
testTask.configure {
shouldRunAfter(test)
// Optional local environment config from integration-test-local.properties
def localIntegrationTestPropertiesFile = file('integration-test-local.properties')
if (localIntegrationTestPropertiesFile.exists()) {
def props = new Properties()
localIntegrationTestPropertiesFile.withInputStream {
props.load(it)
}
props.stringPropertyNames().each {
systemProperty it, props[it]
}
}
}
}
}
}
}
}
dependencies {
implementation libs.picocli.core
annotationProcessor libs.picocli.codegen
implementation libs.opencsv
implementation libs.bundles.jaxb
implementation libs.commons.lang3
implementation libs.jspecify
testImplementation platform(testLibs.junit.bom)
integrationTestImplementation platform(testLibs.junit.bom)
}
tasks.named('check') {
dependsOn(testing.suites.integrationTest)
}
asciidoctorj {
// asciidoctorj 3.0.0 doesn't seem to work with asciidoctor-gradle-plugin 4.0.3
version = '2.5.13'
}
distributions {
main {
contents {
from(asciidoctor) {
exclude 'index.html'
into 'docs'
}
}
}
}
// only generate distribution zip, not distribution tar
tasks.withType(Tar).configureEach {
enabled = false
}
tasks.named('asciidoctor', AsciidoctorTask).configure {
attributes 'revnumber': false, 'etg-version': project.version
executionMode = OUT_OF_PROCESS
jvm {
jvmArgs "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", "--add-opens", "java.base/java.io=ALL-UNNAMED"
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
tasks.named('compileJava', JavaCompile).configure {
options.compilerArgs += ["-Aproject=${project.group}/${project.name}"]
}
tasks.named('processResources', ProcessResources).configure {
filter ReplaceTokens, tokens: [
'VERSION': project.version
]
}
tasks.withType(Jar).configureEach {
// General manifest info
manifest {
def buildYear = Year.now().toString()
attributes(
'Created-By': "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})",
'Bundle-License': 'Apache-2.0',
'SPDX-License-Identifier': 'Apache-2.0',
'SPDX-FileCopyrightText': "${buildYear == '2023' ? '2023' : "2023-$buildYear"} Mark Rotteveel"
)
}
}
tasks.named('jar', Jar).configure {
// Info specific to main jar
manifest {
attributes(
'Implementation-Title': 'ext-table-gen',
'Implementation-Version': project.version
)
}
}