Skip to content

Commit 8a60fcc

Browse files
committed
Simplify Maven publishing config
1 parent 8d3fc2a commit 8a60fcc

1 file changed

Lines changed: 21 additions & 32 deletions

File tree

build.gradle.kts

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ val javacModuleOptions =
6262
val javacTestJvmOptions = javacModuleOptions.map { it.removePrefix("-J") }
6363
val catalog = libs
6464
val protobufVersion = catalog.versions.protobuf.asProvider().get()
65+
val repositoryUrl = "https://github.com/sourcegraph/scip-java"
66+
val signingKey = providers.environmentVariable("PGP_SECRET").map(::decodePgpSecret)
67+
val signingPassword = providers.environmentVariable("PGP_PASSPHRASE")
6568

6669
allprojects {
6770
group = rootProject.group
@@ -107,7 +110,7 @@ subprojects {
107110
}
108111
}
109112

110-
fun Project.configureMavenPublishing(displayName: String, descriptionText: String) {
113+
fun Project.configureMavenPublishing() {
111114
apply(plugin = "maven-publish")
112115
apply(plugin = "signing")
113116

@@ -121,9 +124,9 @@ fun Project.configureMavenPublishing(displayName: String, descriptionText: Strin
121124
create<MavenPublication>("mavenJava") {
122125
from(components["java"])
123126
pom {
124-
name.set(displayName)
125-
description.set(descriptionText)
126-
url.set("https://github.com/sourcegraph/scip-java")
127+
name.set(project.name)
128+
description.set(project.description ?: project.name)
129+
url.set(repositoryUrl)
127130
licenses {
128131
license {
129132
name.set("Apache-2.0")
@@ -137,18 +140,16 @@ fun Project.configureMavenPublishing(displayName: String, descriptionText: Strin
137140
}
138141
}
139142
scm {
140-
connection.set("scm:git:https://github.com/sourcegraph/scip-java.git")
143+
connection.set("scm:git:$repositoryUrl.git")
141144
developerConnection.set("scm:git:ssh://git@github.com/sourcegraph/scip-java.git")
142-
url.set("https://github.com/sourcegraph/scip-java")
145+
url.set(repositoryUrl)
143146
}
144147
}
145148
}
146149
}
147150
}
148151

149152
val publishing = extensions.getByType<PublishingExtension>()
150-
val signingKey = providers.environmentVariable("PGP_SECRET").map(::decodePgpSecret)
151-
val signingPassword = providers.environmentVariable("PGP_PASSPHRASE")
152153
extensions.configure<SigningExtension> {
153154
isRequired = signingKey.isPresent && !project.version.toString().endsWith("SNAPSHOT")
154155
if (signingKey.isPresent) {
@@ -171,20 +172,19 @@ nexusPublishing {
171172

172173
project(":scip-shared") {
173174
apply(plugin = "java-library")
175+
description = "Shared SCIP utilities used by scip-java compiler plugins"
174176

175177
dependencies {
176178
"api"(catalog.scip.java.bindings)
177179
}
178180

179-
configureMavenPublishing(
180-
displayName = "scip-shared",
181-
descriptionText = "Shared SCIP utilities used by scip-java compiler plugins",
182-
)
181+
configureMavenPublishing()
183182
}
184183

185184
project(":scip-javac") {
186185
apply(plugin = "java-library")
187186
apply(plugin = "com.github.johnrengelman.shadow")
187+
description = "A javac plugin to emit SCIP information"
188188

189189
dependencies {
190190
"api"(project(":scip-shared"))
@@ -218,16 +218,14 @@ project(":scip-javac") {
218218
}
219219
}
220220

221-
configureMavenPublishing(
222-
displayName = "scip-javac",
223-
descriptionText = "A javac plugin to emit SCIP information",
224-
)
221+
configureMavenPublishing()
225222
}
226223

227224
project(":scip-kotlinc") {
228225
apply(plugin = "java-library")
229226
apply(plugin = "org.jetbrains.kotlin.jvm")
230227
apply(plugin = "com.github.johnrengelman.shadow")
228+
description = "A kotlinc plugin to emit SCIP information"
231229

232230
dependencies {
233231
"implementation"(project(":scip-shared"))
@@ -258,10 +256,7 @@ project(":scip-kotlinc") {
258256
relocate("com.intellij", "org.jetbrains.kotlin.com.intellij")
259257
}
260258

261-
configureMavenPublishing(
262-
displayName = "scip-kotlinc",
263-
descriptionText = "A kotlinc plugin to emit SCIP information",
264-
)
259+
configureMavenPublishing()
265260
}
266261

267262
project(":scip-gradle-plugin") {
@@ -276,6 +271,7 @@ project(":scip-gradle-plugin") {
276271

277272
project(":scip-maven-plugin") {
278273
apply(plugin = "java-library")
274+
description = "A Maven plugin that exports dependency metadata for scip-java"
279275

280276
dependencies {
281277
"implementation"(catalog.maven.plugin.api)
@@ -293,15 +289,13 @@ project(":scip-maven-plugin") {
293289
inputs.property("version", project.version.toString())
294290
}
295291

296-
configureMavenPublishing(
297-
displayName = "scip-maven-plugin",
298-
descriptionText = "A Maven plugin that exports dependency metadata for scip-java",
299-
)
292+
configureMavenPublishing()
300293
}
301294

302295
project(":scip-aggregator") {
303296
apply(plugin = "java-library")
304297
apply(plugin = "com.google.protobuf")
298+
description = "Aggregates compiler-plugin SCIP shards into a single SCIP index"
305299

306300
dependencies {
307301
"api"(catalog.scip.java.bindings)
@@ -325,15 +319,13 @@ project(":scip-aggregator") {
325319
}
326320
}
327321

328-
configureMavenPublishing(
329-
displayName = "scip-aggregator",
330-
descriptionText = "Aggregates compiler-plugin SCIP shards into a single SCIP index",
331-
)
322+
configureMavenPublishing()
332323
}
333324

334325
project(":scip-java") {
335326
apply(plugin = "org.jetbrains.kotlin.jvm")
336327
apply(plugin = "application")
328+
description = "Java and Kotlin indexer for SCIP"
337329

338330
dependencies {
339331
"implementation"(project(":scip-aggregator"))
@@ -405,10 +397,7 @@ project(":scip-java") {
405397
}
406398
}
407399

408-
configureMavenPublishing(
409-
displayName = "scip-java",
410-
descriptionText = "Java and Kotlin indexer for SCIP",
411-
)
400+
configureMavenPublishing()
412401
}
413402

414403
project(":scip-snapshots-java-common") {

0 commit comments

Comments
 (0)