Skip to content

Support a new publication scheme #4473

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 14 additions & 20 deletions buildSrc/src/main/kotlin/Publishing.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,25 @@ fun MavenPom.configureMavenCentralMetadata(project: Project) {
*/
private val spacePublicationEnabled = System.getenv("libs.space.pub")?.equals("true") ?: false

fun mavenRepositoryUri(): URI {
fun configureMavenPublication(rh: RepositoryHandler, project: Project) {
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")
}
}
rh.maven {
url = URI("https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven")

fun configureMavenPublication(rh: RepositoryHandler, project: Project) {
rh.maven {
url = mavenRepositoryUri()
credentials {
if (spacePublicationEnabled) {
credentials {
// 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")
}
}
}
val centralRepo = project.getSensitiveProperty("libs.repo.url")
if (!centralRepo.isNullOrBlank()) {
rh.maven {
url = URI(centralRepo)
credentials {
username = project.getSensitiveProperty("libs.repo.user")
password = project.getSensitiveProperty("libs.repo.password")
}
}
}
Expand Down