From 3ddbf04fc857e74d9295fdbdb378a721e447ed8c Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Thu, 14 Sep 2023 15:01:03 +0200 Subject: [PATCH] Stop creating a staging repository inside the build It's stopped working recently after bad rewriting anyway. KTI-1377 --- .../src/main/kotlin/preparePublication.kt | 43 +------------------ 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/preparePublication.kt b/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/preparePublication.kt index d3ab05112b6..7a7d066b87f 100644 --- a/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/preparePublication.kt +++ b/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/preparePublication.kt @@ -1,9 +1,3 @@ -import io.ktor.client.* -import io.ktor.client.request.* -import io.ktor.client.statement.* -import io.ktor.http.* -import kotlinx.coroutines.runBlocking -import org.gradle.api.GradleException import org.gradle.api.Project import org.gradle.kotlin.dsl.* @@ -37,9 +31,7 @@ fun Project.preparePublication() { } val deployUrlFromParameters = deployRepoUrl ?: deployFolder ?: sonatypeSnapshotsUrl - val isDeployStagingRepoGenerationRequired: Boolean by extra(isSonatypeRelease && deployUrlFromParameters == null) - - var repoUrl: String by extra((deployUrlFromParameters ?: "file://${rootProject.buildDir}/repo").toString()) + val repoUrl: String by extra((deployUrlFromParameters ?: "file://${rootProject.buildDir}/repo").toString()) logger.info("Deployment repository preliminary url: $repoUrl ($repoProvider)") val username: String? by extra( @@ -49,39 +41,6 @@ fun Project.preparePublication() { properties["deployRepoPassword"]?.toString() ?: properties["kotlin.${repoProvider}.password"]?.toString() ) - if (isDeployStagingRepoGenerationRequired) { - doFirst { - HttpClient().use { client -> - runBlocking { - val sonatypeUsername = requireNotNull(username) { - "Username to authenticate on sonatype staging was not provided!" - } - val sonatypePassword = requireNotNull(password) { - "Password to authenticate on sonatype staging was not provided!" - } - - val response = client.post("https://oss.sonatype.org/service/local/staging/profiles/169b36e205a64e/start") { - basicAuth(sonatypeUsername, sonatypePassword) - contentType(ContentType.Application.Xml) - accept(ContentType.Application.Xml) - setBody("Repository for publishing $version") - } - - if (response.status.value in 200..299) { - val responseText = response.bodyAsText() - val repoId = responseText - .substringAfter("") - .substringBefore("") - repoUrl = "https://oss.sonatype.org/service/local/staging/deployByRepositoryId/$repoId/" - logger.warn("##teamcity[setParameter name='system.deploy-url' value='$repoUrl']") - } else { - throw GradleException("Failed to connect to sonatype API: ${response.status.description}") - } - } - } - } - } - doLast { logger.warn("Deployment repository url: $repoUrl") }