-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
201 lines (169 loc) · 6.36 KB
/
build.gradle.kts
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
//import org.jetbrains.dokka.Platform
//import java.net.URL
group = System.getenv("DIVI_CLIENT_GROUP")
version = System.getenv("DIVI_CLIENT_VERSION")
object Meta {
val desc = System.getenv("DIVI_CLIENT_DESC")
val repo = System.getenv("DIVI_CLIENT_REPO")
val release = "https://s01.oss.sonatype.org/service/local/"
val snapshot = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
val license = "Apache-2.0"
val license_url = "https://opensource.org/licenses/Apache-2.0"
object Author {
val id = "dluesebrink"
val name = "Dirk Lüsebrink"
val email = "dev@vertama.com"
val organization = "Vertama GmbH"
val organization_url = "https://vertama.com/"
}
val client_dir = System.getenv("DIVI_CLIENT_DIR")
// lifted from generated build script in client_dir
val jakarta_annotation_version = "1.3.5"
}
plugins {
`java-library`
`maven-publish`
signing
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
}
sourceSets {
main {
java {
println("source dir: \"${Meta.client_dir}/src/main/java\"")
srcDir("${Meta.client_dir}/src/main/java")
}
}
test {
java {
println("test source dir: \"${Meta.client_dir}/src/test/java\"")
srcDir("${Meta.client_dir}/src/test/java")
}
}
}
repositories {
mavenCentral()
//mavenLocal()
}
// this actually copied from the openapi generated build script in the source dir
dependencies {
implementation("io.swagger:swagger-annotations:1.6.8")
implementation("com.google.code.findbugs:jsr305:3.0.2")
implementation("com.squareup.okhttp3:okhttp:4.10.0")
implementation("com.squareup.okhttp3:logging-interceptor:4.10.0")
implementation("com.google.code.gson:gson:2.9.1")
implementation("io.gsonfire:gson-fire:1.8.5")
implementation("javax.ws.rs:jsr311-api:1.1.1")
implementation("javax.ws.rs:javax.ws.rs-api:2.1.1")
implementation("org.openapitools:jackson-databind-nullable:0.2.6")
//implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
implementation("jakarta.annotation:jakarta.annotation-api:${Meta.jakarta_annotation_version}")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.1")
testImplementation("org.mockito:mockito-core:3.12.4")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.1")
// Use JUnit Jupiter for testing.
testImplementation("org.junit.jupiter:junit-jupiter:5.9.3")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
// This dependency is exported to consumers, that is to say found on their compile classpath.
api("org.apache.commons:commons-math3:3.6.1")
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation("com.google.guava:guava:32.1.1-jre")
}
// Apply a specific Java toolchain to ease working on different environments.
java {
withJavadocJar()
withSourcesJar()
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
tasks.named<Test>("test") {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}
tasks.javadoc {
if (JavaVersion.current().isJava9Compatible) {
//(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
}
// ported from generated build.gradle:
// options.tags = [ "http.response.details:a:Http Response Details" ]
//
// fixing:
// ./openapi-generator-cli-generated/src/main/java/de/vertama/divi/client/api/MeldebereichPublicControllerApi.java:199:
// error: unknown tag: http.response.details
// * @http.response.details
//
(options as StandardJavadocDocletOptions).tags("http.response.details:a:Http Response Details")
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
pom {
name.set(project.name)
description.set(Meta.desc)
url.set(Meta.repo)
licenses {
license {
name.set(Meta.license)
url.set(Meta.license_url)
}
}
developers {
developer {
id.set(Meta.Author.id)
name.set(Meta.Author.name)
email.set(Meta.Author.email)
organization.set(Meta.Author.organization)
organizationUrl.set(Meta.Author.organization_url)
}
}
scm {
connection.set(Meta.repo)
developerConnection.set(Meta.repo)
url.set(Meta.repo)
}
}
}
}
}
signing {
val key = System.getenv("GPG_SIGNING_KEY")
if (key == null) {
throw GradleException(" ** GPG_SIGNING_KEY a/o GPG_SIGNING_PASSPHRASE env vars missing")
}
val phrase = System.getenv("GPG_SIGNING_PASSPHRASE")
if (phrase == null) {
throw GradleException(" ** GPG_SIGNING_KEY a/o GPG_SIGNING_PASSPHRASE env vars missing")
}
useInMemoryPgpKeys(key, phrase)
val extension = extensions.getByName("publishing") as PublishingExtension
sign(extension.publications)
//sign(publishing.publications["mavenJava"])
}
nexusPublishing {
repositories {
//create("myNexus") {
sonatype {
nexusUrl.set(uri(Meta.release))
snapshotRepositoryUrl.set(uri(Meta.snapshot))
val ossrhUsername = System.getenv("OSSRH_USERNAME")
val ossrhPassword = System.getenv("OSSRH_PASSWORD")
if (ossrhUsername == null || ossrhPassword == null) {
throw GradleException(" ** username, password must be defined in ENV as: 'OSSRH_USERNAME' and 'OSSRH_PASSWORD'")
}
username.set(ossrhUsername)
password.set(ossrhPassword)
}
}
}