diff --git a/build.gradle.kts b/build.gradle.kts index ba1e9b2..8415cc5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ plugins { } group = "de.nanogiants" -version = "2.3.0" +version = "2.3.1" repositories { google() diff --git a/src/main/kotlin/de/nanogiants/gradle/VersioningPluginExtension.kt b/src/main/kotlin/de/nanogiants/gradle/VersioningPluginExtension.kt index 28a750b..0d67061 100644 --- a/src/main/kotlin/de/nanogiants/gradle/VersioningPluginExtension.kt +++ b/src/main/kotlin/de/nanogiants/gradle/VersioningPluginExtension.kt @@ -7,10 +7,14 @@ package de.nanogiants.gradle open class VersioningPluginExtension { - fun getVersionCode() = Versioning.getVersionCode() + private val lazyVersionCode by lazy { Versioning.getVersionCode() } + private val lazyVersionName by lazy { Versioning.getVersionName(false) } + private val lazyVersionNameCheckBranch by lazy { Versioning.getVersionName(true) } + + fun getVersionCode() = lazyVersionCode @JvmOverloads - fun getVersionName(checkBranch: Boolean = false) = Versioning.getVersionName(checkBranch) + fun getVersionName(checkBranch: Boolean = false) = if (checkBranch) lazyVersionNameCheckBranch else lazyVersionName var excludeBuildTypes: String? = null var keepOriginalArtifacts: Boolean = false