Compare commits

...

2 Commits

Author SHA1 Message Date
c954e2cf42 small fix 2025-05-25 13:09:18 +06:00
ffe0f3f33b small improvements 2025-05-16 09:18:31 +06:00
4 changed files with 13 additions and 11 deletions

View File

@@ -6,7 +6,9 @@ const val generateCentralSonatypeUploadingPartImports = """import java.nio.chars
import java.net.http.HttpClient import java.net.http.HttpClient
import java.net.http.HttpRequest import java.net.http.HttpRequest
import java.net.http.HttpResponse""" import java.net.http.HttpResponse"""
const val generateCentralSonatypeUploadingPart = """if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) { const val generateCentralSonatypeUploadingPart = """// This script work based on https://ossrh-staging-api.central.sonatype.com/swagger-ui/#/default/manual_upload_repository
// and getting available open repos and just uploading them
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
def taskName = "uploadSonatypePublication" def taskName = "uploadSonatypePublication"
if (rootProject.tasks.names.contains(taskName) == false) { if (rootProject.tasks.names.contains(taskName) == false) {
rootProject.tasks.register(taskName) { rootProject.tasks.register(taskName) {
@@ -39,7 +41,7 @@ const val generateCentralSonatypeUploadingPart = """if ((project.hasProperty('SO
.build() .build()
def uploadResponse = client.send(uploadRequest, HttpResponse.BodyHandlers.ofString()) def uploadResponse = client.send(uploadRequest, HttpResponse.BodyHandlers.ofString())
if (uploadResponse.statusCode() != 200) { if (uploadResponse.statusCode() != 200) {
throw IllegalStateException("Faced error of uploading for repo with key ${"$"}it. Response: ${"$"}uploadResponse") throw new IllegalStateException("Faced error of uploading for repo with key ${"$"}it. Response: ${"$"}uploadResponse")
} }
} }
} }

View File

@@ -61,11 +61,11 @@ publishing {
""" }} """ }}
} }
} }
repositories {
${repositories.joinToString("\n ") { it.build(" ") }}
}
} }
} }
repositories {
${repositories.joinToString("\n ") { it.build(" ") }}
}
} }
${gpgSigning.generateMavenConfig()} ${gpgSigning.generateMavenConfig()}
""".trimIndent() """.trimIndent()

View File

@@ -58,11 +58,11 @@ publishing {
""" }} """ }}
} }
} }
repositories {
${repositories.joinToString("\n ") { it.build(" ") }}
}
} }
} }
repositories {
${repositories.joinToString("\n ") { it.build(" ") }}
}
} }
${gpgSigning.generateMavenConfig()} ${gpgSigning.generateMavenConfig()}
""".trimIndent() """.trimIndent()

View File

@@ -42,9 +42,9 @@ publishing {
}""" }} }""" }}
} }
} }
repositories { }
${repositories.joinToString("\n ") { it.build(" ") }} repositories {
} ${repositories.joinToString("\n ") { it.build(" ") }}
} }
} }
${gpgSigning.generateMavenConfig()} ${gpgSigning.generateMavenConfig()}