Allow emulate sonatype publishing when publishing to folder (KTI-552)

This commit is contained in:
Nikolay Krasko
2021-04-29 21:13:07 +03:00
parent 624740a80a
commit 2a2fa31577
2 changed files with 7 additions and 4 deletions
+1 -1
View File
@@ -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")
}
+6 -3
View File
@@ -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"]