-
Notifications
You must be signed in to change notification settings - Fork 261
/
build.gradle
316 lines (290 loc) · 11.8 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
/*
* SPDX-License-Identifier: Apache-2.0
* Copyright Contributors to the ODPi Egeria project.
*/
/*
* Plugins for this parent module only - so just high level project related
* Plugin management - ie version specs - are in settings.gradle
*/
plugins {
id "io.freefair.aggregate-javadoc"
id "io.freefair.lombok"
// Checks for unnecessary dependencies
id 'com.autonomousapps.dependency-analysis'
// helps resolve log implementation clashes
id 'dev.jacomet.logging-capabilities'
// This plugin helps resolve jakarta/javax dev.jacomet.logging-capabilities
id 'org.gradlex.java-ecosystem-capabilities'
id 'checkstyle'
}
/*
* See pom/build.gradle for the Egeria BOM - including specification of dependency constraints and versions
* This has MOVED from this top level project
*/
/*
* Configuration for all projects - INCLUDING this one
*/
allprojects {
group = 'org.odpi.egeria'
version = '5.2-SNAPSHOT'
// Signing/publish used in parent & child projects
apply plugin: 'maven-publish'
apply plugin: 'signing'
// Only use maven central
repositories {
mavenCentral()
// used by tink (encrypted filestore connector)
google()
}
} // end of allProjects
/*
* Configuration for sub projects only
*/
subprojects {
// TODO: Consider using convention plugins to stylise different profiles of subprojects
// The 'bom' project is a special case - we must not apply anything else to it
if (project.name != 'bom' && project.buildFile.exists()) {
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
//apply plugin: 'io.freefair.lombok'
apply plugin: 'com.autonomousapps.dependency-analysis'
apply plugin: 'dev.jacomet.logging-capabilities'
apply plugin: 'org.gradlex.java-ecosystem-capabilities'
// Consistent dependencies, and exceptions
dependencies {
implementation platform(project(":bom"))
// Some nasty clashes we want to avoid (consumers will need to make their own arrangements
modules {
module('org.glassfish:jakarta.json') {
replacedBy 'jakarta.json:jakarta.json-api', 'use jakarta.json.api instead of glassfish'
}
}
}
// we already have bridge modules that implement commons logging, so cannot have another implementation in classpath
// we also want to avoid the glassfish implementation of jakarta.json (if we have to, will replace as above)
configurations {
all {
exclude module: 'commons-logging'
exclude module: 'org.glassfish:jakarta.json'
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
}
// Maven publishing (to public repo) requires we included source and javadoc jars
java {
withSourcesJar()
withJavadocJar()
}
// compile flags
tasks.withType(JavaCompile) {
options.release = 17
options.encoding = 'UTF-8'
options.incremental = true
options.failOnError = true
options.compilerArgs << "-Xlint:all" << "-Xmaxerrs" << "1000" << "-Xmaxwarns" << "1000"
}
tasks.withType(Javadoc).configureEach {
options.addStringOption('Xdoclint:-missing', '-quiet')
}
// javadoc
javadoc {
options
{
addBooleanOption('html5', true)
setMemberLevel JavadocMemberLevel.PUBLIC
}
}
publishing {
{
publications {
mavenmodule(MavenPublication) {
from components.java
pom {
url = 'http://egeria.odpi.org'
licenses {
// Code
license {
name = 'The Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
// Docs
license {
name = 'Creative Commons Attribution 4.0 International (CC BY 4.0)'
url = 'https://creativecommons.org/licenses/by/4.0'
}
}
developers {
developer {
id = 'mandy-chessell'
name = 'Mandy Chessell'
email = 'mandy.e.chessell@gmail.com'
timezone = 'Europe/London'
roles = ['Project Leader']
organization = 'Pragmatic Data Research Ltd'
}
developer {
id = 'planetf1'
name = 'Nigel Jones'
email = 'nigel.l.jones+git@gmail.com'
roles = ['maintainer']
organization = 'IBM Corporation'
}
}
scm {
connection = 'scm:git:git://github.com/odpi/egeria.git'
developerConnection = 'scm:git:ssh://github.com/odpi/egeria/egeria.git'
url = 'https://github.com/odpi/egeria'
}
organization {
name = 'LF AI & Data Foundation'
url = 'https://lfaidata.foundation'
}
issueManagement {
system = 'GitHub'
url = 'https://github.com/odpi/egeria/issues'
}
inceptionYear = '2018'
mailingLists {
mailingList {
name = 'Egeria mailing list'
subscribe = 'egeria-technical-discuss+subscribe@lists.lfaidata.foundation'
unsubscribe = 'egeria-technical-discuss+unsubscribe@lists.lfaidata.foundation'
post = 'egeria-technical-discuss@lists.lfaidata.foundation'
archive = 'https://lists.lfaidata.foundation/g/egeria-technical-discuss/topics'
}
}
}
// Override the project name & description for the pom based on properties set in the child build.gradle (hard to default & required for maven central)
pom.withXml {
asNode().appendNode('name', "${project.name}")
asNode().appendNode('description', "${project.description}")
}
}
}
}
}
if (System.getenv("CI")) {
apply plugin: 'signing'
signing {
// gpg --export-secret-keys myemal@gmail.com | base64
def signingKey = System.getenv('OSSRH_GPG_PRIVATE_KEY')
// Passphrase for key
def signingPassword = System.getenv('OSSRH_GPG_PASSPHRASE')
// public key id (last 8 characters only) - note keys also need uploading to all the main registries
def signingKeyId = System.getenv('OSSRH_GPG_KEYID')
// We use these values from secrets rather than gradle.properties
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign publishing.publications.mavenmodule
}
}
}
// Always need these repos
publishing {
// Release versions get pushed to staging area on maven central, snapshots to snapshot repo
// Secrets for credentials
repositories {
maven {
name = mavenRepoName
url = mavenRepoUrl
// User token (under profile) on oss.sonatype.org
credentials {
username = mavenRepoUser
password = mavenRepoPass
}
}
}
}
// shorthand for checking dependencies
task printAllDependencies(type: DependencyReportTask) {}
task printSubDependencies(type: DependencyReportTask) {}
task findDependency(type: DependencyInsightReportTask) {}
// Checking of javaheaders for license & copyright
checkstyle {
toolVersion = '10.7.0'
showViolations = true
}
}
/*
* Additional aggregate tasks run only at parent
*/
// Whilst all modules have their own javadoc, we only build
// an aggregate for the client and API modules plus the REST calls
apply plugin: 'java'
javadoc {
include("**/api/*.java")
include("**/client/*.java")
include("**/clients/*.java")
include("**/properties/*.java")
include("**/metadataelements/*.java")
include("**/metadataelement/*.java")
include("**/events/*.java")
include("**/rest/*.java")
include("**/exceptions/*.java")
include("**/beans/*.java")
include("**/ffdc/*.java")
include("**/configuration/*.java")
include("**/configuration/registration/*.java")
include("**/store/*.java")
include("**/connectors/*.java")
include("**/adminservices/*.java")
include("**/connector/*.java")
include("**/frameworks/*.java")
include("**/context/*.java")
include("**/contextmanager/*.java")
include("**/graph/*.java")
include("**/model/*.java")
include("**/ffdc/*.java")
include("**/omrstopic/*.java")
include("**/openmetadatatopic/*.java")
include("**/archivestore/*.java")
include("**/auditlogstore/*.java")
include("**/cohortregistrystore/*.java")
include("**/repositoryconnector/*.java")
include("**/repositoryeventmapper/*.java")
include("**/metadatacollectionstore/*.java")
include("**/metadatacollectionstore/properties/instances/*.java")
include("**/metadatacollectionstore/properties/typedefs/*.java")
include("**/metadatacollectionstore/properties/search/*.java")
include("**/metadatacollectionstore/utilities/*.java")
include("**/archiveutilities/*.java")
include("**/metadatasecurity/*.java")
include("**/spring/*.java")
include("**/frameworks/**/*.java")
}
// Jacoco reporting -- from gradle docs
task codeCoverageReport(type: JacocoReport) {
// Gather execution data from all subprojects
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
// Add all relevant sourcesets from the subprojects
subprojects.each {
if (it.name != 'bom') {
sourceSets it.sourceSets.main
}
}
// enable the different report types (html, xml, csv)
reports {
// xml is usually used to integrate code coverage with
// other tools like SonarQube, Coveralls or Codecov
xml.required = true
// HTML reports can be used to see code coverage
// without any external tools
html.required = true
csv.required = true
}
}
// always run the tests before generating the report
codeCoverageReport.dependsOn {
subprojects*.test
}
// Dependency checking - see https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin
dependencyAnalysis {
issues {
all {
onAny {
severity('fail')
}
}
}
}
// Always run dependency check for every regular build
build.dependsOn("buildHealth")