-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle.kts
158 lines (139 loc) · 4.71 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
import org.jetbrains.kotlin.konan.properties.Properties
plugins {
`java-library`
`maven-publish`
signing
id("org.jlleitschuh.gradle.ktlint") version "12.1.1"
id("io.codearte.nexus-staging") version "0.30.0"
id("java-library")
kotlin("jvm") version "1.8.0"
}
group = "co.novu"
version = "1.2.0"
java {
withJavadocJar()
withSourcesJar()
}
repositories {
mavenCentral()
}
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter:5.8.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.1")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4")
testImplementation("com.squareup.okhttp3:mockwebserver:4.10.0")
// Kotlin
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10")
// OkHttp3 and Retrofit2
implementation("com.squareup.okhttp3:logging-interceptor:4.10.0")
implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.squareup.retrofit2:converter-gson:2.9.0")
// Kotlin coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
// Logging
implementation("io.github.microutils:kotlin-logging-jvm:2.1.23")
implementation("org.slf4j:slf4j-api:1.7.36")
implementation("org.slf4j:slf4j-simple:1.7.36")
}
tasks.test {
useJUnitPlatform()
}
kotlin {
jvmToolchain(8)
}
publishing {
repositories {
maven {
name = "OSSRH"
val releaseRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
val snapshotRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = uri(releaseRepoUrl)
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
publications {
create<MavenPublication>("mavenJava") {
artifactId = "novu-kotlin"
from(components["java"])
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
pom {
name.set("Novu Kotlin")
packaging = "jar"
description.set("Kotlin SDK for Novu - The open-source notification infrastructure for developers")
url.set("https://github.com/novuhq/novu-kotlin")
licenses {
license {
name.set("MIT License")
url.set("https://opensource.org/license/mit/")
}
}
developers {
developer {
id.set("crashiv")
name.set("Shivam Shah")
email.set("[email protected]")
}
developer {
id.set("unicodeveloper")
name.set("Prosper Otemuyiwa")
email.set("[email protected]")
}
developer {
id.set("Mayorjay")
name.set("Joseph Olugbohunmi")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/novuhq/novu-kotlin.git")
developerConnection.set("scm:git:ssh://github.com/novuhq/novu-kotlin.git")
url.set("https://github.com/novuhq/novu-kotlin/tree/main")
}
}
}
}
}
signing {
val signingKey = System.getenv("MAVEN_GPG_PRIVATE_KEY")
val signingPassword = System.getenv("MAVEN_GPG_PASSPHRASE")
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications["mavenJava"])
}
tasks.javadoc {
if (JavaVersion.current().isJava8Compatible) {
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
}
}
nexusStaging {
serverUrl = "https://s01.oss.sonatype.org/service/local/"
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
val propsDir = "$buildDir/props"
sourceSets {
main {
kotlin {
output.dir(propsDir)
}
}
}
tasks.register("generateVersionProperty") {
val propertiesFile = file("$propsDir/version.properties")
propertiesFile.parentFile.mkdirs()
val properties = Properties()
properties.setProperty("version", "$version")
propertiesFile.writer().use { properties.store(it, null) }
}
tasks.named("processResources") {
dependsOn("generateVersionProperty")
}