-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
282 lines (248 loc) · 9.35 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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
import org.apache.tools.ant.filters.*
import org.asciidoctor.gradle.jvm.AsciidoctorTask
/*
Gradle build script for Jaybird - Firebird JDBC driver.
Uploading archives:
publish -PcredentialsPassphrase=<credentials password>
*/
plugins {
id 'java-library'
id 'nu.studer.credentials' version '3.0'
id 'maven-publish'
id 'signing'
id 'org.asciidoctor.jvm.convert' version '4.0.3'
}
defaultTasks 'clean', 'build'
apply from: 'build-properties.gradle'
group = 'org.firebirdsql.jdbc'
version = project.'version.maven'
allprojects {
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
tasks.withType(Test).configureEach {
systemProperty 'file.encoding', 'UTF-8'
}
}
base {
archivesName = project.mavenName
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withJavadocJar()
withSourcesJar()
}
dependencies {
implementation libs.jna
implementation libs.jna.platform
// Use JUnit Jupiter API for testing.
testImplementation platform(testLibs.junit.bom)
testImplementation testLibs.bundles.junit
testRuntimeOnly testLibs.junit.platform.launcher
testImplementation testLibs.bundles.hamcrest
testImplementation testLibs.assertj.core
testImplementation platform(testLibs.mockito.bom)
testImplementation testLibs.bundles.mockito
testImplementation testLibs.awaitility
// A lot (if not all) tests for jaybird-native are in the main project given dependencies on test infrastructure
testImplementation project('jaybird-native')
if (findProperty('test.chacha64') != 'disabled') {
testRuntimeOnly project('chacha64-plugin')
}
}
sourceSets {
main {
java {
srcDirs = ['src/main', 'src/extern']
}
resources {
srcDirs = ['src/resources']
}
}
cryptoapi {
java {
srcDirs = ['src/cryptoapi']
}
cryptoapi.compileClasspath += main.output + main.compileClasspath
cryptoapi.runtimeClasspath += main.output + main.runtimeClasspath
}
cryptoapi_sec {
java {
srcDirs = ['src/cryptoapi_sec']
}
cryptoapi_sec.compileClasspath += cryptoapi.output + main.output + main.compileClasspath
cryptoapi_sec.runtimeClasspath += cryptoapi.output + main.output + main.runtimeClasspath
}
test {
java {
srcDirs = ['src/test', 'src/jna-test']
}
resources {
srcDirs = ['src/test_resources']
}
test.compileClasspath += cryptoapi.output
test.runtimeClasspath += cryptoapi.output
}
}
processResources {
filter ReplaceTokens, tokens: [
'NAME' : project.capitalizedName,
'VERSION' : project.'version.simple',
'MAVEN_NAME' : project.mavenName,
'VERSION_FULL' : project.'version.maven',
'VERSION_MAJOR': project.'version.major',
'VERSION_MINOR': project.'version.minor'
]
}
asciidoctorj {
// asciidoctorj 3.0.0 doesn't seem to work with asciidoctor-gradle-plugin 4.0.3
version = '2.5.13'
docExtensions file('doc-extension.groovy')
}
tasks.named('asciidoctor', AsciidoctorTask).configure {
executionMode = OUT_OF_PROCESS
attributes 'version_simple': project.'version.simple',
'version_wo_target': "${project.'version.simple'}${project.'version.tag'}",
'version_tag': project.'version.tag',
'version_example': "${project.'version.simple'}${project.'version.tag'}",
'stylesdir': file('src/docs/theme/jaybird-html'),
'stylesheet': 'firebird.css',
'docinfo': 'shared',
'docinfodir': file('src/docs/theme/jaybird-html/docinfo'),
'revnumber': false
jvm {
jvmArgs "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", "--add-opens", "java.base/java.io=ALL-UNNAMED"
}
}
task cryptoapiJar(type: Jar) {
from sourceSets.cryptoapi.output
archiveBaseName = project.name + '-cryptoapi'
}
task cryptoapi_sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.cryptoapi.allSource
archiveBaseName = project.name + '-cryptoapi'
}
task cryptoapi_secJar(type: Jar) {
from sourceSets.cryptoapi_sec.output
from (sourceSets.cryptoapi.output) {
exclude('org/firebirdsql/cryptoapi/windows/advapi/**')
}
archiveBaseName = project.name + '-cryptoapi-security'
}
task cryptoapi_sec_sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.cryptoapi_sec.allSource
from (sourceSets.cryptoapi.allSource) {
exclude('org/firebirdsql/cryptoapi/windows/advapi/*.java')
}
archiveBaseName = project.name + '-cryptoapi-security'
}
tasks.register('dist', Zip) {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
dependsOn assemble, asciidoctor
destinationDirectory = layout.buildDirectory.dir('dist')
from jar.outputs
from cryptoapiJar.outputs
from cryptoapi_secJar.outputs
from cryptoapi_sourcesJar.outputs
from cryptoapi_sec_sourcesJar.outputs
from javadocJar.outputs
from sourcesJar.outputs
from(asciidoctor.outputs) {
include 'release_notes.html'
}
from(asciidoctor.outputs) {
exclude 'release_notes.html'
into 'docs'
}
from(javadoc.outputs) {
into 'docs/api'
}
from('.') {
include 'CONTRIBUTING.md'
include 'SECURITY.md'
}
from(configurations.runtimeClasspath) {
into 'lib'
}
def chacha64 = project('chacha64-plugin')
from chacha64.jar.outputs
from chacha64.javadocJar.outputs
from chacha64.sourcesJar.outputs
from(chacha64.configurations.runtimeClasspath) {
exclude 'jaybird-*'
into 'lib'
}
def jaybirdNative = project('jaybird-native')
from jaybirdNative.jar.outputs
from jaybirdNative.javadocJar.outputs
from jaybirdNative.sourcesJar.outputs
from(jaybirdNative.configurations.runtimeClasspath) {
exclude 'jaybird-*'
into 'lib'
}
}
jar {
manifest {
attributes(
'Created-By': "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})",
'Specification-Title': project.'specification.title',
'Specification-Version': project.'specification.version',
'Specification-Vendor': project.'specification.vendor',
'Implementation-Title': project.'implementation.title',
'Implementation-Url': project.'implementation.url',
'Implementation-Version': "$project.version (build: variant=$project.mavenName tag=${project.'version.svntag'} date=${project.'build.id'})",
'Implementation-Vendor': project.'implementation.vendor',
'Implementation-Vendor-Id': project.'implementation.vendor.id'
)
}
}
artifacts {
archives cryptoapiJar, cryptoapi_sourcesJar, cryptoapi_secJar, cryptoapi_sec_sourcesJar
}
javadoc {
options.author()
options.windowTitle = "$project.capitalizedName ${project.'version.maven'} API"
options.docTitle = "$project.capitalizedName ${project.'version.maven'}"
options.bottom = "Copyright © 2001-${project.YEAR} Jaybird (Firebird JDBC) team. All rights reserved."
options.addBooleanOption('html5', true)
options.addBooleanOption('Xdoclint:none', true)
exclude 'org/firebirdsql/jdbc/oo/**'
}
test {
println "Running tests for type ${project.'test.gds_type'}"
// Use junit platform for unit tests
useJUnitPlatform()
// Test configuration, defaults specified in gradle.properties (modify through ext, or use -P<prop>=<value>)
systemProperties(
'test.user': project.'test.user',
'test.password': project.'test.password',
'test.db.dir': project.'test.db.dir',
'test.db.host': project.'test.db.host',
'test.db.port': project.'test.db.port',
'test.db.lc_ctype': project.'test.db.lc_ctype',
'test.gds_type': project.'test.gds_type',
'test.use_firebird_autocommit': project.'test.use.firebird.autocommit',
'jdk.net.useFastTcpLoopback': project.findProperty('jdk.net.useFastTcpLoopback') ?: 'false',
'test.db_on_docker': project.findProperty('test.dbondocker') ?: 'false',
'test.enableProtocol': project.'test.enableProtocol'
)
if (project.hasProperty('test.jna.library.path')) {
systemProperty 'jna.library.path', project.'test.jna.library.path'
} else if (project.'test.gds_type' == 'NATIVE' || project.'test.gds_type' == 'EMBEDDED' ||
project.'test.gds_type' == 'FBOONATIVE' || project.'test.gds_type' == 'FBOOEMBEDDED') {
println "Running test type ${project.'test.gds_type'} without explicit native library path. " +
"Specify property 'test.jna.library.path' to point to a Firebird client location (NATIVE/FBOONATIVE) or " +
"Firebird install (EMBEDDED/FBOOEMBEDDED)."
}
doFirst {
// ensure the 'standard' database directory exists before the test runs
def standardDbDir = file(layout.buildDirectory.dir("tmp/db"))
mkdir standardDbDir
// ensures a Firebird server can create, use and drop databases from this directory
ant.chmod(dir: standardDbDir, perm: '777')
}
}
apply from: 'publish.gradle'