-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathbuild.gradle
498 lines (442 loc) · 12.6 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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath 'ru.vyarus:gradle-quality-plugin:5.0.0'
classpath 'pl.allegro.tech.build:axion-release-plugin:1.13.6'
classpath 'io.github.gradle-nexus:publish-plugin:2.0.0'
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.13.0' // above this version requires Java 11
}
}
apply plugin: 'pl.allegro.tech.build.axion-release'
apply plugin: 'java-library-distribution'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'ru.vyarus.quality'
apply plugin: 'io.github.gradle-nexus.publish-plugin'
archivesBaseName = 'pw-iso20022'
group 'com.prowidesoftware'
project.ext {
SRU = 'SRU2024'
prowideCoreVersion = 'SRU2024-9.5.5'
}
scmVersion {
tag {
prefix = "${SRU}"
versionSeparator = '-'
}
}
project.version = "${SRU}-${scmVersion.version}"
allprojects {
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
doLast {
if (getJavaCompiler().isPresent()) {
println 'Compiling with ' + getJavaCompiler().get().getMetadata().getInstallationPath()
}
}
}
repositories {
mavenCentral()
// Prowide repo releases
if (project.hasProperty('prowideRepo')) {
maven {
url "${project.prowideRepo}/repository/maven-releases/"
credentials {
username "${project.prowideRepoUser}"
password "${project.prowideRepoPass}"
}
maven {
url "${project.prowideRepo}/repository/maven-snapshots/"
credentials {
username "${project.prowideRepoUser}"
password "${project.prowideRepoPass}"
}
}
}
}
}
sourceSets.main.java.srcDirs = ['src/main/java', 'src/generated/java']
tasks.withType(Jar) {
manifest.attributes(
'Specification-Title': 'Prowide ISO 20022',
'Specification-Version': project.version,
'Specification-Vendor': "${SRU}",
'Implementation-Title': 'Prowide ISO 20022',
'Implementation-Version': project.version,
'Implementation-Vendor': 'www.prowidesoftware.com',
'Built-OS': System.getProperty('os.name'),
'Source-Compatibility': project.sourceCompatibility,
'Target-Compatibility': project.targetCompatibility,
'Built-Date': new Date().format("yyyy-MM-dd"),
'Automatic-Module-Name': 'com.prowidesoftware.iso20022'
)
}
}
subprojects {
apply plugin: 'java-library'
version = rootProject.version
dependencies {
implementation 'org.apache.commons:commons-lang3:3.17.0'
implementation 'com.google.code.gson:gson:2.11.0'
}
tasks.withType(Jar) {
archivesBaseName = "pw-iso20022-${project.name}"
}
sourceSets.main.java.srcDirs = ['src/main/java', 'src/generated/java']
}
configure(subprojects.findAll {it.name != 'model-common-types'}) {
dependencies {
api project(':model-common-types')
}
}
configure(subprojects.findAll {it.name.endsWith('-mx')}) {
def specificTypesProject = ':' + it.name.replace('-mx', '-types')
dependencies {
api project(':iso20022-core')
implementation project(specificTypesProject)
implementation 'org.apache.commons:commons-lang3:3.17.0'
implementation 'com.google.code.gson:gson:2.11.0'
compileOnly 'javax.persistence:javax.persistence-api:2.2'
}
}
configure(subprojects.findAll {it.name.endsWith('-types')}) {
javadoc.enabled = false
}
configure(subprojects.findAll {it.name.endsWith('-mx')}) {
javadoc.enabled = false
}
project(':iso20022-core') {
dependencies {
// included build
api "com.prowidesoftware:pw-swift-core:${prowideCoreVersion}"
implementation 'org.apache.commons:commons-lang3:3.17.0'
implementation 'com.google.code.gson:gson:2.11.0'
compileOnly 'javax.persistence:javax.persistence-api:2.2'
compileOnly 'javax.validation:validation-api:2.0.1.Final'
// to avoid potential differences in JAXB implementations when testing in different environments
testImplementation 'javax.xml.bind:jaxb-api:2.3.1'
testImplementation 'com.sun.xml.bind:jaxb-impl:2.3.3'
testImplementation 'com.sun.xml.bind:jaxb-core:2.3.0.1'
testImplementation 'javax.activation:activation:1.1.1'
testImplementation 'javax.persistence:javax.persistence-api:2.2'
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.4'
testImplementation 'com.google.guava:guava:33.4.0-jre'
testImplementation 'org.assertj:assertj-core:3.27.2'
testImplementation 'org.xmlunit:xmlunit-core:2.10.0'
testImplementation 'org.xmlunit:xmlunit-matchers:2.10.0'
testImplementation 'org.xmlunit:xmlunit-assertj:2.10.0'
testImplementation project(':model-acmt-mx')
testImplementation project(':model-acmt-types')
testImplementation project(':model-camt-mx')
testImplementation project(':model-camt-types')
testImplementation project(':model-catm-mx')
testImplementation project(':model-catm-types')
testImplementation project(':model-fxtr-mx')
testImplementation project(':model-fxtr-types')
testImplementation project(':model-pacs-mx')
testImplementation project(':model-pacs-types')
testImplementation project(':model-pain-mx')
testImplementation project(':model-pain-types')
testImplementation project(':model-sese-mx')
testImplementation project(':model-sese-types')
testImplementation project(':model-seev-mx')
testImplementation project(':model-seev-types')
testImplementation project(':model-xsys-mx')
testImplementation project(':model-xsys-types')
}
tasks.withType(Jar) {
archivesBaseName = 'pw-iso20022-core'
}
test {
useJUnitPlatform()
}
apply plugin: 'com.diffplug.spotless'
spotless {
java {
target '**/src/main/java/**/*.java', '**/src/test/java/**/*.java'
palantirJavaFormat()
}
}
test.finalizedBy(spotlessCheck)
}
jar {
dependsOn subprojects.jar
archivesBaseName = 'pw-iso20022'
subprojects.each { subproject ->
from subproject.configurations.archives.allArtifacts.files.collect {
zipTree(it)
}
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
tasks.register('sourcesJar', Jar) {
dependsOn classes
archiveClassifier = 'sources'
subprojects.each { subproject ->
from subproject.sourceSets.main.allSource
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
def formattedDate() {
new Date().format('dd MMM yyyy')
}
// define an array of project names
def projectsIncludedInJavadoc = [
'iso20022-core',
// 'model-acmt-mx',
// 'model-admi-mx',
// 'model-auth-mx',
'model-caaa-mx',
'model-caad-mx',
'model-caam-mx',
'model-cafc-mx',
'model-cain-mx',
'model-camt-mx',
// 'model-casp-mx',
// 'model-catm-mx',
// 'model-catp-mx',
// 'model-cbrf-mx',
// 'model-colr-mx',
// 'model-fxtr-mx',
'model-pacs-mx',
'model-pain-mx',
// 'model-reda-mx',
// 'model-remt-mx',
// 'model-secl-mx',
'model-seev-mx',
'model-semt-mx',
'model-sese-mx',
'model-seti-mx',
'model-setr-mx',
// 'model-supl-mx',
// 'model-trck-mx',
// 'model-trea-mx',
'model-tsin-mx',
'model-tsmt-mx',
'model-tsrv-mx',
'model-xsys-mx'
]
javadoc {
group = 'Documentation'
description = 'Generate javadocs from all child projects as if it was a single project'
verbose false
failOnError false
//maxMemory = 2G
destinationDir = file("$buildDir/docs/javadoc")
options.overview = "overview.html"
options.header = "${version}"
options.windowTitle = "Prowide ISO 20022 API Reference"
title = "Prowide ISO 20022 API Reference"
options.footer="${SRU}, generated ${formattedDate()}"
options.author false
options.links 'http://docs.oracle.com/javase/8/docs/api/'
// this will fail when the option is not available (older JDK)
options.addBooleanOption("-allow-script-in-comments", true)
options.bottom = '<script src="//static.getclicky.com/js"></script><script>try{ clicky.init(101039278); }catch(e){}</script>'
// exclude the dictionary package because it is huge; and being simple POJO classes does not add to much value to the Javadoc
// exclude "**/dic/**"
// exclude miscellaneous/generic categories
// exclude "**/model/mx/MxAcmt**"
// exclude "**/model/mx/MxAdmi**"
// exclude "**/model/mx/MxAuth**"
// exclude "**/model/mx/MxCbrf**"
// exclude "**/model/mx/MxColr**"
// exclude "**/model/mx/MxFxtr**"
// exclude "**/model/mx/MxReda**"
// exclude "**/model/mx/MxTrck**"
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('charSet', 'UTF-8')
// iterate projectsIncludedInJavadoc array and include projects source folders in the javadoc
projectsIncludedInJavadoc.each { projectName ->
project(projectName).tasks.withType(Javadoc).each { javadocTask ->
source += javadocTask.source
classpath += javadocTask.classpath
excludes += javadocTask.excludes
includes += javadocTask.includes
}
}
}
tasks.register('javadocJar', Jar) {
dependsOn javadoc
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar, sourcesJar
}
// declared dependencies for pom generation
dependencies {
// included build (keep in sync with the latest Prowide Core version)
api "com.prowidesoftware:pw-swift-core:${prowideCoreVersion}"
implementation 'org.apache.commons:commons-lang3:3.17.0'
implementation 'com.google.code.gson:gson:2.11.0'
}
// repo for publishing
project.ext {
nexusRepo = project.version.endsWith('-SNAPSHOT') ? 'maven-snapshots' : 'maven-releases'
}
publishing {
publications {
mavenJava(MavenPublication) {
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
afterEvaluate {
from components.java
groupId = 'com.prowidesoftware'
artifactId = 'pw-iso20022'
version = "${version}"
pom {
name = 'Prowide ISO 20022'
description = 'Prowide Library for ISO 20022 messages'
url = 'http://www.prowidesoftware.com'
scm {
url = 'https://github.com/prowide/prowide-iso20022.git'
connection = '[email protected]:prowide/prowide-iso20022.git'
}
inceptionYear = '2020'
licenses {
license {
name = 'Apache License Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0'
distribution = 'repo'
}
}
developers {
developer {
id = 'zubri'
name = 'Sebastian Zubrinic'
email = '[email protected]'
}
}
organization {
name = 'Prowide'
url = 'http://www.prowidesoftware.com'
}
}
}
}
}
// Prowide repo releases
if (project.hasProperty('prowideRepo')) {
repositories {
maven {
url "${project.prowideRepo}/repository/${nexusRepo}/"
credentials {
username "${project.prowideRepoUser}"
password "${project.prowideRepoPass}"
}
}
}
} else {
project.logger.info('Prowide publishing disabled because repository properties are undefined')
}
}
jar.finalizedBy generatePomFileForMavenJavaPublication
tasks.withType(GenerateModuleMetadata) {
// to avoid metadata in the generated pom.xml files
enabled = false
}
// OSS Sonatype releases
signing {
required { project.hasProperty('SONATYPE_RELEASE') }
sign publishing.publications.mavenJava
}
java {
withJavadocJar()
withSourcesJar()
}
nexusPublishing {
repositories {
sonatype()
}
}
// Zip GitHub releases
distributions {
main {
contents {
from javadocJar
from sourcesJar
into ('lib') {
from (rootProject.configurations.runtimeClasspath)
}
from files('LICENSE.txt')
from files('CHANGELOG.md')
from ("$buildDir/publications/mavenJava/pom-default.xml") {
rename ".*", "pom.xml"
}
}
}
}
distTar.enabled = false
distZip {
dependsOn generatePomFileForMavenJavaPublication
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
// Alternative (manual) staging upload to OSS Sonatype
tasks.register('bundle', Jar) {
dependsOn build
onlyIf {
project.hasProperty('SONATYPE_RELEASE')
}
description 'Creates the bundle.jar for Maven Central distribution'
from jar
from sourcesJar
from javadocJar
from ("$buildDir/publications/mavenJava/pom-default.xml") {
rename ".*", "pom.xml"
}
from ("$buildDir/publications/mavenJava/pom-default.xml.asc") {
rename ".*", "pom.xml.asc"
}
from ("$buildDir/libs") {
include '*.asc'
}
archiveFileName.set('bundle.jar')
}
tasks.withType(Test) {
doFirst {
println 'Running test on ' + getJavaLauncher().get().getMetadata().getInstallationPath()
}
}
task('testOn11', type: Test) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(11)
}
}
task('testOn17', type: Test) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(17)
}
}
task('testOn21', type: Test) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(21)
}
}
quality {
strict = false
// we limit this to spotbugs for the moment
checkstyle = false
codenarc = false
cpd = false
pmd = false
spotbugsEffort = 'min'
spotbugsMaxRank = 1
}