-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
build.gradle.kts
144 lines (122 loc) · 4.74 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
`java-library`
kotlin("jvm") version "1.9.22"
`maven-publish`
signing
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
}
description = "Javalin OpenAPI Parent | Parent"
allprojects {
apply(plugin = "java-library")
apply(plugin = "signing")
apply(plugin = "maven-publish")
group = "io.javalin.community.openapi"
version = "6.3.1-SNAPSHOT"
repositories {
mavenCentral()
maven("https://maven.reposilite.com/snapshots")
}
publishing {
repositories {
maven {
name = "reposilite-repository"
url = uri("https://maven.reposilite.com/${if (version.toString().endsWith("-SNAPSHOT")) "snapshots" else "releases"}")
credentials {
username = getEnvOrProperty("MAVEN_NAME", "mavenUser")
password = getEnvOrProperty("MAVEN_TOKEN", "mavenPassword")
}
}
}
}
afterEvaluate {
description
?.takeIf { it.isNotEmpty() }
?.split("|")
?.let { (projectName, projectDescription) ->
publishing {
publications {
create<MavenPublication>("library") {
pom {
name.set(projectName)
description.set(projectDescription)
url.set("https://github.com/javalin/javalin-openapi")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("dzikoysk")
name.set("dzikoysk")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/javalin/javalin-openapi.git")
developerConnection.set("scm:git:ssh://github.com/javalin/javalin-openapi.git")
url.set("https://github.com/javalin/javalin-openapi.git")
}
}
from(components.getByName("java"))
}
}
}
if (findProperty("signing.keyId").takeIf { it != null && it.toString().trim().isNotEmpty() } != null) {
signing {
sign(publishing.publications.getByName("library"))
}
}
}
}
java {
withJavadocJar()
withSourcesJar()
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "11"
languageVersion = "1.8"
freeCompilerArgs = listOf(
"-Xjvm-default=all", // For generating default methods in interfaces
// "-Xcontext-receivers"
)
}
}
}
subprojects {
apply(plugin = "application")
apply(plugin = "org.jetbrains.kotlin.jvm")
dependencies {
val javalin = "6.3.0"
compileOnly("io.javalin:javalin:$javalin")
testImplementation("io.javalin:javalin:$javalin")
val junit = "5.9.3"
testImplementation("org.junit.jupiter:junit-jupiter-params:$junit")
testImplementation("org.junit.jupiter:junit-jupiter-api:$junit")
testImplementation("org.junit.jupiter:junit-jupiter-engine:$junit")
testImplementation("org.assertj:assertj-core:3.24.2")
testImplementation("net.javacrumbs.json-unit:json-unit-assertj:2.38.0")
testImplementation("com.konghq:unirest-java:3.14.2")
testImplementation("ch.qos.logback:logback-classic:1.4.14")
}
tasks.withType<Test> {
useJUnitPlatform()
}
}
nexusPublishing {
repositories {
sonatype {
username.set(getEnvOrProperty("SONATYPE_USER", "sonatypeUser"))
password.set(getEnvOrProperty("SONATYPE_PASSWORD", "sonatypePassword"))
}
}
}
fun getEnvOrProperty(env: String, property: String): String? =
System.getenv(env) ?: findProperty(property)?.toString()