-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
45 lines (41 loc) · 1.8 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
plugins {
// trick: for the same plugin versions in all sub-modules
alias(libs.plugins.androidLibrary).apply(false)
alias(libs.plugins.kotlinMultiplatform).apply(false)
alias(libs.plugins.kotlinSerialization).apply(false)
}
fun gradlePropertyOrEnvironmentVariable(name: String) = (project.findProperty(name) ?: System.getenv(name)) as? String
val signingKeyAsciiArmored = gradlePropertyOrEnvironmentVariable("SIGNING_KEY")
val signingKeyPassword = gradlePropertyOrEnvironmentVariable("SIGNING_PASSWORD")
if (signingKeyAsciiArmored != null) {
subprojects {
plugins.withType<SigningPlugin> {
configure<SigningExtension> {
useInMemoryPgpKeys(signingKeyAsciiArmored, signingKeyPassword)
sign(extensions.getByType<PublishingExtension>().publications)
}
}
}
}
val sonatypeUsername = gradlePropertyOrEnvironmentVariable("SONATYPE_USERNAME")
val sonatypePassword = gradlePropertyOrEnvironmentVariable("SONATYPE_PASSWORD")
if (sonatypeUsername != null) {
subprojects {
plugins.withType<MavenPublishPlugin> {
configure<PublishingExtension> {
repositories {
maven {
name = "oss"
val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
url = if (version.toString().endsWith("-SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
credentials {
username = sonatypeUsername
password = sonatypePassword
}
}
}
}
}
}
}