This repository has been archived by the owner on Jun 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.gradle
282 lines (247 loc) · 9.51 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
/*
* 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
*/
plugins {
id "io.freefair.aggregate-javadoc"
// 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 'com.github.johnrengelman.shadow'
}
/*
* Configuration for all projects - INCLUDING this one
*/
allprojects {
group = 'org.odpi.egeria'
version = '1.1-SNAPSHOT'
}
subprojects {
// Mostly java, so default to this for now
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'org.gradlex.java-ecosystem-capabilities'
apply plugin: 'dev.jacomet.logging-capabilities'
// As we've migrated from maven - we'll assume all submodules publish directly to maven
apply plugin: 'maven-publish'
apply plugin: 'com.github.johnrengelman.shadow'
// Only use maven central and snapshots
repositories {
mavenCentral()
maven { url("https://oss.sonatype.org/content/repositories/snapshots") }
maven { url("https://packages.atlassian.com/maven-3rdparty") }
google()
}
// ensures we pick up the very latest snapshots when built
configurations.all {
// check for updates every build
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
/*
* Dependency Management - to fix versions. Pick up maven build settings for now
*/
// Assign variables for any constraints
ext {
egeriaversion = '4.0'
atlasversion = '2.3.0'
jaxbversion = '2.3.1'
mockserverversion = '5.15.0'
androidxannotationversion = '1.6.0'
}
dependencies {
implementation platform("org.odpi.egeria:egeria:${egeriaversion}")
constraints {
compileOnly "com.fasterxml.jackson.core:jackson-annotations"
compileOnly "com.fasterxml.jackson.core:jackson-core"
compileOnly "com.fasterxml.jackson.core:jackson-databind"
implementation "org.apache.atlas:atlas-common:${atlasversion}"
implementation "org.apache.atlas:atlas-client-v2:${atlasversion}"
implementation "org.apache.atlas:atlas-intg:${atlasversion}"
implementation "org.apache.atlas:atlas-client-common:${atlasversion}"
implementation "org.apache.atlas:atlas-notification:${atlasversion}"
implementation "javax.xml.bind:jaxb-api:${jaxbversion}"
testImplementation "ch.qos.logback:logback-classic"
testImplementation "org.testng:testng"
testImplementation "org.mock-server:mockserver-client-java:${mockserverversion}"
testImplementation "org.mock-server:mockserver-core:${mockserverversion}"
testImplementation "org.odpi.egeria:repository-services-implementation"
testImplementation "org.odpi.egeria:open-metadata-types"
testImplementation "org.odpi.egeria:admin-services-api"
testImplementation "org.odpi.egeria:connector-configuration-factory"
testImplementation "org.odpi.egeria:inmemory-open-metadata-topic-connector"
compileOnly "org.springframework:spring-core"
compileOnly "org.odpi.egeria:audit-log-framework"
compileOnly "org.odpi.egeria:repository-services-apis"
compileOnly "org.odpi.egeria:open-connector-framework"
compileOnly "org.slf4j:slf4j-api"
compileOnly "org.apache.kafka:kafka-clients"
runtimeOnly("org.codehaus.jackson:jackson-mapper-asl")
runtimeOnly("org.codehaus.jackson:jackson-core-asl")
testImplementation("androidx.annotation:annotation:${androidxannotationversion}")
}
}
configurations {
all {
exclude module: 'commons-logging'
exclude group: 'org.slf4j', module: 'slf4j-reload4j'
}
}
/*
* Java related configuration
*/
java {
withSourcesJar()
withJavadocJar()
}
tasks.withType(JavaCompile) {
options.release = 17
options.encoding = 'UTF-8'
options.incremental = true
options.failOnError = true
options.compilerArgs << "-Xlint:all"
}
// javadoc
javadoc {
options.addBooleanOption('html5', true)
}
// code coverage
jacoco {
toolVersion = "0.8.8"
}
// Testing
test {
useJUnitPlatform {
includeEngines 'junit-jupiter'
}
dependencies {
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.3'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.3'
}
testLogging {
events "passed", "skipped", "failed"
}
reports {
html.required = true
}
}
/*
* Publishing of maven artifacts -- and signing (only for CI)
*/
if (System.getenv("CI")) {
apply plugin: 'signing'
}
publishing {
publications {
connector(MavenPublication) {
from components.java
pom {
url = 'http://egeria.odpi.org'
licenses {
// Code
license {
name = 'The Apache License, Version 2.0'
url = 'http://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 = 'planetf1'
name = 'Nigel Jones'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:https://github.com/odpi/egeria-connector-hadoop-ecosystem'
developerConnection = 'scm:git:https://github.com/odpi/egeria-connector-hadoop-ecosystem'
url = 'https://egithub.com/odpi/egeria-connector-hadoop-ecosystem'
}
}
// 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}")
}
}
}
// Release versions get pushed to staging area on maven central, snapshots to snapshot repo
// Secrets for credentials
if (System.getenv("CI")) {
repositories {
maven {
name = 'OSSRH'
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
// User token (under profile) on oss.sonatype.org
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_TOKEN")
}
}
}
}
}
/*
* Additional useful tasks
*/
task printAllDependencies(type: DependencyReportTask) {}
task printSubDependencies(type: DependencyReportTask) {}
task findDependency(type: DependencyInsightReportTask) {}
shadowJar {
archiveClassifier = 'jar-with-dependencies'
}
build.dependsOn("shadowJar")
} // end of subProjects
apply plugin: 'java'
/*
* Additional aggregate tasks run only at parent
*/
// 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 {
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')
}
onUnusedDependencies {
exclude("junit:junit", "org.junit.jupiter:junit-jupiter-api", "org.junit.jupiter:junit-jupiter-engine", "com.fasterxml.jackson.core:jackson-annotations")
}
}
}
}
// Always run dependency check for every regular build
build.dependsOn("buildHealth")