Skip to content

Commit e6d0f70

Browse files
authored
Support a new publication scheme (#460)
1 parent 15c33ae commit e6d0f70

File tree

1 file changed

+9
-28
lines changed

1 file changed

+9
-28
lines changed

build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-publish.gradle.kts

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -55,35 +55,16 @@ fun MavenPom.configureMavenCentralMetadata(project: Project) {
5555
}
5656
}
5757

58-
fun MavenPublication.mavenCentralArtifacts(project: Project, sources: SourceDirectorySet) {
59-
val sourcesJar by project.tasks.creating(Jar::class) {
60-
archiveClassifier = "sources"
61-
from(sources)
62-
}
63-
val javadocJar by project.tasks.creating(Jar::class) {
64-
archiveClassifier = "javadoc"
65-
// contents are deliberately left empty
66-
}
67-
artifact(sourcesJar)
68-
artifact(javadocJar)
69-
}
7058

71-
72-
fun mavenRepositoryUri(): URI {
73-
val repositoryId: String? = System.getenv("libs.repository.id")
74-
return if (repositoryId == null) {
75-
URI("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
76-
} else {
77-
URI("https://oss.sonatype.org/service/local/staging/deployByRepositoryId/$repositoryId")
78-
}
79-
}
80-
81-
fun RepositoryHandler.configureMavenPublication( project: Project) {
82-
maven {
83-
url = mavenRepositoryUri()
84-
credentials {
85-
username = project.getSensitiveProperty("libs.sonatype.user")
86-
password = project.getSensitiveProperty("libs.sonatype.password")
59+
fun RepositoryHandler.configureMavenPublication(project: Project) {
60+
val repositoryUrl = project.getSensitiveProperty("libs.repo.url")
61+
if (!repositoryUrl.isNullOrBlank()) {
62+
maven {
63+
url = uri(repositoryUrl)
64+
credentials {
65+
username = project.getSensitiveProperty("libs.repo.user")
66+
password = project.getSensitiveProperty("libs.repo.password")
67+
}
8768
}
8869
}
8970

0 commit comments

Comments
 (0)