This repository has been archived by the owner on Dec 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
/
build.gradle
352 lines (295 loc) · 12.5 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
plugins {
id 'ru.vyarus.animalsniffer' version '1.6.0'
}
allprojects {
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: 'signing'
group = 'info.cqframework'
version = '2.3.0-SNAPSHOT'
}
subprojects {
apply plugin: 'java-library'
apply plugin: 'jacoco'
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
repositories {
mavenLocal()
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
dependencies {
testImplementation group: 'org.testng', name: 'testng', version: '7.4.0'
testImplementation group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
testImplementation group: 'uk.co.datumedge', name: 'hamcrest-json', version: '0.2'
testImplementation group: 'junit', name: 'junit', version: '4.12'
testImplementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.36'
}
jar {
manifest {
attributes('Implementation-Title': project.name,
'Implementation-Version': project.version,
'Specification-Title': 'HL7 Clinical Quality Language (CQL)',
'Specification-Version': '1.5.2')
}
}
test {
useTestNG()
}
jacoco {
toolVersion = "0.8.8"
}
check.dependsOn(jacocoTestReport)
/*
Turn on static code analysis by passing 'sca' as a system property:
e.g., gradle -Dsca build
Or add it to your user gradle.properties file (${HOME}/.gradle/gradle.properties):
systemProp.sca=true
*/
if (System.getProperty('sca') != null) {
apply plugin: 'pmd'
dependencies {
pmd(
'net.sourceforge.pmd:pmd-core:5.3.1',
'net.sourceforge.pmd:pmd-java:5.3.1'
)
}
pmd {
consoleOutput = true
toolVersion = "5.3.1"
ruleSetFiles = files("${rootProject.projectDir}/custom-pmd-ruleset.xml")
ruleSets = []
}
apply plugin: 'findbugs'
findbugs {
toolVersion = "3.0.1"
excludeFilter = file("${rootProject.projectDir}/findbugs-exclude-filter.xml")
}
tasks.withType(FindBugs) {
reports {
xml.enabled = false
html.enabled = true
}
}
}
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:unchecked'
options.deprecation = true
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar, sourcesJar
}
}
// Modules that can be used on Android
configure(subprojects.findAll {it.name in ['engine', 'engine.fhir', 'engine.jackson']}) {
apply plugin: 'ru.vyarus.animalsniffer'
dependencies {
// Checks compliance with Android API 26
signature 'net.sf.androidscents.signature:android-api-level-26:8.0.0_r2@signature'
}
}
/*
FHIR dependencies
*/
configure(subprojects.findAll {it.name in ['engine.fhir']}) {
dependencies {
// fhir core dependencies
implementation group: 'ca.uhn.hapi.fhir', name: 'org.hl7.fhir.r5', version: '5.6.36'
implementation group: 'ca.uhn.hapi.fhir', name: 'org.hl7.fhir.convertors', version: '5.6.36'
implementation group: 'ca.uhn.hapi.fhir', name: 'org.hl7.fhir.utilities', version: '5.6.36'
// HAPI base
implementation group: 'ca.uhn.hapi.fhir', name: 'hapi-fhir-base', version: '6.0.1'
implementation group: 'ca.uhn.hapi.fhir', name: 'hapi-fhir-converter', version: '6.0.1'
// FHIR STU3
implementation group: 'ca.uhn.hapi.fhir', name: 'hapi-fhir-structures-dstu3', version: '6.0.1'
// FHIR r4
implementation group: 'ca.uhn.hapi.fhir', name: 'hapi-fhir-structures-r4', version: '6.0.1'
// FHIR r5
implementation group: 'ca.uhn.hapi.fhir', name: 'hapi-fhir-structures-r5', version: '6.0.1'
}
}
/*
JAXB dependencies:
https://mkyong.com/java/jaxbexception-implementation-of-jaxb-api-has-not-been-found-on-module-path-or-classpath/
*/
configure(subprojects.findAll {it.name in ['engine', 'engine.fhir']}) {
configurations {
xjc
}
dependencies {
xjc group: 'org.jvnet.jaxb2_commons', name: 'jaxb2-basics-ant', version: '0.13.1'
xjc group: 'org.jvnet.jaxb2_commons', name: 'jaxb2-basics', version: '0.13.1'
xjc group: 'org.jvnet.jaxb2_commons', name: 'jaxb2-fluent-api', version: '3.0'
// Eclipse has taken over all Java EE reference components
// https://www.infoworld.com/article/3310042/eclipse-takes-over-all-java-ee-reference-components.html
// https://wiki.eclipse.org/Jakarta_EE_Maven_Coordinates
xjc group: 'jakarta.xml.bind', name: 'jakarta.xml.bind-api', version: '2.3.3'
xjc group: 'org.glassfish.jaxb', name: 'jaxb-xjc', version: '2.4.0-b180830.0438'
xjc group: 'org.eclipse.persistence', name: 'org.eclipse.persistence.moxy', version: '2.7.7'
xjc group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.36'
api group: 'org.jvnet.jaxb2_commons', name: 'jaxb2-basics-runtime', version: '0.13.1'
api group: 'jakarta.xml.bind', name: 'jakarta.xml.bind-api', version: '2.3.3'
}
ext.xjc = [
destDir: "${projectDir}/src/generated/java",
args: '-disableXmlSecurity -Xfluent-api -Xequals -XhashCode -XtoString'
]
task generateSources {
outputs.dir xjc.destDir
doLast {
file(xjc.destDir).mkdirs()
ant.taskdef(name: 'xjc', classname: 'org.jvnet.jaxb2_commons.xjc.XJC2Task', classpath: configurations.xjc.asPath)
/* The above sets up the task, but the real work of the task should be specified in the subproject using
generateSources.doLast. For example:
generateSources.doLast {
ant.xjc(destdir: xjc.destDir, schema: "${projectDir}/path/to/file.xsd") {
arg(line: xjc.args)
}
}
*/
}
}
compileJava.dependsOn generateSources
sourcesJar.dependsOn generateSources
sourceSets.main.java.srcDirs += xjc.destDir
clean {
delete xjc.destDir
}
}
/* The following configuration section sets up selected subprojects to be published to Maven Central. This requires a
few things:
- You must have an OSSRH Jira account (https://issues.sonatype.org/secure/Signup!default.jspa)
- Your account must have privileges to upload info.cqframework artifacts (https://issues.sonatype.org/browse/OSSRH-15514)
- You must have a gpg key (http://central.sonatype.org/pages/working-with-pgp-signatures.html)
- You must set your account info and GPG key in your user's gradle.properties file. For example:
ossrhUsername=foo
ossrhPassword=b@r
signing.keyId=24875D73
signing.password=secret
signing.secretKeyRingFile=/Users/me/.gnupg/secring.gpg
- If the library version ends with '-SNAPSHOT', it will be deployed to the snapshot repository, else it will be
deployed to the staging repository (which you then must manually release http://central.sonatype.org/pages/releasing-the-deployment.html).
- Repo for snapshots and releases: https://oss.sonatype.org/content/groups/public/info/cqframework/
- Repo for snpashots, releases, and staged releases: https://oss.sonatype.org/content/groups/staging/info/cqframework/
*/
configure(subprojects.findAll {it.name in ['engine', 'engine.fhir', 'engine.jackson', 'engine.jaxb']}) {
java {
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
mavenDeployer(MavenPublication) {
from components.java
pom {
name = project.name
packaging = 'jar'
description = "The ${project.name} library for the Clinical Quality Language Java reference implementation"
url = 'http://cqframework.info'
scm {
connection = 'scm:git:[email protected]:cqframework/clinical_quality_language.git'
developerConnection = 'scm:git:[email protected]:cqframework/clinical_quality_language.git'
url = '[email protected]:cqframework/clinical_quality_language.git'
}
licenses {
license {
name ='The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
name = 'Bryn Rhodes'
}
developer {
name = 'Chris Moesel'
}
developer {
name = 'Rob Dingwell'
}
developer {
name = 'Jason Walonoski'
}
developer {
name = 'Marc Hadley'
}
}
}
}
}
repositories {
maven {
credentials {
username project.hasProperty("ossrhUsername") ? ossrhUsername : ""
password project.hasProperty("ossrhPassword") ? ossrhPassword : ""
}
/* Use these to test locally (but don't forget to comment out others!)
def releasesRepoUrl = "file://${buildDir}/repo"
def snapshotsRepoUrl = "file://${buildDir}/ssRepo"
*/
// change URLs to point to your repos, e.g. http://my.org/repo
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}
}
signing {
sign publishing.publications.mavenDeployer
}
javadoc {
if(JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
}
idea {
project {
languageLevel = JavaVersion.VERSION_11
ipr {
withXml { provider ->
provider.node.component.find { it.@name == 'VcsDirectoryMappings' }.mapping.@vcs = 'Git'
}
whenMerged { project ->
def examples = new org.gradle.plugins.ide.idea.model.Path('file://$PROJECT_DIR$/examples.iml', 'file://$PROJECT_DIR$/examples.iml', '$PROJECT_DIR$/examples.iml')
if ((project.modulePaths.findAll { p -> p.url == examples.url }).empty) project.modulePaths.add(examples)
def grammar = new org.gradle.plugins.ide.idea.model.Path('file://$PROJECT_DIR$/grammar.iml', 'file://$PROJECT_DIR$/grammar.iml', '$PROJECT_DIR$/grammar.iml')
if ((project.modulePaths.findAll { p -> p.url == grammar.url }).empty) project.modulePaths.add(grammar)
def cqllm = new org.gradle.plugins.ide.idea.model.Path('file://$PROJECT_DIR$/cql-lm.iml', 'file://$PROJECT_DIR$/cql-lm.iml', '$PROJECT_DIR$/cql-lm.iml')
if ((project.modulePaths.findAll { p -> p.url == cqllm.url }).empty) project.modulePaths.add(cqllm)
}
}
}
workspace {
iws {
withXml { provider ->
def props = provider.node.component.find { it.@name == 'PropertiesComponent' }
def propMap = [
'$PROJECT_DIR$/../grammar/cql.g4::/output-dir' : '$PROJECT_DIR$/cql/src/generated/java',
'$PROJECT_DIR$/../grammar/cql.g4::/lib-dir' : '$PROJECT_DIR$/../grammar',
'$PROJECT_DIR$/../grammar/cql.g4::/package' : 'org.cqframework.cql.gen',
'$PROJECT_DIR$/../grammar/cql.g4::/gen-listener' : 'true',
'$PROJECT_DIR$/../grammar/cql.g4::/gen-visitor' : 'true'
]
propMap.each() { key, value ->
if (! props.property.find { it.@name == key })
props.appendNode('property', ['name' : key, 'value' : value])
}
}
}
}
}