Skip to content

Commit

Permalink
Kotlin 1.5.10 and migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisCAD committed Jul 7, 2021
1 parent 4fa0a67 commit ed0cf3e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib-publishing-helpers/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
java
kotlin("jvm") version "1.3.72"
kotlin("jvm") version "1.5.10"
`maven-publish`
signing
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ enum class AnsiColor(private val colorNumber: Byte) {
companion object {
private const val prefix = "\u001B"
const val RESET = "$prefix[0m"
private val isCompatible = "win" !in System.getProperty("os.name").toLowerCase()
private val isCompatible = "win" !in System.getProperty("os.name").lowercase()
}

val regular get() = if (isCompatible) "$prefix[0;3${colorNumber}m" else ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package lib_publisher_tools.open
import lib_publisher_tools.process.execute

fun openUrl(url: String) {
val osName = System.getProperty("os.name").toLowerCase()
val osName = System.getProperty("os.name").lowercase()
val isMacOs: Boolean = "mac" in osName
val command = if (isMacOs) "open $url" else {
val isWindows: Boolean = "win" in osName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ private val executionDir = File(".")
fun String.execute(
workingDir: File = executionDir,
@ExperimentalTime
timeout: Duration = 60.minutes
timeout: Duration = Duration.minutes(60)
): String {
val proc = processBuilder(
rawCommand = this,
workingDir = workingDir
).start()
proc.waitFor(timeout.toLongMilliseconds(), TimeUnit.MILLISECONDS)
proc.waitFor(timeout.inWholeMilliseconds, TimeUnit.MILLISECONDS)
return proc.inputStream.use { it.bufferedReader().readText() }.also {
val exitValue = proc.exitValue()
if (exitValue != 0) {
Expand All @@ -30,14 +30,14 @@ fun String.execute(
fun String.executeAndPrint(
workingDir: File = executionDir,
@ExperimentalTime
timeout: Duration = 60.minutes
timeout: Duration = Duration.minutes(60)
) {
val proc = processBuilder(rawCommand = this, workingDir = workingDir)
.redirectInput(ProcessBuilder.Redirect.INHERIT)
.redirectOutput(ProcessBuilder.Redirect.INHERIT)
.redirectError(ProcessBuilder.Redirect.INHERIT)
.start()
proc.waitFor(timeout.toLongMilliseconds(), TimeUnit.MILLISECONDS)
proc.waitFor(timeout.inWholeMilliseconds, TimeUnit.MILLISECONDS)
val exitValue = proc.exitValue()
if (exitValue != 0) {
throw Exception("Non zero exit value: $exitValue")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ private val digitsOnlyBasedVersionNumberRegex = "^[0-9,.v-]+$".toRegex()

private fun Version.isStable(): Boolean {
val version = value
val uppercaseVersion = version.toUpperCase()
val uppercaseVersion = version.uppercase()
val hasStableKeyword = knownStableKeywords.any { it in uppercaseVersion }
return hasStableKeyword || digitsOnlyBasedVersionNumberRegex.matches(version.withoutKnownSuffixes())
}
Expand Down

0 comments on commit ed0cf3e

Please sign in to comment.