From 930caf73bfc221d5da24e2db75db14ee67ab5094 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Wed, 23 Mar 2016 15:32:15 +0400 Subject: [PATCH] Make these lazy. --- .../src/main/kotlin/com/beust/kobalt/api/Kobalt.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 bb3eae86..f0f39681 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 @@ -8,7 +8,7 @@ import java.io.InputStream import java.time.Duration import java.util.* -public class Kobalt { +class Kobalt { companion object { // This injector will eventually be replaced with a different injector initialized with the // correct arguments (or with a TestModule) but it's necessary to give it a default value @@ -83,10 +83,12 @@ public class Kobalt { properties.forEach { es -> System.setProperty(es.key.toString(), es.value.toString()) } } - val version = kobaltProperties.getProperty(PROPERTY_KOBALT_VERSION) + val version: String + get() = kobaltProperties.getProperty(PROPERTY_KOBALT_VERSION) + // Note: Duration is Java 8 only, might need an alternative if we want to support Java < 8 - val versionCheckTimeout = Duration.parse( - kobaltProperties.getProperty(PROPERTY_KOBALT_VERSION_CHECK_TIMEOUT) ?: "P1D") + val versionCheckTimeout: Duration + get() = Duration.parse( kobaltProperties.getProperty(PROPERTY_KOBALT_VERSION_CHECK_TIMEOUT) ?: "P1D") fun findPlugin(name: String) = Plugins.findPlugin(name) }