diff --git a/build.gradle.kts b/build.gradle.kts index 8e191312b9e..724f102aef0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -381,7 +381,7 @@ apply { } apply { - if (extra["isSonatypeRelease"] as? Boolean == true && (extra["deployRepoUrlCustom"] as? String) == null) { + if (extra["isDeployStagingRepoGenerationRequired"] as? Boolean == true) { logger.info("Applying configuration for sonatype release") from("libraries/prepareSonatypeStaging.gradle") } diff --git a/libraries/commonConfiguration.gradle b/libraries/commonConfiguration.gradle index 9b625788059..0bdd1d94103 100644 --- a/libraries/commonConfiguration.gradle +++ b/libraries/commonConfiguration.gradle @@ -110,11 +110,14 @@ task preparePublication { project.ext.isSonatypePublish = repoProvider == 'sonatype' project.ext.isSonatypeRelease = isSonatypePublish && isRelease - project.ext.deployRepoUrlCustom = properties["deployRepoUrl"] ?: properties["deploy-url"] + String deployRepoUrl = properties["deployRepoUrl"] ?: properties["deploy-url"] + String deployFolder = properties["deployRepoFolder"] != null ? "file://${rootProject.buildDir}/${properties["deployRepoFolder"]}" : null String sonatypeSnapshotsUrl = (isSonatypePublish && !isRelease) ? "https://oss.sonatype.org/content/repositories/snapshots/" : null - String repoFolder = properties["deployRepoFolder"] ?: "repo" + String deployUrlFromParameters = deployRepoUrl ?: deployFolder ?: sonatypeSnapshotsUrl - ext.repoUrl = project.ext.deployRepoUrlCustom ?: sonatypeSnapshotsUrl ?: "file://${rootProject.buildDir}/${repoFolder}" + project.ext.isDeployStagingRepoGenerationRequired = project.ext.isSonatypeRelease && deployUrlFromParameters == null + + ext.repoUrl = deployUrlFromParameters ?: "file://${rootProject.buildDir}/repo" logger.info("Deployment repository preliminary url: $repoUrl ($repoProvider)") ext.username = properties["deployRepoUsername"] ?: properties["kotlin.${repoProvider}.user"]