-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
121 lines (104 loc) · 3.26 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
@file:Suppress("UnstableApiUsage")
import java.util.Properties
plugins {
`java-gradle-plugin`
alias(libs.plugins.kotlin.jvm)
`maven-publish`
signing
}
group = "com.rickclephas.kmp"
version = "0.2.0"
kotlin {
explicitApi()
jvmToolchain(11)
}
java {
withJavadocJar()
withSourcesJar()
}
gradlePlugin {
website = "https://github.com/rickclephas/kotlin-docc"
vcsUrl = "https://github.com/rickclephas/kotlin-docc"
plugins {
create("kotlin-docc") {
id = "com.rickclephas.kmp.docc"
displayName = "kotlin-docc"
description = "Swift DocC documentation for Kotlin Multiplatform frameworks"
implementationClass = "com.rickclephas.kmp.docc.KotlinDocCPlugin"
tags = listOf("kotlin", "swift", "documentation")
}
}
}
repositories {
mavenCentral()
}
dependencies {
implementation(libs.kotlin.gradle.plugin)
testImplementation(kotlin("test"))
}
//region Publishing
ext["signing.keyId"] = null
ext["signing.password"] = null
ext["signing.secretKey"] = null
ext["signing.secretKeyRingFile"] = null
ext["ossrhUsername"] = null
ext["ossrhPassword"] = null
val localPropsFile = project.rootProject.file("local.properties")
if (localPropsFile.exists()) {
localPropsFile.reader()
.use { Properties().apply { load(it) } }
.onEach { (name, value) -> ext[name.toString()] = value }
} else {
ext["signing.keyId"] = System.getenv("SIGNING_KEY_ID")
ext["signing.password"] = System.getenv("SIGNING_PASSWORD")
ext["signing.secretKey"] = System.getenv("SIGNING_SECRET_KEY")
ext["signing.secretKeyRingFile"] = System.getenv("SIGNING_SECRET_KEY_RING_FILE")
ext["ossrhUsername"] = System.getenv("OSSRH_USERNAME")
ext["ossrhPassword"] = System.getenv("OSSRH_PASSWORD")
}
fun getExtraString(name: String) = ext[name]?.toString()
val signPublications = getExtraString("signing.keyId") != null
publishing {
repositories {
maven {
name = "sonatype"
setUrl("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = getExtraString("ossrhUsername")
password = getExtraString("ossrhPassword")
}
}
}
publications.withType<MavenPublication> {
if (signPublications) signing.sign(this)
pom {
name = "kotlin-docc"
description = "Swift DocC documentation for Kotlin Multiplatform frameworks"
url = "https://github.com/rickclephas/kotlin-docc"
licenses {
license {
name = "MIT"
url = "https://opensource.org/licenses/MIT"
}
}
developers {
developer {
id = "rickclephas"
name = "Rick Clephas"
email = "[email protected]"
}
}
scm {
url = "https://github.com/rickclephas/kotlin-docc"
}
}
}
}
if (signPublications) {
signing {
getExtraString("signing.secretKey")?.let { secretKey ->
useInMemoryPgpKeys(getExtraString("signing.keyId"), secretKey, getExtraString("signing.password"))
}
}
}
//endregion