From 73b751f43fb8670fbfdc8cbc6494143bc5d029f4 Mon Sep 17 00:00:00 2001 From: voddan Date: Fri, 29 Jan 2016 11:04:12 +0300 Subject: [PATCH 1/8] extracted checking for a new version into UpdateKobalt; semantics did not change --- src/main/kotlin/com/beust/kobalt/Main.kt | 21 +-------------- .../com/beust/kobalt/app/UpdateKobalt.kt | 26 +++++++++++++++++-- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/main/kotlin/com/beust/kobalt/Main.kt b/src/main/kotlin/com/beust/kobalt/Main.kt index 1b6aace6..b6908e66 100644 --- a/src/main/kotlin/com/beust/kobalt/Main.kt +++ b/src/main/kotlin/com/beust/kobalt/Main.kt @@ -22,8 +22,6 @@ import com.google.inject.Guice import java.io.File import java.nio.file.Paths import java.util.* -import java.util.concurrent.TimeUnit -import java.util.concurrent.TimeoutException import javax.inject.Inject public fun main(argv: Array) { @@ -98,24 +96,7 @@ private class Main @Inject constructor( log(1, if (result != 0) "BUILD FAILED: $result" else "BUILD SUCCESSFUL ($seconds seconds)") // Check for new version - try { - val latestVersionString = latestVersionFuture.get(1, TimeUnit.SECONDS) - val latestVersion = Versions.toLongVersion(latestVersionString) - val current = Versions.toLongVersion(Kobalt.version) - val distFile = File(KFiles.joinDir(KFiles.distributionsDir, latestVersionString)) - if (latestVersion > current) { - if (distFile.exists()) { - log(1, "**** Version $latestVersionString is installed") - } else { - listOf("", "New Kobalt version available: $latestVersionString", - "To update, run ./kobaltw --update", "").forEach { - log(1, "**** $it") - } - } - } - } catch(ex: TimeoutException) { - log(2, "Didn't get the new version in time, skipping it") - } + updateKobalt.checkForNewVersion(latestVersionFuture.get()) } return result } diff --git a/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt b/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt index 73d1a6d0..342741b1 100644 --- a/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt +++ b/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt @@ -1,8 +1,10 @@ package com.beust.kobalt.app -import com.beust.kobalt.misc.GithubApi -import com.beust.kobalt.misc.KobaltWrapperProperties +import com.beust.kobalt.api.Kobalt +import com.beust.kobalt.misc.* import com.beust.kobalt.wrapper.Main +import java.io.File +import java.util.concurrent.TimeoutException import javax.inject.Inject /** @@ -21,4 +23,24 @@ public class UpdateKobalt @Inject constructor(val github: GithubApi, val wrapper fun downloadKobalt() { Main.main(arrayOf("--download", "--no-launch")) } + + fun checkForNewVersion(latestVersionString: String) { + try { + val latestVersion = Versions.toLongVersion(latestVersionString) + val current = Versions.toLongVersion(Kobalt.version) + val distFile = File(KFiles.joinDir(KFiles.distributionsDir, latestVersionString)) + if (latestVersion > current) { + if (distFile.exists()) { + log(1, "**** Version $latestVersionString is installed") + } else { + listOf("", "New Kobalt version available: $latestVersionString", + "To update, run ./kobaltw --update", "").forEach { + log(1, "**** $it") + } + } + } + } catch(ex: TimeoutException) { + log(2, "Didn't get the new version in time, skipping it") + } + } } From 934db829dc193a9444d9ac698da50dca21c722a1 Mon Sep 17 00:00:00 2001 From: voddan Date: Fri, 29 Jan 2016 11:52:52 +0300 Subject: [PATCH 2/8] added `kobalt.version.last_checked` to `kobalt-wrapper.properties` --- .../com/beust/kobalt/misc/KobaltWrapperProperties.kt | 12 +++++++++--- src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt | 4 +++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/KobaltWrapperProperties.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/KobaltWrapperProperties.kt index 8af0da44..b0c7070d 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/KobaltWrapperProperties.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/KobaltWrapperProperties.kt @@ -4,6 +4,7 @@ import com.beust.kobalt.api.Kobalt import com.google.inject.Inject import java.io.File import java.io.FileReader +import java.sql.Timestamp import java.util.* /** @@ -13,12 +14,14 @@ class KobaltWrapperProperties @Inject constructor() { private val WRAPPER_DIR = KFiles.KOBALT_DIR + "/wrapper" private val KOBALT_WRAPPER_PROPERTIES = "kobalt-wrapper.properties" private val PROPERTY_VERSION = "kobalt.version" + private val PROPERTY_VERSION_LAST_CHECKED = "kobalt.version.last_checked" private val PROPERTY_DOWNLOAD_URL = "kobalt.downloadUrl" - fun create(version: String) { + fun create(version: String, versionLastChecked: Timestamp) { log(2, "Creating $file with $version and ${defaultUrlFor(version)}") KFiles.saveFile(file, listOf( - "$PROPERTY_VERSION=$version" + "$PROPERTY_VERSION=$version", + "$PROPERTY_VERSION_LAST_CHECKED=$versionLastChecked" // "$PROPERTY_DOWNLOAD_URL=${defaultUrlFor(version)}" ).joinToString("\n")) } @@ -33,7 +36,7 @@ class KobaltWrapperProperties @Inject constructor() { get() { val config = file if (!config.exists()) { - create(Kobalt.version) + create(Kobalt.version, Timestamp(0)) } val result = Properties() @@ -44,6 +47,9 @@ class KobaltWrapperProperties @Inject constructor() { val version : String get() = properties.getProperty(PROPERTY_VERSION) + val versionLastChecked: Timestamp + get() = Timestamp.valueOf(properties.getProperty(PROPERTY_VERSION_LAST_CHECKED)) + val downloadUrl : String get() = properties.getProperty(PROPERTY_DOWNLOAD_URL) } diff --git a/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt b/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt index 342741b1..93eca108 100644 --- a/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt +++ b/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt @@ -4,6 +4,7 @@ import com.beust.kobalt.api.Kobalt import com.beust.kobalt.misc.* import com.beust.kobalt.wrapper.Main import java.io.File +import java.sql.Timestamp import java.util.concurrent.TimeoutException import javax.inject.Inject @@ -13,7 +14,7 @@ import javax.inject.Inject public class UpdateKobalt @Inject constructor(val github: GithubApi, val wrapperProperties: KobaltWrapperProperties) { fun updateKobalt() { val newVersion = github.latestKobaltVersion - wrapperProperties.create(newVersion.get()) + wrapperProperties.create(newVersion.get(), Timestamp(System.currentTimeMillis())) Main.main(arrayOf()) } @@ -39,6 +40,7 @@ public class UpdateKobalt @Inject constructor(val github: GithubApi, val wrapper } } } + wrapperProperties.create(wrapperProperties.version, Timestamp(System.currentTimeMillis())) } catch(ex: TimeoutException) { log(2, "Didn't get the new version in time, skipping it") } From 0fe76cd31d7dc4962099814bb868876289199164 Mon Sep 17 00:00:00 2001 From: voddan Date: Fri, 29 Jan 2016 12:08:57 +0300 Subject: [PATCH 3/8] replaced `Timestamp` with `Instant` --- .../com/beust/kobalt/misc/KobaltWrapperProperties.kt | 10 +++++----- src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/KobaltWrapperProperties.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/KobaltWrapperProperties.kt index b0c7070d..2f92d07b 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/KobaltWrapperProperties.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/KobaltWrapperProperties.kt @@ -4,7 +4,7 @@ import com.beust.kobalt.api.Kobalt import com.google.inject.Inject import java.io.File import java.io.FileReader -import java.sql.Timestamp +import java.time.Instant import java.util.* /** @@ -17,7 +17,7 @@ class KobaltWrapperProperties @Inject constructor() { private val PROPERTY_VERSION_LAST_CHECKED = "kobalt.version.last_checked" private val PROPERTY_DOWNLOAD_URL = "kobalt.downloadUrl" - fun create(version: String, versionLastChecked: Timestamp) { + fun create(version: String, versionLastChecked: Instant) { log(2, "Creating $file with $version and ${defaultUrlFor(version)}") KFiles.saveFile(file, listOf( "$PROPERTY_VERSION=$version", @@ -36,7 +36,7 @@ class KobaltWrapperProperties @Inject constructor() { get() { val config = file if (!config.exists()) { - create(Kobalt.version, Timestamp(0)) + create(Kobalt.version, Instant.MIN) } val result = Properties() @@ -47,8 +47,8 @@ class KobaltWrapperProperties @Inject constructor() { val version : String get() = properties.getProperty(PROPERTY_VERSION) - val versionLastChecked: Timestamp - get() = Timestamp.valueOf(properties.getProperty(PROPERTY_VERSION_LAST_CHECKED)) + val versionLastChecked: Instant + get() = Instant.parse(properties.getProperty(PROPERTY_VERSION_LAST_CHECKED)) val downloadUrl : String get() = properties.getProperty(PROPERTY_DOWNLOAD_URL) diff --git a/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt b/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt index 93eca108..5ffa79f7 100644 --- a/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt +++ b/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt @@ -4,7 +4,7 @@ import com.beust.kobalt.api.Kobalt import com.beust.kobalt.misc.* import com.beust.kobalt.wrapper.Main import java.io.File -import java.sql.Timestamp +import java.time.Instant import java.util.concurrent.TimeoutException import javax.inject.Inject @@ -14,7 +14,7 @@ import javax.inject.Inject public class UpdateKobalt @Inject constructor(val github: GithubApi, val wrapperProperties: KobaltWrapperProperties) { fun updateKobalt() { val newVersion = github.latestKobaltVersion - wrapperProperties.create(newVersion.get(), Timestamp(System.currentTimeMillis())) + wrapperProperties.create(newVersion.get(), Instant.now()) Main.main(arrayOf()) } @@ -40,7 +40,7 @@ public class UpdateKobalt @Inject constructor(val github: GithubApi, val wrapper } } } - wrapperProperties.create(wrapperProperties.version, Timestamp(System.currentTimeMillis())) + wrapperProperties.create(wrapperProperties.version, Instant.now()) } catch(ex: TimeoutException) { log(2, "Didn't get the new version in time, skipping it") } From 789918a7aba556f15ed87e6137121904af0b7b5e Mon Sep 17 00:00:00 2001 From: voddan Date: Fri, 29 Jan 2016 12:36:48 +0300 Subject: [PATCH 4/8] added `versionCheckTimeout` to `Kobalt` added `kobalt.version.check_timeout` to `kobalt.properties` Uses ISO-8601 period format --- .../src/main/kotlin/com/beust/kobalt/api/Kobalt.kt | 5 ++++- src/main/resources/kobalt.properties | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/Kobalt.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/Kobalt.kt index e736aab1..a64ecaef 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/Kobalt.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/Kobalt.kt @@ -5,6 +5,7 @@ import com.beust.kobalt.HostConfig import com.beust.kobalt.Plugins import com.google.inject.Injector import java.io.InputStream +import java.time.Duration import java.util.* public class Kobalt { @@ -34,8 +35,9 @@ public class Kobalt { if (repo.url.endsWith("/")) repo else repo.copy(url = (repo.url + "/"))) - private val PROPERTY_KOBALT_VERSION = "kobalt.version" private val KOBALT_PROPERTIES = "kobalt.properties" + private val PROPERTY_KOBALT_VERSION = "kobalt.version" + private val PROPERTY_KOBALT_VERSION_CHECK_TIMEOUT = "kobalt.version.check_timeout" // ISO-8601 /** kobalt.properties */ private val kobaltProperties: Properties by lazy { readProperties() } @@ -73,6 +75,7 @@ public class Kobalt { } val version = kobaltProperties.getProperty(PROPERTY_KOBALT_VERSION) + val versionCheckTimeout = Duration.parse(kobaltProperties.getProperty(PROPERTY_KOBALT_VERSION_CHECK_TIMEOUT)) fun findPlugin(name: String) = Plugins.findPlugin(name) } diff --git a/src/main/resources/kobalt.properties b/src/main/resources/kobalt.properties index 0f994c0b..182ef21c 100644 --- a/src/main/resources/kobalt.properties +++ b/src/main/resources/kobalt.properties @@ -1 +1,2 @@ kobalt.version=0.401 +kobalt.version.check_timeout=P1DT2H From ac968cef995eb7e3220e7df404c21919058ec7a6 Mon Sep 17 00:00:00 2001 From: voddan Date: Fri, 29 Jan 2016 12:48:38 +0300 Subject: [PATCH 5/8] added time check --- src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt b/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt index 5ffa79f7..c73433c7 100644 --- a/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt +++ b/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt @@ -4,6 +4,7 @@ import com.beust.kobalt.api.Kobalt import com.beust.kobalt.misc.* import com.beust.kobalt.wrapper.Main import java.io.File +import java.time.Duration import java.time.Instant import java.util.concurrent.TimeoutException import javax.inject.Inject @@ -26,6 +27,10 @@ public class UpdateKobalt @Inject constructor(val github: GithubApi, val wrapper } fun checkForNewVersion(latestVersionString: String) { + if(Kobalt.versionCheckTimeout + > Duration.between(wrapperProperties.versionLastChecked, Instant.now())) + return // waits `Kobalt.versionCheckTimeout` before the next check + try { val latestVersion = Versions.toLongVersion(latestVersionString) val current = Versions.toLongVersion(Kobalt.version) From 6ad374006f4083d8e1210b23f8e0ffd9e219135a Mon Sep 17 00:00:00 2001 From: voddan Date: Fri, 29 Jan 2016 12:57:40 +0300 Subject: [PATCH 6/8] moved the waiting operation under the timeout check --- src/main/kotlin/com/beust/kobalt/Main.kt | 4 ++-- src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/com/beust/kobalt/Main.kt b/src/main/kotlin/com/beust/kobalt/Main.kt index b6908e66..5924f318 100644 --- a/src/main/kotlin/com/beust/kobalt/Main.kt +++ b/src/main/kotlin/com/beust/kobalt/Main.kt @@ -81,6 +81,7 @@ private class Main @Inject constructor( var result = 0 val latestVersionFuture = github.latestKobaltVersion + val seconds = benchmarkSeconds { try { result = runWithArgs(jc, args, argv) @@ -95,8 +96,7 @@ private class Main @Inject constructor( if (! args.update) { log(1, if (result != 0) "BUILD FAILED: $result" else "BUILD SUCCESSFUL ($seconds seconds)") - // Check for new version - updateKobalt.checkForNewVersion(latestVersionFuture.get()) + updateKobalt.checkForNewVersion(latestVersionFuture) } return result } diff --git a/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt b/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt index c73433c7..f1670586 100644 --- a/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt +++ b/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt @@ -6,6 +6,7 @@ import com.beust.kobalt.wrapper.Main import java.io.File import java.time.Duration import java.time.Instant +import java.util.concurrent.Future import java.util.concurrent.TimeoutException import javax.inject.Inject @@ -26,12 +27,16 @@ public class UpdateKobalt @Inject constructor(val github: GithubApi, val wrapper Main.main(arrayOf("--download", "--no-launch")) } - fun checkForNewVersion(latestVersionString: String) { + /** + * Accepts Future as `latestVersionFuture` to allow getting `latestVersion` in the background + * */ + fun checkForNewVersion(latestVersionFuture: Future) { if(Kobalt.versionCheckTimeout > Duration.between(wrapperProperties.versionLastChecked, Instant.now())) return // waits `Kobalt.versionCheckTimeout` before the next check try { + val latestVersionString = latestVersionFuture.get() val latestVersion = Versions.toLongVersion(latestVersionString) val current = Versions.toLongVersion(Kobalt.version) val distFile = File(KFiles.joinDir(KFiles.distributionsDir, latestVersionString)) From f1b420849dc57a85efbfccea185072e13bd670b4 Mon Sep 17 00:00:00 2001 From: voddan Date: Fri, 29 Jan 2016 21:23:04 +0300 Subject: [PATCH 7/8] added manager for .kobalt/versionCheckTimestamp.txt --- .../build/VersionCheckTimestampFile.kt | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/VersionCheckTimestampFile.kt diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/VersionCheckTimestampFile.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/VersionCheckTimestampFile.kt new file mode 100644 index 00000000..ecb23bd6 --- /dev/null +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/VersionCheckTimestampFile.kt @@ -0,0 +1,23 @@ +package com.beust.kobalt.internal.build + +import com.beust.kobalt.misc.KFiles +import java.io.File +import java.time.Instant + +class VersionCheckTimestampFile { + companion object { + private val KOBALT_VERSION_CHECK_TIMESTAMP_FILE = "versionCheckTimestamp.txt" + private val checkTimestampFile = File(KFiles.KOBALT_DOT_DIR, KOBALT_VERSION_CHECK_TIMESTAMP_FILE) + + fun updateTimestamp(timestamp: Instant) = KFiles.saveFile(checkTimestampFile, timestamp.toString()) + + fun getTimestamp(): Instant { + return if(checkTimestampFile.exists()) + Instant.parse(checkTimestampFile.readText()) + else { + updateTimestamp(Instant.MIN) + Instant.MIN + } + } + } +} \ No newline at end of file From 18bf0e494a91072893f6b415d96b8f1d922afc58 Mon Sep 17 00:00:00 2001 From: voddan Date: Fri, 29 Jan 2016 21:34:59 +0300 Subject: [PATCH 8/8] replaced `wrapperProperties.versionLastChecked` with versio with `VersionCheckTimestampFile` --- .../com/beust/kobalt/misc/KobaltWrapperProperties.kt | 12 +++--------- src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt | 8 +++++--- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/KobaltWrapperProperties.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/KobaltWrapperProperties.kt index 2f92d07b..8af0da44 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/KobaltWrapperProperties.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/misc/KobaltWrapperProperties.kt @@ -4,7 +4,6 @@ import com.beust.kobalt.api.Kobalt import com.google.inject.Inject import java.io.File import java.io.FileReader -import java.time.Instant import java.util.* /** @@ -14,14 +13,12 @@ class KobaltWrapperProperties @Inject constructor() { private val WRAPPER_DIR = KFiles.KOBALT_DIR + "/wrapper" private val KOBALT_WRAPPER_PROPERTIES = "kobalt-wrapper.properties" private val PROPERTY_VERSION = "kobalt.version" - private val PROPERTY_VERSION_LAST_CHECKED = "kobalt.version.last_checked" private val PROPERTY_DOWNLOAD_URL = "kobalt.downloadUrl" - fun create(version: String, versionLastChecked: Instant) { + fun create(version: String) { log(2, "Creating $file with $version and ${defaultUrlFor(version)}") KFiles.saveFile(file, listOf( - "$PROPERTY_VERSION=$version", - "$PROPERTY_VERSION_LAST_CHECKED=$versionLastChecked" + "$PROPERTY_VERSION=$version" // "$PROPERTY_DOWNLOAD_URL=${defaultUrlFor(version)}" ).joinToString("\n")) } @@ -36,7 +33,7 @@ class KobaltWrapperProperties @Inject constructor() { get() { val config = file if (!config.exists()) { - create(Kobalt.version, Instant.MIN) + create(Kobalt.version) } val result = Properties() @@ -47,9 +44,6 @@ class KobaltWrapperProperties @Inject constructor() { val version : String get() = properties.getProperty(PROPERTY_VERSION) - val versionLastChecked: Instant - get() = Instant.parse(properties.getProperty(PROPERTY_VERSION_LAST_CHECKED)) - val downloadUrl : String get() = properties.getProperty(PROPERTY_DOWNLOAD_URL) } diff --git a/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt b/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt index f1670586..488c0d30 100644 --- a/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt +++ b/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt @@ -1,6 +1,7 @@ package com.beust.kobalt.app import com.beust.kobalt.api.Kobalt +import com.beust.kobalt.internal.build.VersionCheckTimestampFile import com.beust.kobalt.misc.* import com.beust.kobalt.wrapper.Main import java.io.File @@ -16,7 +17,8 @@ import javax.inject.Inject public class UpdateKobalt @Inject constructor(val github: GithubApi, val wrapperProperties: KobaltWrapperProperties) { fun updateKobalt() { val newVersion = github.latestKobaltVersion - wrapperProperties.create(newVersion.get(), Instant.now()) + wrapperProperties.create(newVersion.get()) + VersionCheckTimestampFile.updateTimestamp(Instant.now()) Main.main(arrayOf()) } @@ -32,7 +34,7 @@ public class UpdateKobalt @Inject constructor(val github: GithubApi, val wrapper * */ fun checkForNewVersion(latestVersionFuture: Future) { if(Kobalt.versionCheckTimeout - > Duration.between(wrapperProperties.versionLastChecked, Instant.now())) + > Duration.between(VersionCheckTimestampFile.getTimestamp(), Instant.now())) return // waits `Kobalt.versionCheckTimeout` before the next check try { @@ -50,7 +52,7 @@ public class UpdateKobalt @Inject constructor(val github: GithubApi, val wrapper } } } - wrapperProperties.create(wrapperProperties.version, Instant.now()) + VersionCheckTimestampFile.updateTimestamp(Instant.now()) } catch(ex: TimeoutException) { log(2, "Didn't get the new version in time, skipping it") }