diff --git a/build-helpers/publishing/src/main/kotlin/org/jetbrains/compose/internal/publishing/MavenCentralProperties.kt b/build-helpers/publishing/src/main/kotlin/org/jetbrains/compose/internal/publishing/MavenCentralProperties.kt index 1fd29edc4d..576041d780 100644 --- a/build-helpers/publishing/src/main/kotlin/org/jetbrains/compose/internal/publishing/MavenCentralProperties.kt +++ b/build-helpers/publishing/src/main/kotlin/org/jetbrains/compose/internal/publishing/MavenCentralProperties.kt @@ -23,10 +23,6 @@ class MavenCentralProperties(private val myProject: Project) { propertyProvider("maven.central.staging.close.after.upload", defaultValue = "false") .map { it.toBoolean() } - val autoDropOnError: Provider = - propertyProvider("maven.central.staging.from.after.error", defaultValue = "false") - .map { it.toBoolean() } - val signArtifacts: Boolean get() = myProject.findProperty("maven.central.sign") == "true" diff --git a/build-helpers/publishing/src/main/kotlin/org/jetbrains/compose/internal/publishing/UploadToSonatypeTask.kt b/build-helpers/publishing/src/main/kotlin/org/jetbrains/compose/internal/publishing/UploadToSonatypeTask.kt index d9d8091da7..901a2b330a 100644 --- a/build-helpers/publishing/src/main/kotlin/org/jetbrains/compose/internal/publishing/UploadToSonatypeTask.kt +++ b/build-helpers/publishing/src/main/kotlin/org/jetbrains/compose/internal/publishing/UploadToSonatypeTask.kt @@ -30,9 +30,6 @@ abstract class UploadToSonatypeTask : DefaultTask() { @get:Internal abstract val autoCommitOnSuccess: Property - @get:Internal - abstract val autoDropOnError: Property - @get:Internal abstract val version: Property @@ -72,9 +69,6 @@ abstract class UploadToSonatypeTask : DefaultTask() { sonatype.closeStagingRepo(stagingRepo) } } catch (e: Exception) { - if (autoDropOnError.get()) { - sonatype.dropStagingRepo(stagingRepo) - } throw e } } diff --git a/build-helpers/publishing/src/main/kotlin/org/jetbrains/compose/internal/publishing/utils/Json.kt b/build-helpers/publishing/src/main/kotlin/org/jetbrains/compose/internal/publishing/utils/Json.kt new file mode 100644 index 0000000000..39efbdc0b9 --- /dev/null +++ b/build-helpers/publishing/src/main/kotlin/org/jetbrains/compose/internal/publishing/utils/Json.kt @@ -0,0 +1,12 @@ +/* + * Copyright 2020-2021 JetBrains s.r.o. and respective authors and developers. + * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. + */ + +package org.jetbrains.compose.internal.publishing.utils + +import okhttp3.MediaType.Companion.toMediaType + +internal object Json { + val mediaType = "application/json".toMediaType() +} \ No newline at end of file diff --git a/build-helpers/publishing/src/main/kotlin/org/jetbrains/compose/internal/publishing/utils/SonatypeApi.kt b/build-helpers/publishing/src/main/kotlin/org/jetbrains/compose/internal/publishing/utils/SonatypeApi.kt index 6979b21ed3..59a0ffa4c9 100644 --- a/build-helpers/publishing/src/main/kotlin/org/jetbrains/compose/internal/publishing/utils/SonatypeApi.kt +++ b/build-helpers/publishing/src/main/kotlin/org/jetbrains/compose/internal/publishing/utils/SonatypeApi.kt @@ -13,7 +13,6 @@ interface SonatypeApi { fun upload(repo: StagingRepo, module: ModuleToUpload) fun stagingProfiles(): StagingProfiles fun createStagingRepo(profile: StagingProfile, description: String): StagingRepo - fun dropStagingRepo(repo: StagingRepo) fun closeStagingRepo(repo: StagingRepo) } diff --git a/build-helpers/publishing/src/main/kotlin/org/jetbrains/compose/internal/publishing/utils/SonatypeRestApiClient.kt b/build-helpers/publishing/src/main/kotlin/org/jetbrains/compose/internal/publishing/utils/SonatypeRestApiClient.kt index e009a1095e..fda0d1637d 100644 --- a/build-helpers/publishing/src/main/kotlin/org/jetbrains/compose/internal/publishing/utils/SonatypeRestApiClient.kt +++ b/build-helpers/publishing/src/main/kotlin/org/jetbrains/compose/internal/publishing/utils/SonatypeRestApiClient.kt @@ -76,27 +76,13 @@ class SonatypeRestApiClient( return StagingRepo(response, profile) } - override fun dropStagingRepo(repo: StagingRepo) { - stagingRepoAction("drop", repo) - } - override fun closeStagingRepo(repo: StagingRepo) { - stagingRepoAction("finish", repo) - } - - private fun stagingRepoAction( - action: String, repo: StagingRepo - ) { - val logRepoDescription = "profileId='${repo.profile.id}', repoId='${repo.id}', description='${repo.description}'" - logger.info("Starting '$action': $logRepoDescription") - buildRequest("service/local/staging/${repo.profile.id}/$action") { - val promoteRequest = StagingRepo.PromoteRequest( - StagingRepo.PromoteData(stagedRepositoryId = repo.id, description = repo.description) - ) - post(Xml.serialize(promoteRequest).toRequestBody(Xml.mediaType)) + logger.info("Closing repository '${repo.id}'") + buildRequest("service/local/staging/bulk/close") { + val request = "{\"data\":{\"stagedRepositoryIds\":[\"${repo.id}\"]}}" + post(Xml.serialize(request).toRequestBody(Json.mediaType)) }.execute { responseBody -> - logger.info("Finished '$action': $logRepoDescription") - logger.info("Response: '${responseBody.string()}'") + logger.info("Finished closing repository '${repo.id}': '${responseBody.string()}'") } } } diff --git a/compose/build.gradle.kts b/compose/build.gradle.kts index 061be3c2b1..931fe0118f 100644 --- a/compose/build.gradle.kts +++ b/compose/build.gradle.kts @@ -185,7 +185,6 @@ val reuploadArtifactsToMavenCentral by tasks.registering(UploadToSonatypeTask::c user.set(mavenCentral.user) password.set(mavenCentral.password) autoCommitOnSuccess.set(mavenCentral.autoCommitOnSuccess) - autoDropOnError.set(mavenCentral.autoDropOnError) stagingProfileName.set("org.jetbrains.compose") } diff --git a/compose/settings.gradle.kts b/compose/settings.gradle.kts index 747219d8ff..443f932168 100644 --- a/compose/settings.gradle.kts +++ b/compose/settings.gradle.kts @@ -6,7 +6,7 @@ pluginManagement { maven("https://maven.pkg.jetbrains.space/public/p/space/maven") } dependencies { - classpath("org.jetbrains.compose.internal.build-helpers:publishing:0.0.2") + classpath("org.jetbrains.compose.internal.build-helpers:publishing:0.1.0") } } }