-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
172 lines (157 loc) · 5.52 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
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
plugins {
kotlin("multiplatform") version "1.9.21"
id("com.android.library") version "8.1.4"
kotlin("plugin.serialization") version "1.9.21"
id("maven-publish")
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
signing
}
group = "software.momento.kotlin"
// x-release-please-start-version
version = "0.3.0"
// x-release-please-end
repositories {
mavenCentral()
google()
}
android {
namespace = "software.momento.kotlin.sdk"
compileSdk = 34
defaultConfig {
minSdk = 23
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments["MomentoApiKey"] = System.getenv("MOMENTO_API_KEY") ?: "noApiKeySet"
testInstrumentationRunnerArguments["TestCacheName"] = System.getenv("TEST_CACHE_NAME") ?: "test-android-cache"
}
testOptions {
unitTests {
isIncludeAndroidResources = true
}
}
}
kotlin {
explicitApi()
androidTarget {
publishLibraryVariants("release")
}
jvm()
jvmToolchain(11)
sourceSets {
val commonMain by getting {
dependencies {
implementation(kotlin("stdlib"))
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
implementation("io.grpc:grpc-api:1.57.2")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-junit"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
}
}
val jvmMain by getting {
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("software.momento.kotlin:client-protos-jvm:0.119.2")
runtimeOnly("io.grpc:grpc-netty:1.57.2")
}
}
val jvmTest by getting {
dependencies {
implementation(kotlin("test-junit"))
}
}
val androidMain by getting {
dependencies {
implementation("software.momento.kotlin:client-protos-android:0.119.2")
runtimeOnly("io.grpc:grpc-okhttp:1.57.2")
}
}
val androidUnitTest by getting {
dependencies {
implementation(kotlin("test-junit"))
implementation("org.robolectric:robolectric:4.11.1")
}
}
val androidInstrumentedTest by getting {
dependencies {
implementation(kotlin("test-junit"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
implementation("androidx.test.ext:junit:1.2.1")
implementation("androidx.test.espresso:espresso-core:3.6.1")
}
}
}
targets.forEach {
it.compilations.all {
kotlinOptions {
freeCompilerArgs += "-Xexpect-actual-classes"
}
}
}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
compilerOptions.apiVersion.set(KotlinVersion.KOTLIN_1_6)
compilerOptions.languageVersion.set(KotlinVersion.KOTLIN_1_6)
}
val javadocJar = tasks.register("javadocJar", Jar::class.java) {
archiveClassifier.set("javadoc")
}
publishing {
publications {
withType<MavenPublication> {
artifact(javadocJar)
pom {
name.set("Momento Kotlin SDK")
description.set("Kotlin client SDK for Momento Serverless Cache")
url.set("https://github.com/momentohq/client-sdk-kotlin")
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("momento")
name.set("Momento")
organization.set("Momento")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/momentohq/client-sdk-kotlin.git")
developerConnection.set("scm:git:[email protected]:momentohq/client-sdk-kotlin.git")
url.set("https://github.com/momentohq/client-sdk-kotlin")
}
}
}
}
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(System.getenv("SONATYPE_USERNAME"))
password.set(System.getenv("SONATYPE_PASSWORD"))
}
}
}
// Sign only if we have a key to do so
val signingKey: String? = System.getenv("SONATYPE_SIGNING_KEY")
if (signingKey != null) {
signing {
useInMemoryPgpKeys(signingKey, System.getenv("SONATYPE_SIGNING_KEY_PASSWORD"))
sign(publishing.publications)
}
}
// Fix Gradle error about signing tasks using publishing task outputs without explicit dependencies
// https://github.com/gradle/gradle/issues/26091
tasks.withType<AbstractPublishToMaven>().configureEach {
val signingTasks = tasks.withType<Sign>()
mustRunAfter(signingTasks)
}