generated from odpi/egeria-template-newrepo
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
223 lines (197 loc) · 7.93 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
/*
* SPDX-License-Identifier: Apache-2.0
* Copyright Contributors to the Egeria project.
*/
plugins {
id 'java-library'
id "com.github.johnrengelman.shadow" version "8.1.1"
id 'idea'
id 'maven-publish'
// Checks for unnecessary dependencies
id 'com.autonomousapps.dependency-analysis' version "1.19.0"
// helps resolve log implementation clashes
id 'dev.jacomet.logging-capabilities' version "0.11.0"
// This plugin helps resolve jakarta/javax dev.jacomet.logging-capabilities
id 'org.gradlex.java-ecosystem-capabilities' version "1.3.1"
}
// Mostly java, so default to this for now
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'jacoco'
apply plugin: 'org.gradlex.java-ecosystem-capabilities'
// temp disabled due to k/wrapp
// 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'
if (System.getenv("CI")) {
apply plugin: 'signing'
}
if (System.getenv("CUSTOM_REPOSITORIES")) {
logger.info("Custom repositories found!")
// TODO: Check if the env is split correctly with ";"
System.getenv("CUSTOM_REPOSITORIES").split(";").each {
logger.info("Adding custom repository: " + it.toString())
project.repositories.maven { repo ->
repo.url = uri(it.toString()) }
}
}
repositories {
mavenCentral()
maven { url("https://oss.sonatype.org/content/repositories/snapshots") }
}
// ensures we pick up the very latest snapshots when built
configurations.all {
// check for updates every build
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
// TODO: Specify group, name, description, version of new code being built
group = 'org.odpi.egeria'
version = '1.0-SNAPSHOT'
// ext.name = 'egeria-connector-integration-event-schema'
description = 'Egeria integration connector for Confluent (c) Schema Registry.'
// TODO: Specify Dependency versions as variables
ext {
egeriaVersion = '4.1'
httpClient5Version = '5.2.1'
gsonVersion = '2.10.1'
}
// For a single module, add here. For multiple modules, refactor and use constraints (see main egeria build.gradle for an example)
// TODO: Update dependencies for this module
dependencies {
implementation platform("org.odpi.egeria:egeria:${egeriaVersion}")
implementation "org.odpi.egeria:open-connector-framework"
implementation "org.odpi.egeria:repository-services-apis"
implementation "org.odpi.egeria:data-manager-api"
implementation "org.odpi.egeria:open-integration-framework"
implementation "org.odpi.egeria:topic-integrator-api"
implementation "org.odpi.egeria:audit-log-framework"
implementation "com.google.code.gson:gson:${gsonVersion}"
implementation "org.apache.httpcomponents.client5:httpclient5:${httpClient5Version}"
compileOnly "org.springframework:spring-web"
compileOnly "org.apache.commons:commons-lang3"
// Only needed to compile test code
testCompileOnly "org.junit.jupiter:junit-jupiter-api"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
testImplementation "org.mockito:mockito-junit-jupiter"
testImplementation "org.odpi.egeria:connector-configuration-factory"
testImplementation "org.odpi.egeria:fvt-utilities"
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
reports {
html.required = true
}
filter {
includeTestsMatching "*Test"
}
}
// Maven Central (technically sonatype oss) requires we distribute source and javadoc.
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withJavadocJar()
withSourcesJar()
}
// More Java language settings
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
sourceCompatibility = "17"
targetCompatibility = "17"
options.incremental = true
options.fork = true
options.failOnError = true
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
}
// For later java versions this is recommended - keep conditional in case we want to build on 8
javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
// We will typically build an uber jar with dependencies. Can change name here.
shadowJar {
archiveClassifier = 'jar-with-dependencies'
}
// We want to built a jar with dependencies in a normal build, so to avoid specifying task explicitly
build.dependsOn shadowJar
// We only have a single artifact for now - this additional metadata is
// required for publishing to maven central. Only doing signing in 'CI'
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 = 'juergenhemelt'
name = 'Juergen Hemelt'
email = '[email protected]'
}
developer {
id = 'planetf1'
name = 'Nigel Jones'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com/odpi/egeria-connection-integration-event-schema.git'
developerConnection = 'scm:git:ssh://github.com/odpi/egeria-connection-integration-event-schema.git'
url = 'http://github.com/odpi/egeria-connection-integration-event-schema/'
}
}
// 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.ext.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")
}
}
}
}
}
// To publish to ossrh we need to sign the artifacts - only in CI
if (System.getenv("CI")) {
signing {
// This is the publication to sign
sign publishing.publications.connector
// gpg --export-secret-keys [email protected] | 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)
}
}