mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Version check: one second timeout.
This commit is contained in:
parent
5bc35e90cd
commit
6c279236bf
1 changed files with 16 additions and 8 deletions
|
@ -17,6 +17,8 @@ import com.google.inject.Guice
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
import java.util.concurrent.TimeoutException
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
public fun main(argv: Array<String>) {
|
public fun main(argv: Array<String>) {
|
||||||
|
@ -104,24 +106,30 @@ private class Main @Inject constructor(
|
||||||
log(1, if (result != 0) "BUILD FAILED: $result" else "BUILD SUCCESSFUL ($seconds seconds)")
|
log(1, if (result != 0) "BUILD FAILED: $result" else "BUILD SUCCESSFUL ($seconds seconds)")
|
||||||
|
|
||||||
// Check for new version
|
// Check for new version
|
||||||
val latestVersionString = latestVersionFuture.get()
|
try {
|
||||||
val latestVersion = Versions.toLongVersion(latestVersionString)
|
val latestVersionString = latestVersionFuture.get(1, TimeUnit.SECONDS)
|
||||||
val current = Versions.toLongVersion(Kobalt.version)
|
val latestVersion = Versions.toLongVersion(latestVersionString)
|
||||||
if (latestVersion > current) {
|
val current = Versions.toLongVersion(Kobalt.version)
|
||||||
listOf("", "New Kobalt version available: $latestVersionString",
|
if (latestVersion > current) {
|
||||||
"To update, run ./kobaltw --update", "").forEach {
|
listOf("", "New Kobalt version available: $latestVersionString",
|
||||||
log(1, "**** $it")
|
"To update, run ./kobaltw --update", "").forEach {
|
||||||
|
log(1, "**** $it")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch(ex: TimeoutException) {
|
||||||
|
log(2, "Didn't get the new version in time, skipping it")
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// public fun runTest() {
|
// public fun runTest() {
|
||||||
// val file = File("src\\main\\resources\\META-INF\\plugin.ml")
|
// val file = File("src\\main\\resources\\META-INF\\plugin.ml")
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private fun runWithArgs(jc: JCommander, args: Args, argv: Array<String>): Int {
|
private fun runWithArgs(jc: JCommander, args: Args, argv: Array<String>): Int {
|
||||||
|
// val file = File("/Users/beust/.kobalt/repository/com/google/guava/guava/19.0-rc2/guava-19.0-rc2.pom")
|
||||||
|
// val md5 = Md5.toMd5(file)
|
||||||
|
// val md52 = MessageDigest.getInstance("MD5").digest(file.readBytes()).toHexString()
|
||||||
var result = 0
|
var result = 0
|
||||||
val p = if (args.buildFile != null) File(args.buildFile) else findBuildFile()
|
val p = if (args.buildFile != null) File(args.buildFile) else findBuildFile()
|
||||||
args.buildFile = p.absolutePath
|
args.buildFile = p.absolutePath
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue