|
1 | | -import java.util.Properties |
2 | | -import org.gradle.api.publish.maven.MavenPublication |
3 | | -import org.gradle.api.tasks.bundling.Jar |
4 | 1 | import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType |
5 | 2 |
|
6 | 3 | plugins { |
7 | 4 | kotlin("multiplatform") version "1.8.0" |
8 | | - id("maven-publish") |
9 | | - id("signing") |
| 5 | + id("com.vanniktech.maven.publish") version "0.23.2" |
10 | 6 | } |
11 | 7 |
|
12 | | -group = "de.cketti.unicode" |
13 | | -version = "0.1.0" |
14 | | - |
15 | 8 | repositories { |
16 | 9 | mavenCentral() |
17 | 10 | } |
@@ -86,83 +79,3 @@ kotlin { |
86 | 79 | } |
87 | 80 | } |
88 | 81 | } |
89 | | - |
90 | | -// Stub secrets to let the project sync and build without the publication values set up |
91 | | -ext["signing.keyId"] = null |
92 | | -ext["signing.password"] = null |
93 | | -ext["signing.secretKeyRingFile"] = null |
94 | | -ext["ossrhUsername"] = null |
95 | | -ext["ossrhPassword"] = null |
96 | | - |
97 | | -// Grabbing secrets from local.properties file or from environment variables, which could be used on CI |
98 | | -val secretPropsFile = project.rootProject.file("local.properties") |
99 | | -if (secretPropsFile.exists()) { |
100 | | - secretPropsFile.reader().use { |
101 | | - Properties().apply { |
102 | | - load(it) |
103 | | - } |
104 | | - }.onEach { (name, value) -> |
105 | | - ext[name.toString()] = value |
106 | | - } |
107 | | -} else { |
108 | | - ext["signing.keyId"] = System.getenv("SIGNING_KEY_ID") |
109 | | - ext["signing.password"] = System.getenv("SIGNING_PASSWORD") |
110 | | - ext["signing.secretKeyRingFile"] = System.getenv("SIGNING_SECRET_KEY_RING_FILE") |
111 | | - ext["ossrhUsername"] = System.getenv("OSSRH_USERNAME") |
112 | | - ext["ossrhPassword"] = System.getenv("OSSRH_PASSWORD") |
113 | | -} |
114 | | - |
115 | | -val javadocJar by tasks.registering(Jar::class) { |
116 | | - archiveClassifier.set("javadoc") |
117 | | -} |
118 | | - |
119 | | -fun getExtraString(name: String) = ext[name]?.toString() |
120 | | - |
121 | | -publishing { |
122 | | - // Configure maven central repository |
123 | | - repositories { |
124 | | - maven { |
125 | | - name = "sonatype" |
126 | | - setUrl("https://oss.sonatype.org/service/local/staging/deploy/maven2/") |
127 | | - credentials { |
128 | | - username = getExtraString("ossrhUsername") |
129 | | - password = getExtraString("ossrhPassword") |
130 | | - } |
131 | | - } |
132 | | - } |
133 | | - |
134 | | - // Configure all publications |
135 | | - publications.withType<MavenPublication> { |
136 | | - // Stub javadoc.jar artifact |
137 | | - artifact(javadocJar.get()) |
138 | | - |
139 | | - // Provide artifacts information requited by Maven Central |
140 | | - pom { |
141 | | - name.set("kotlin-codepoints") |
142 | | - description.set("Kotlin Multiplatform (KMP) library that adds basic support for Unicode code points.") |
143 | | - url.set("https://github.com/cketti/kotlin-codepoints") |
144 | | - |
145 | | - licenses { |
146 | | - license { |
147 | | - name.set("MIT") |
148 | | - url.set("https://opensource.org/licenses/MIT") |
149 | | - } |
150 | | - } |
151 | | - developers { |
152 | | - developer { |
153 | | - id.set("cketti") |
154 | | - name.set("cketti") |
155 | | - email.set("ck@cketti.de") |
156 | | - } |
157 | | - } |
158 | | - scm { |
159 | | - url.set("https://github.com/cketti/kotlin-codepoints") |
160 | | - } |
161 | | - } |
162 | | - } |
163 | | -} |
164 | | - |
165 | | -// Signing artifacts. Signing.* extra properties values will be used |
166 | | -signing { |
167 | | - sign(publishing.publications) |
168 | | -} |
0 commit comments