Skip to content

Commit 9207342

Browse files
committed
fixup! Support a new publication scheme
1 parent 7d5d7e4 commit 9207342

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import kotlinx.kover.gradle.plugin.dsl.MetricType
2-
import kotlinx.validation.build.publishingRepository
2+
import kotlinx.validation.build.addPublishingRepositoryIfPresent
33
import kotlinx.validation.build.mavenCentralMetadata
44
import kotlinx.validation.build.signPublicationIfKeyPresent
55
import org.gradle.api.attributes.TestSuiteType.FUNCTIONAL_TEST
@@ -125,7 +125,7 @@ publishing {
125125
create<MavenPublication>("maven") {
126126
from(components["java"])
127127
}
128-
publishingRepository(project)
128+
addPublishingRepositoryIfPresent(project)
129129

130130
mavenCentralMetadata()
131131
}

buildSrc/src/main/kotlin/Publishing.kt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@ import java.net.*
1313

1414
// Artifacts are published to an intermediate repo (libs.repo.url) first,
1515
// and then deployed to the central portal.
16-
fun PublishingExtension.publishingRepository(project: Project) {
17-
repositories {
18-
maven {
19-
url = URI(project.getSensitiveProperty("libs.repo.url") ?: error("libs.repo.url is not set"))
20-
credentials {
21-
username = project.getSensitiveProperty("libs.repo.user")
22-
password = project.getSensitiveProperty("libs.repo.password")
16+
fun PublishingExtension.addPublishingRepositoryIfPresent(project: Project) {
17+
val repositoryUrl = project.getSensitiveProperty("libs.repo.url")
18+
if (!repositoryUrl.isNullOrBlank()) {
19+
repositories {
20+
maven {
21+
url = URI(repositoryUrl)
22+
credentials {
23+
username = project.getSensitiveProperty("libs.repo.user")
24+
password = project.getSensitiveProperty("libs.repo.password")
25+
}
2326
}
2427
}
2528
}

0 commit comments

Comments
 (0)