Skip to content

Commit

Permalink
Merge 112f7ed into master
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Oct 21, 2022
2 parents 8112dfb + 112f7ed commit 15d75cd
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 22 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "io.github.rtmigo"
version = "0.4.1-SNAPSHOT" //
version = "0.4.1" // -SNAPSHOTjar

repositories {
mavenCentral()
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/Types.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import java.nio.file.Path
import kotlin.io.path.*



@JvmInline
value class JarFile(val path: Path)

Expand Down Expand Up @@ -44,6 +43,7 @@ fun MavenUrl.toPomUrl(notation: Notation): URL {

open class ExpectedException(msg: String) : Exception(msg)
class FailedToParseValueException(value: String) : ExpectedException("Failed to parse '${value}'")
class ValueException(name: String, value: Any, cause: Throwable? = null): IllegalArgumentException("$name: <$value>", cause)
class ValueException(name: String, value: Any, cause: Throwable? = null):
IllegalArgumentException("$name: <$value>", cause)


10 changes: 5 additions & 5 deletions src/main/kotlin/stages/build/GradleTypes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
import java.nio.file.Path
import kotlin.io.path.*

//class AbsPath(src: Path) {
// val path: Path = src.absolute()
//}

@JvmInline
value class ProjectRootDir(val path: Path) {
init {
Expand Down Expand Up @@ -39,6 +35,10 @@ value class BuildGradleFile(val path: Path) {
@JvmInline
value class GradlewFile(val path: Path) {
init {
require(path.name == "gradlew" || path.name == "gradlew.bat")
require(path.name == "gradlew" || path.name == "gradlew.bat") {
"Unexpected filename"
}
if (path.name == "gradlew")
check(path.isExecutable()) { "gradlew is not executable" }
}
}
24 changes: 11 additions & 13 deletions src/main/kotlin/stages/upload/Http.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,11 @@ private fun insecureHttpLogging() = System.getenv("INSECURE_HTTP_LOGGING") == "1
fun createClient(user: SonatypeUsername, pass: SonatypePassword): HttpClient =
HttpClient {

// install(HttpRequestRetry) {
// retryOnServerErrors(maxRetries = 10)
// exponentialDelay()
// retryOnException(maxRetries = 10) // HttpTimeout выбрасывает исключения
// }
//
// install(HttpTimeout) {
// this.requestTimeoutMillis = 10*60*1000
// this.connectTimeoutMillis = 5*1000
// this.socketTimeoutMillis = this.connectTimeoutMillis
// }
install(HttpRequestRetry) {
retryOnServerErrors(maxRetries = 4)
exponentialDelay()
retryOnException(maxRetries = 4) // HttpTimeout выбрасывает исключения
}

install(Logging) {
logger = object : Logger {
Expand Down Expand Up @@ -191,10 +185,14 @@ private val json = Json { encodeDefaults = true }

suspend fun HttpClient.promoteToCentral(uri: StagingUri) {

// иногда тут бывает
// 2022-10 загадочная ошибка:
// Error: Exception in thread "main" java.lang.IllegalStateException: Failed to promote:
// 500 Server Error
// {"errors":[{"id":"*","msg":"Unhandled: Staging repository is already transitioning: iogithubrtmigo-1183"}]}
// {"errors":[
// {"id":"*",
// "msg":"Unhandled: Staging repository is already transitioning: iogithubrtmigo-1183"}]}
// Можно бы предположить, что мы пытались сделать promote дважды. Но нет: логи показывают,
// мы при первом вызове иногда сразу "already transitioning"

eprintHeader("Promoting Staging to Release")
this.post("https://s01.oss.sonatype.org/service/local/staging/bulk/promote") {
Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/tools/Jar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ object Jar {
}
initialized = true
if (jarExeCache == null)
throw IllegalStateException("JAR not found")
throw IllegalStateException("`jar` executable not found")
if (!Path(jarExeCache!!).isExecutable())
throw IllegalStateException("'$jarExeCache' is not executable")
return jarExeCache!!
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/main/kotlin/tools/Thrower.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* SPDX-FileCopyrightText: (c) 2022 Artsiom iG (rtmigo.github.io)
* SPDX-License-Identifier: ISC
**/

package tools

inline fun <R> rethrowingState(
Expand Down

0 comments on commit 15d75cd

Please sign in to comment.