Skip to content

Commit 7c9dd3c

Browse files
authored
Support a new publication scheme (#751)
1 parent 49fe12a commit 7c9dd3c

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

build-logic/src/main/kotlin/kotlinx/kover/conventions/kover-publishing-conventions.gradle.kts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ abstract class CollectTask: DefaultTask() {
113113

114114
publishing {
115115
repositories {
116-
addSonatypeRepository()
116+
addPublishingRepositoryIfPresent()
117117

118118
/**
119119
* Maven repository in build directory to store artifacts for using in functional tests.
@@ -142,12 +142,17 @@ afterEvaluate {
142142
}
143143
}
144144

145-
fun RepositoryHandler.addSonatypeRepository() {
146-
maven {
147-
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
148-
credentials {
149-
username = acquireProperty("libs.sonatype.user")
150-
password = acquireProperty("libs.sonatype.password")
145+
// Artifacts are published to an intermediate repo (libs.repo.url) first,
146+
// and then deployed to the central portal.
147+
fun RepositoryHandler.addPublishingRepositoryIfPresent() {
148+
val repositoryUrl = acquireProperty("libs.repo.url")
149+
if (!repositoryUrl.isNullOrBlank()) {
150+
maven {
151+
url = uri(repositoryUrl)
152+
credentials {
153+
username = acquireProperty("libs.repo.user")
154+
password = acquireProperty("libs.repo.password")
155+
}
151156
}
152157
}
153158
}

0 commit comments

Comments
 (0)