From 012190fbfd049f56637b1039f4ae1f69becea881 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Wed, 1 Jul 2020 17:38:49 +0200 Subject: Gradle integration tests: Use dokka_it_kotlin_version over kotlin_version --- .../src/main/kotlin/org/jetbrains/DokkaVersion.kt | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'buildSrc') diff --git a/buildSrc/src/main/kotlin/org/jetbrains/DokkaVersion.kt b/buildSrc/src/main/kotlin/org/jetbrains/DokkaVersion.kt index 5bd35415..d5fd3e78 100644 --- a/buildSrc/src/main/kotlin/org/jetbrains/DokkaVersion.kt +++ b/buildSrc/src/main/kotlin/org/jetbrains/DokkaVersion.kt @@ -7,13 +7,17 @@ import org.gradle.kotlin.dsl.provideDelegate fun Project.configureDokkaVersion(): String { var dokka_version: String? by this.extra if (dokka_version == null) { - val buildNumber = System.getenv("BUILD_NUMBER") val dokka_version_base: String by this - dokka_version = dokka_version_base + if (buildNumber == null || System.getenv("FORCE_SNAPSHOT") != null) { - "-SNAPSHOT" - } else { - "-$buildNumber" - } + dokka_version = dokkaVersionFromBase(dokka_version_base) } - return dokka_version!! -} \ No newline at end of file + return checkNotNull(dokka_version) +} + +private fun dokkaVersionFromBase(baseVersion: String): String { + val buildNumber = System.getenv("BUILD_NUMBER") + val forceSnapshot = System.getenv("FORCE_SNAPSHOT") != null + if (forceSnapshot || buildNumber == null) { + return "$baseVersion-SNAPSHOT" + } + return "$baseVersion-$buildNumber" +} -- cgit