diff --git a/buildSrc/src/main/kotlin/Publishing.kt b/buildSrc/src/main/kotlin/Publishing.kt index ab82d06c73..2fec3c0e2c 100644 --- a/buildSrc/src/main/kotlin/Publishing.kt +++ b/buildSrc/src/main/kotlin/Publishing.kt @@ -43,38 +43,13 @@ fun MavenPom.configureMavenCentralMetadata(project: Project) { } } -/** - * 'libs.space.pub' is a dev option that is set on our CI in order to publish - * dev build into 'https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven' Maven repository. - * In order to use it, pass the corresponding ENV to the TC 'Deploy' task. - */ -private val spacePublicationEnabled = System.getenv("libs.space.pub")?.equals("true") ?: false - -fun mavenRepositoryUri(): URI { - if (spacePublicationEnabled) { - return URI("https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven") - } - - val repositoryId: String? = System.getenv("libs.repository.id") - return if (repositoryId == null) { - URI("https://oss.sonatype.org/service/local/staging/deploy/maven2/") - } else { - URI("https://oss.sonatype.org/service/local/staging/deployByRepositoryId/$repositoryId") - } -} - fun configureMavenPublication(rh: RepositoryHandler, project: Project) { rh.maven { - url = mavenRepositoryUri() - credentials { - if (spacePublicationEnabled) { - // Configure space credentials - username = project.getSensitiveProperty("libs.space.user") - password = project.getSensitiveProperty("libs.space.password") - } else { - // Configure sonatype credentials - username = project.getSensitiveProperty("libs.sonatype.user") - password = project.getSensitiveProperty("libs.sonatype.password") + setUrl(project.getSensitiveProperty("libs.repo.url") ?: "file://${project.rootProject.layout.buildDirectory.dir("repo").get().asFile}") + if (url.scheme != "file") { + credentials { + username = project.getSensitiveProperty("libs.repo.user") + password = project.getSensitiveProperty("libs.repo.password") } } }