-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
212 lines (184 loc) · 5.11 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework
plugins {
kotlin("multiplatform") version "1.7.20"
kotlin("native.cocoapods") version "1.7.20"
id("com.android.library")
id("io.github.luca992.multiplatform-swiftpackage") version "2.0.5-arm64"
id("org.jlleitschuh.gradle.ktlint") version "11.0.0"
id("org.jetbrains.kotlinx.kover") version "0.6.1"
`maven-publish`
signing
}
val MODULE_PACKAGE_NAME: String by project
val MODULE_NAME: String by project
val MODULE_VERSION_NUMBER: String by project
group = MODULE_PACKAGE_NAME
version = MODULE_VERSION_NUMBER
repositories {
google()
mavenCentral()
}
kover {
engine.set(kotlinx.kover.api.DefaultIntellijEngine)
verify {
onCheck.set(true)
}
}
kotlin {
android {
publishAllLibraryVariants()
}
js(BOTH) {
browser { }
}
val xcf = XCFramework()
iosSimulatorArm64 {
binaries.framework {
baseName = MODULE_NAME
xcf.add(this)
}
}
ios {
binaries.framework {
baseName = MODULE_NAME
xcf.add(this)
}
}
sourceSets {
val commonMain by getting {
dependencies {
implementation("io.ktor:ktor-utils:2.1.3")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4")
}
}
val jsMain by getting
val jsTest by getting
val iosMain by getting {}
val iosSimulatorArm64Main by getting
iosSimulatorArm64Main.dependsOn(iosMain)
val iosTest by getting
val iosSimulatorArm64Test by getting
iosSimulatorArm64Test.dependsOn(iosTest)
val androidMain by getting {
dependencies {
implementation("net.openid:appauth:0.11.1")
}
}
val androidTest by getting {
dependencies {
implementation("junit:junit:4.13.2")
}
}
}
}
android {
compileSdk = 31
buildToolsVersion = "30.0.3"
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdk = 23
targetSdk = 31
manifestPlaceholders += "appAuthRedirectScheme" to "dev.gitlive"
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
testOptions {
unitTests {
isIncludeAndroidResources = true
}
}
}
kotlin {
cocoapods {
ios.deploymentTarget = "7.0"
framework {
isStatic = true
}
noPodspec()
pod("AppAuth") {
source = git("https://github.com/philet/AppAuth-iOS.git") {
branch = "endsession-request-nullability"
}
}
}
}
multiplatformSwiftPackage {
packageName(MODULE_NAME)
swiftToolsVersion("5.4")
targetPlatforms {
iOS { v("13") }
}
}
ktlint {
version.set("0.43.0")
}
fun SigningExtension.whenRequired(block: () -> Boolean) {
setRequired(block)
}
val javadocJar by tasks.creating(Jar::class) {
archiveClassifier.value("javadoc")
}
publishing {
val OPEN_SOURCE_REPO: String by project
val PUBLISH_NAME: String by project
val PUBLISH_DESCRIPTION: String by project
val PUBLISH_URL: String by project
val POM_DEVELOPER_ID: String by project
val POM_DEVELOPER_NAME: String by project
val POM_DEVELOPER_EMAIL: String by project
val PUBLISH_SCM_URL: String by project
val PUBLISH_SCM_CONNECTION: String by project
val PUBLISH_SCM_DEVELOPERCONNECTION: String by project
repositories {
maven {
url = uri(OPEN_SOURCE_REPO)
credentials {
username = System.getenv("sonatypeUsername")
password = System.getenv("sonatypePassword")
}
}
}
publications.all {
this as MavenPublication
artifact(javadocJar)
pom {
name.set(PUBLISH_NAME)
description.set(PUBLISH_DESCRIPTION)
url.set(PUBLISH_URL)
licenses {
license {
name.set("MIT License")
url.set("http://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set(POM_DEVELOPER_ID)
name.set(POM_DEVELOPER_NAME)
email.set(POM_DEVELOPER_EMAIL)
}
}
scm {
url.set(PUBLISH_SCM_URL)
connection.set(PUBLISH_SCM_CONNECTION)
developerConnection.set(PUBLISH_SCM_DEVELOPERCONNECTION)
}
}
}
}
signing {
whenRequired { gradle.taskGraph.hasTask("publish") }
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications)
}