-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle.kts
146 lines (135 loc) · 4.25 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
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree
plugins {
kotlin("multiplatform")
kotlin("native.cocoapods")
id("com.android.library")
id("kotlin-parcelize")
id("maven-publish")
signing
}
version = "1.2.12"
group = "com.ctrip.flight.mmkv"
val mmkvVersion = "1.3.5"
kotlin {
androidTarget {
publishLibraryVariants("release")
@OptIn(ExperimentalKotlinGradlePluginApi::class)
instrumentedTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
}
iosX64()
iosArm64()
iosSimulatorArm64()
macosX64()
macosArm64()
targets.configureEach {
compilations.configureEach {
compilerOptions.configure {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
}
cocoapods {
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
ios.deploymentTarget = "17.4.1"
osx.deploymentTarget = "14.2.1"
framework {
baseName = "MMKV-Kotlin"
isStatic = true
}
pod(
name = "MMKV",
version = mmkvVersion,
)
}
sourceSets {
all {
languageSettings.optIn("kotlin.RequiresOptIn")
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val androidMain by getting {
dependencies {
api("com.tencent:mmkv-static:$mmkvVersion")
}
}
val androidInstrumentedTest by getting {
dependencies {
implementation(kotlin("test-junit"))
implementation("junit:junit:4.13.2")
implementation("androidx.test:core:1.5.0")
implementation("androidx.test:runner:1.5.2")
implementation("androidx.test:rules:1.5.0")
}
}
}
}
android {
namespace = "com.ctrip.flight.mmkv"
compileSdk = 33
defaultConfig {
minSdk = 23
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_17
}
}
val javadocJar: TaskProvider<Jar> by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
}
publishing {
publications.withType<MavenPublication> {
artifact(javadocJar)
with(pom) {
name.set("MMKV-Kotlin")
description.set("MMKV for Kotlin Multiplatform")
url.set("https://github.com/ctripcorp/mmkv-kotlin")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("qiaoyuang")
name.set("Yuang Qiao")
email.set("qiaoyuang2012@gmail.com")
}
}
scm {
url.set("https://github.com/ctripcorp/mmkv-kotlin")
connection.set("scm:git:https://github.com/ctripcorp/mmkv-kotlin.git")
developerConnection.set("scm:git:https://github.com/ctripcorp/mmkv-kotlin.git")
}
}
}
repositories {
maven {
credentials {
val NEXUS_USERNAME: String by project
val NEXUS_PASSWORD: String by project
username = NEXUS_USERNAME
password = NEXUS_PASSWORD
}
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
}
}
signing {
val SIGNING_KEY_ID: String by project
val SIGNING_KEY: String by project
val SIGNING_PASSWORD: String by project
useInMemoryPgpKeys(SIGNING_KEY_ID, SIGNING_KEY, SIGNING_PASSWORD)
sign(publishing.publications)
}
}
// TODO: remove after https://youtrack.jetbrains.com/issue/KT-46466 is fixed
project.tasks.withType(AbstractPublishToMaven::class.java).configureEach {
dependsOn(project.tasks.withType(Sign::class.java))
}