Skip to content

Commit 12af86d

Browse files
committed
migrated build to kotlinscript
1 parent f72f8c8 commit 12af86d

File tree

5 files changed

+190
-186
lines changed

5 files changed

+190
-186
lines changed
File renamed without changes.

client/build.gradle

Lines changed: 0 additions & 185 deletions
This file was deleted.

client/build.gradle.kts

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
import java.net.URI
2+
import java.util.Properties
3+
4+
plugins {
5+
id("java-library")
6+
id("maven-publish")
7+
id("signing")
8+
id("org.openapi.generator") version "7.5.0"
9+
id("org.kordamp.gradle.jandex") version "2.0.0"
10+
}
11+
12+
version = "1.5.0"
13+
14+
dependencies {
15+
implementation("jakarta.annotation:jakarta.annotation-api:3.0.0")
16+
implementation("com.google.code.findbugs:jsr305:3.0.2")
17+
implementation("com.fasterxml.jackson.core:jackson-core:2.17.1")
18+
implementation("com.fasterxml.jackson.core:jackson-annotations:2.17.1")
19+
implementation("com.fasterxml.jackson.core:jackson-databind:2.17.1")
20+
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.1")
21+
implementation("org.openapitools:jackson-databind-nullable:0.2.6")
22+
implementation("io.mikael:urlbuilder:2.0.9")
23+
24+
testImplementation("org.wiremock:wiremock:3.5.4")
25+
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.2")
26+
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.2")
27+
}
28+
29+
java {
30+
toolchain {
31+
languageVersion = JavaLanguageVersion.of(11)
32+
}
33+
34+
withJavadocJar()
35+
withSourcesJar()
36+
}
37+
38+
tasks.named<Test>("test") {
39+
useJUnitPlatform()
40+
}
41+
42+
tasks.named<Javadoc>("javadoc") {
43+
options {
44+
encoding = "UTF-8"
45+
}
46+
}
47+
48+
tasks.compileJava {
49+
options.encoding = "UTF-8"
50+
}
51+
52+
sourceSets {
53+
main {
54+
java {
55+
srcDir("$buildDir/generated/sources/openapi/src/main/java")
56+
}
57+
}
58+
}
59+
60+
tasks.named<Jar>("jar") {
61+
manifest {
62+
attributes(
63+
"Implementation-Title" to "APIstax Java Client",
64+
"Implementation-Vendor" to "instant:solutions OG",
65+
"Implementation-URL" to "https://apistax.io",
66+
"Bundle-License" to "https://raw.githubusercontent.com/APIstax/client-java/main/LICENSE",
67+
"Scm-Connection" to "scm:git:github.com/apistax/client-java.git",
68+
"Scm-Url" to "https://github.com/apistax/client-java",
69+
"Build-Jdk-Spec" to java.toolchain.languageVersion.get().asInt()
70+
)
71+
}
72+
}
73+
74+
openApiGenerate {
75+
generatorName = "java"
76+
inputSpec = "$projectDir/api.yml"
77+
outputDir = "$buildDir/generated/sources/openapi"
78+
packageName = "io.apistax"
79+
modelPackage = "io.apistax.models"
80+
apiPackage = "io.apistax.apis"
81+
library = "native"
82+
83+
globalProperties = mapOf(
84+
"apis" to "false",
85+
"models" to "",
86+
"modelDocs" to "false",
87+
"modelTests" to "false",
88+
"supportingFiles" to "false"
89+
)
90+
91+
configOptions = mapOf(
92+
"dateLibrary" to "java8",
93+
"useRuntimeException" to "true",
94+
"useJakartaEe" to "true"
95+
)
96+
}
97+
98+
val properties = Properties().apply {
99+
if (System.getenv().containsKey("OSSRH_USERNAME")) {
100+
put("ossrhUsername", System.getenv("OSSRH_USERNAME"))
101+
put("ossrhPassword", System.getenv("OSSRH_PASSWORD"))
102+
} else {
103+
load(project.rootProject.file("local.properties").inputStream())
104+
}
105+
}
106+
107+
publishing {
108+
publications {
109+
create<MavenPublication>("apistax") {
110+
groupId = "io.apistax"
111+
artifactId = "apistax-client"
112+
from(components["java"])
113+
114+
pom {
115+
name = "apistax-client"
116+
description = "Secure and reliable APIs for your common business needs."
117+
url = "https://apistax.io/"
118+
inceptionYear = "2022"
119+
120+
licenses {
121+
license {
122+
name = "Apache License 2.0"
123+
url = "https://raw.githubusercontent.com/APIstax/client-java/main/LICENSE"
124+
}
125+
}
126+
127+
organization {
128+
name = "instant:solutions OG"
129+
url = "https://instant-it.at/"
130+
}
131+
132+
developers {
133+
developer {
134+
id = "holzleitner"
135+
name = "Max Holzleitner"
136+
email = "max.holzleitner@instant-it.at"
137+
organization = "instant:solutions OG"
138+
organizationUrl = "https://instant-it.at/"
139+
timezone = "Europe/Vienna"
140+
}
141+
142+
developer {
143+
id = "andlinger"
144+
name = "David Andlinger"
145+
email = "david.andlinger@instant-it.at"
146+
organization = "instant:solutions OG"
147+
organizationUrl = "https://instant-it.at/"
148+
timezone = "Europe/Vienna"
149+
}
150+
}
151+
152+
scm {
153+
connection = "scm:git:github.com/apistax/client-java.git"
154+
developerConnection = "scm:git:github.com/apistax/client-java.git"
155+
url = "https://github.com/apistax/client-java"
156+
}
157+
}
158+
}
159+
}
160+
161+
repositories {
162+
maven {
163+
name = "ossrh"
164+
url = URI("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
165+
credentials {
166+
username = properties.getProperty("ossrhUsername")
167+
password = properties.getProperty("ossrhPassword")
168+
}
169+
}
170+
171+
maven {
172+
name = "ossrhSnapshot"
173+
url = URI("https://s01.oss.sonatype.org/content/repositories/snapshots/")
174+
credentials {
175+
username = properties.getProperty("ossrhUsername")
176+
password = properties.getProperty("ossrhPassword")
177+
}
178+
}
179+
}
180+
}
181+
182+
signing {
183+
sign(publishing.publications["apistax"])
184+
}
185+
186+
tasks["compileJava"].setDependsOn(listOf(tasks["openApiGenerate"]))
187+
tasks["sourcesJar"].setDependsOn(listOf(tasks["openApiGenerate"]))
188+
tasks["compileTestJava"].setDependsOn(listOf(tasks["jandex"]))
189+
tasks["javadoc"].setDependsOn(listOf(tasks["jandex"]))

settings.gradle

Lines changed: 0 additions & 1 deletion
This file was deleted.

settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include(":client")

0 commit comments

Comments
 (0)