diff options
6 files changed, 22 insertions, 15 deletions
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" +} diff --git a/integration-tests/gradle-integration-tests/testData/androidApp/app/build.gradle b/integration-tests/gradle-integration-tests/testData/androidApp/app/build.gradle index 2420107c..0092b76c 100644 --- a/integration-tests/gradle-integration-tests/testData/androidApp/app/build.gradle +++ b/integration-tests/gradle-integration-tests/testData/androidApp/app/build.gradle @@ -42,4 +42,4 @@ android { dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib:$test_kotlin_version" dokkaRuntime files(dokka_fatjar) -}
\ No newline at end of file +} diff --git a/integration-tests/gradle/projects/it-basic/build.gradle.kts b/integration-tests/gradle/projects/it-basic/build.gradle.kts index 3e451fd3..80c2bbea 100644 --- a/integration-tests/gradle/projects/it-basic/build.gradle.kts +++ b/integration-tests/gradle/projects/it-basic/build.gradle.kts @@ -1,5 +1,3 @@ -import org.jetbrains.dokka.gradle.dokka - plugins { kotlin("jvm") id("org.jetbrains.dokka") @@ -18,5 +16,5 @@ dependencies { afterEvaluate { logger.quiet("Gradle version: ${gradle.gradleVersion}") - logger.quiet("Kotlin version: ${findProperty("kotlin_version")}") + logger.quiet("Kotlin version: ${properties["dokka_it_kotlin_version"]}") } diff --git a/integration-tests/gradle/projects/it-basic/gradle.properties b/integration-tests/gradle/projects/it-basic/gradle.properties new file mode 100644 index 00000000..7ebac3ad --- /dev/null +++ b/integration-tests/gradle/projects/it-basic/gradle.properties @@ -0,0 +1 @@ +dokka_it_kotlin_version=1.3.72 diff --git a/integration-tests/gradle/projects/it-basic/settings.gradle.kts b/integration-tests/gradle/projects/it-basic/settings.gradle.kts index 9bfd026f..10447365 100644 --- a/integration-tests/gradle/projects/it-basic/settings.gradle.kts +++ b/integration-tests/gradle/projects/it-basic/settings.gradle.kts @@ -1,11 +1,11 @@ @file:Suppress("LocalVariableName", "UnstableApiUsage") pluginManagement { - val kotlin_version = "1.3.72" + val dokka_it_kotlin_version: String by settings val dokka_version = "0.11.0-SNAPSHOT" plugins { - id("org.jetbrains.kotlin.jvm") version kotlin_version + id("org.jetbrains.kotlin.jvm") version dokka_it_kotlin_version id("org.jetbrains.dokka") version dokka_version } diff --git a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt index 34114c74..d8a9a60f 100644 --- a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt +++ b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt @@ -23,7 +23,11 @@ abstract class AbstractGradleIntegrationTest { .withProjectDir(projectDir) .withGradleVersion(buildVersions.gradleVersion) .forwardOutput() - .withArguments("-Pkotlin_version=${buildVersions.kotlinVersion}", *arguments) + .withArguments( + "-Pkotlin_version=${buildVersions.kotlinVersion}", + "-Pdokka_it_kotlin_version=${buildVersions.kotlinVersion}", + * arguments + ) .withDebug(true) } |