From a6919cd7e034fb5a53201c7c7ee219e0b13cefa5 Mon Sep 17 00:00:00 2001 From: Oleg Yukhnevich Date: Thu, 25 Apr 2024 19:03:22 +0300 Subject: [PATCH 1/7] Allow overriding a Dokka version in integration tests --- CONTRIBUTING.md | 10 ++++ .../kotlin/dokkabuild/DokkaBuildProperties.kt | 4 ++ .../gradle/build.gradle.kts | 3 ++ .../gradle/AbstractGradleIntegrationTest.kt | 49 +++++++++++++++---- 4 files changed, 57 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b3da88da3c..f6de757a27 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -105,6 +105,16 @@ However, if you need to run all integration tests locally, you can use the `inte If you need to run a specific test locally, you can run it from your IDE or by calling the corresponding Gradle task (for example, `:dokka-integration-tests:gradle:testExternalProjectKotlinxCoroutines`). +It's possible to run integration tests with a custom Dokka version published to +[MavenCentral](https://central.sonatype.com), +[dev](https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev) or +[test](https://maven.pkg.jetbrains.space/kotlin/p/dokka/test) +via `org.jetbrains.dokka.integration_test.dokkaVersionOverride` Gradle property: + +```bash +./gradlew :dokka-integration-tests:gradle:testExternalProjectKotlinxCoroutines -Porg.jetbrains.dokka.integration_test.dokkaVersionOverride=2.0.0-dev-329 +``` + ## Infrastructure ### Java version diff --git a/build-logic/src/main/kotlin/dokkabuild/DokkaBuildProperties.kt b/build-logic/src/main/kotlin/dokkabuild/DokkaBuildProperties.kt index 3ddfa4e102..0102b3d1e5 100644 --- a/build-logic/src/main/kotlin/dokkabuild/DokkaBuildProperties.kt +++ b/build-logic/src/main/kotlin/dokkabuild/DokkaBuildProperties.kt @@ -81,6 +81,10 @@ abstract class DokkaBuildProperties @Inject constructor( dokkaProperty("integration_test.useK2", String::toBoolean) .orElse(false) + /** Allows running integration tests with a custom Dokka version */ + val integrationTestDokkaVersionOverride: Provider = + dokkaProperty("integration_test.dokkaVersionOverride") { it } + val androidSdkDir: Provider = providers // first try finding a local.properties file in any parent directory diff --git a/dokka-integration-tests/gradle/build.gradle.kts b/dokka-integration-tests/gradle/build.gradle.kts index 2e11f96538..53ff4862cd 100644 --- a/dokka-integration-tests/gradle/build.gradle.kts +++ b/dokka-integration-tests/gradle/build.gradle.kts @@ -94,6 +94,9 @@ tasks.withType().configureEach { } // environment() isn't Provider API compatible yet https://github.com/gradle/gradle/issues/11534 + dokkaBuild.integrationTestDokkaVersionOverride.orNull?.let { versionOverride -> + environment("DOKKA_VERSION_OVERRIDE", versionOverride) + } dokkaBuild.integrationTestExhaustive.orNull?.let { exhaustive -> environment("isExhaustive", exhaustive) } diff --git a/dokka-integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt b/dokka-integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt index 7e1793b482..f85ba6859d 100644 --- a/dokka-integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt +++ b/dokka-integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt @@ -67,7 +67,7 @@ abstract class AbstractGradleIntegrationTest : AbstractIntegrationTest() { .withDebug(TestEnvironment.isEnabledDebug) .withArguments( listOfNotNull( - "-Pdokka_it_dokka_version=${System.getenv("DOKKA_VERSION")}", + "-Pdokka_it_dokka_version=${dokkaVersion}", "-Pdokka_it_kotlin_version=${buildVersions.kotlinVersion}", buildVersions.androidGradlePluginVersion?.let { androidVersion -> "-Pdokka_it_android_gradle_plugin_version=$androidVersion" @@ -103,6 +103,9 @@ abstract class AbstractGradleIntegrationTest : AbstractIntegrationTest() { } companion object { + private val dokkaVersionOverride: String? = System.getenv("DOKKA_VERSION_OVERRIDE") + private val dokkaVersion: String = dokkaVersionOverride ?: System.getenv("DOKKA_VERSION") + /** * Location of the template project that will be copied into [AbstractIntegrationTest.projectDir]. * @@ -120,12 +123,39 @@ abstract class AbstractGradleIntegrationTest : AbstractIntegrationTest() { val templateSettingsGradleKts: Path by systemProperty(Paths::get) /** file-based Maven repositories with Dokka dependencies */ - private val devMavenRepositories: String by systemProperty { repos -> - val repoPaths = repos.split(",").map { Paths.get(it) } + private val devMavenRepositories: List by systemProperty { repos -> + repos.split(",").map { Paths.get(it) } + } - val reposSpecs = repoPaths - .withIndex() - .joinToString(",\n") { (i, repoPath) -> + private val mavenRepositories: String by lazy { + val reposSpecs = if (dokkaVersionOverride != null) { + // if `DOKKA_VERSION_OVERRIDE` environment variable is provided, + // we allow running tests on a custom Dokka version from specific repositories + when { + // release version like `2.0.0` + !dokkaVersion.contains("-") -> "mavenCentral()" + // locally published version for testing some bug like `2.0.0-local-reproducing-bug` + dokkaVersion.contains("-local-") -> "mavenLocal()" + // dev version like `2.0.0-dev-329` + dokkaVersion.contains("-dev-") -> "maven(\"https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev\")" + // test version like `2.0.0-test-49477c44dfc58e2702f4c145ff41190b39d117fb` + dokkaVersion.contains("-test-") -> "maven(\"https://maven.pkg.jetbrains.space/kotlin/p/dokka/test\")" + else -> error( + """ + Provided Dokka version override is not supported: $dokkaVersion. + Supported versions are: + - release versions like '2.0.0' + - dev versions like `2.0.0-dev-329` + - test versions like `2.0.0-test-49477c44dfc58e2702f4c145ff41190b39d117fb` + - locally published (to mavenLocal) versions with `-local-` suffix like `2.0.0-local-reproducing-bug` + """.trimIndent() + ) + }.also { repository -> + println("Dokka version overridden with ${dokkaVersionOverride}. Using $repository for resolving Dokka") + } + } else { + // otherwise - use locally published versions via `devMavenPublish` + devMavenRepositories.withIndex().joinToString(",\n") { (i, repoPath) -> // Exclusive repository containing local Dokka artifacts. // Must be compatible with both Groovy and Kotlin DSL. /* language=kts */ @@ -136,6 +166,7 @@ abstract class AbstractGradleIntegrationTest : AbstractIntegrationTest() { |} """.trimMargin() } + } /* language=kts */ """ @@ -153,7 +184,7 @@ abstract class AbstractGradleIntegrationTest : AbstractIntegrationTest() { fun File.updateProjectLocalMavenDir() { - val dokkaDevMavenRepoMarker = "/* %{PROJECT_LOCAL_MAVEN_DIR}% */" + val dokkaMavenRepoMarker = "/* %{PROJECT_LOCAL_MAVEN_DIR}% */" // Exclusive repository containing local Dokka artifacts. // Must be compatible with both Groovy and Kotlin DSL. @@ -161,9 +192,9 @@ abstract class AbstractGradleIntegrationTest : AbstractIntegrationTest() { walk().filter { it.isFile }.forEach { file -> val fileText = file.readText() - if (dokkaDevMavenRepoMarker in fileText) { + if (dokkaMavenRepoMarker in fileText) { file.writeText( - fileText.replace(dokkaDevMavenRepoMarker, devMavenRepositories) + fileText.replace(dokkaMavenRepoMarker, mavenRepositories) ) } } From 6dbe661273cda75ca23904877e3c2ba3ce43e825 Mon Sep 17 00:00:00 2001 From: Oleg Yukhnevich Date: Tue, 7 May 2024 08:58:33 +0300 Subject: [PATCH 2/7] Add info to `ui-showcase` project --- .../gradle/projects/ui-showcase/README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dokka-integration-tests/gradle/projects/ui-showcase/README.md b/dokka-integration-tests/gradle/projects/ui-showcase/README.md index 7aff495754..a26bee4e21 100644 --- a/dokka-integration-tests/gradle/projects/ui-showcase/README.md +++ b/dokka-integration-tests/gradle/projects/ui-showcase/README.md @@ -5,9 +5,21 @@ This is a Dokka test project for UI e2e tests. The goal is to have as much variety of UI elements in one project as possible, so that during refactorings we can compare the outputs between different versions of Dokka and make sure we didn't break any corner cases. -### Run from root of the project +### Run from the root of the project ```bash export DOKKA_TEST_OUTPUT_PATH="build/ui-showcase-result" ./gradlew :dokka-integration-tests:gradle:testUiShowcaseProject ``` + +### Run with the published Dokka version + +Dokka should be published in one of the following repositories: +[MavenCentral](https://central.sonatype.com), +[dev](https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev) or +[test](https://maven.pkg.jetbrains.space/kotlin/p/dokka/test) + +```bash +export DOKKA_TEST_OUTPUT_PATH="build/ui-showcase-result" +./gradlew :dokka-integration-tests:gradle:testUiShowcaseProject -Porg.jetbrains.dokka.integration_test.dokkaVersionOverride=2.0.0-dev-329 +``` From 605f75315134a79f46cccaf111e07be70b86a88c Mon Sep 17 00:00:00 2001 From: Oleg Yukhnevich Date: Wed, 8 May 2024 11:50:22 +0300 Subject: [PATCH 3/7] Fix after a property change integration test task is still up-to-date --- dokka-integration-tests/gradle/build.gradle.kts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/dokka-integration-tests/gradle/build.gradle.kts b/dokka-integration-tests/gradle/build.gradle.kts index 53ff4862cd..b4b8688832 100644 --- a/dokka-integration-tests/gradle/build.gradle.kts +++ b/dokka-integration-tests/gradle/build.gradle.kts @@ -94,16 +94,15 @@ tasks.withType().configureEach { } // environment() isn't Provider API compatible yet https://github.com/gradle/gradle/issues/11534 - dokkaBuild.integrationTestDokkaVersionOverride.orNull?.let { versionOverride -> - environment("DOKKA_VERSION_OVERRIDE", versionOverride) - } - dokkaBuild.integrationTestExhaustive.orNull?.let { exhaustive -> - environment("isExhaustive", exhaustive) - } - dokkaBuild.androidSdkDir.orNull?.let { androidSdkDir -> - environment("ANDROID_HOME", androidSdkDir.invariantSeparatorsPath) + fun environmentProvider(name: String, provider: Provider) { + inputs.property(name, provider) + provider.orNull?.let { environment(name, it) } } + environmentProvider("DOKKA_VERSION_OVERRIDE", dokkaBuild.integrationTestDokkaVersionOverride) + environmentProvider("isExhaustive", dokkaBuild.integrationTestExhaustive) + environmentProvider("ANDROID_HOME", dokkaBuild.androidSdkDir.map { it.invariantSeparatorsPath }) + testLogging { exceptionFormat = FULL events(SKIPPED, FAILED) From 743358aa8a6f84ef36ee79451477e3a6032ba87b Mon Sep 17 00:00:00 2001 From: Oleg Yukhnevich Date: Wed, 8 May 2024 11:50:30 +0300 Subject: [PATCH 4/7] Add info about mavenLocal --- CONTRIBUTING.md | 7 ++++--- .../gradle/projects/ui-showcase/README.md | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f6de757a27..3113112b2f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -105,10 +105,11 @@ However, if you need to run all integration tests locally, you can use the `inte If you need to run a specific test locally, you can run it from your IDE or by calling the corresponding Gradle task (for example, `:dokka-integration-tests:gradle:testExternalProjectKotlinxCoroutines`). -It's possible to run integration tests with a custom Dokka version published to +It's possible to run integration tests with a custom Dokka version published to [MavenCentral](https://central.sonatype.com), -[dev](https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev) or -[test](https://maven.pkg.jetbrains.space/kotlin/p/dokka/test) +[dev](https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev), +[test](https://maven.pkg.jetbrains.space/kotlin/p/dokka/test) or +`mavenLocal` (in this case the version should contain `-local-` suffix, f.e `2.0.0-local-reproducing-bug`) via `org.jetbrains.dokka.integration_test.dokkaVersionOverride` Gradle property: ```bash diff --git a/dokka-integration-tests/gradle/projects/ui-showcase/README.md b/dokka-integration-tests/gradle/projects/ui-showcase/README.md index a26bee4e21..39d4c1629a 100644 --- a/dokka-integration-tests/gradle/projects/ui-showcase/README.md +++ b/dokka-integration-tests/gradle/projects/ui-showcase/README.md @@ -16,8 +16,9 @@ export DOKKA_TEST_OUTPUT_PATH="build/ui-showcase-result" Dokka should be published in one of the following repositories: [MavenCentral](https://central.sonatype.com), -[dev](https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev) or -[test](https://maven.pkg.jetbrains.space/kotlin/p/dokka/test) +[dev](https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev), +[test](https://maven.pkg.jetbrains.space/kotlin/p/dokka/test) or +`mavenLocal` (in this case the version should contain `-local-` suffix, f.e `2.0.0-local-reproducing-bug`) ```bash export DOKKA_TEST_OUTPUT_PATH="build/ui-showcase-result" From 5c977237df2b4cf4f9230ff6bb9d6d01ec606f7f Mon Sep 17 00:00:00 2001 From: Oleg Yukhnevich Date: Wed, 8 May 2024 11:56:03 +0300 Subject: [PATCH 5/7] fix optional properties --- dokka-integration-tests/gradle/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dokka-integration-tests/gradle/build.gradle.kts b/dokka-integration-tests/gradle/build.gradle.kts index b4b8688832..fa87425eca 100644 --- a/dokka-integration-tests/gradle/build.gradle.kts +++ b/dokka-integration-tests/gradle/build.gradle.kts @@ -95,7 +95,7 @@ tasks.withType().configureEach { // environment() isn't Provider API compatible yet https://github.com/gradle/gradle/issues/11534 fun environmentProvider(name: String, provider: Provider) { - inputs.property(name, provider) + inputs.property(name, provider).optional(true) provider.orNull?.let { environment(name, it) } } From d511ae49c3ed8a5242075a0c6368b5a1ee66ece6 Mon Sep 17 00:00:00 2001 From: Oleg Yukhnevich Date: Mon, 13 May 2024 15:34:53 +0300 Subject: [PATCH 6/7] rename PROJECT_LOCAL_MAVEN_DIR -> DOKKA_IT_MAVEN_REPO --- .../gradle/projects/coroutines/coroutines.diff | 10 +++++----- .../projects/serialization/serialization.diff | 14 +++++++------- .../gradle/projects/template.settings.gradle.kts | 4 ++-- .../it/gradle/AbstractGradleIntegrationTest.kt | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dokka-integration-tests/gradle/projects/coroutines/coroutines.diff b/dokka-integration-tests/gradle/projects/coroutines/coroutines.diff index 0f03057015..09540912e5 100644 --- a/dokka-integration-tests/gradle/projects/coroutines/coroutines.diff +++ b/dokka-integration-tests/gradle/projects/coroutines/coroutines.diff @@ -6,7 +6,7 @@ index e7d405e12..db5dcec66 100644 } repositories { -+ /* %{PROJECT_LOCAL_MAVEN_DIR}% */ ++ /* %{DOKKA_IT_MAVEN_REPO}% */ mavenCentral() maven { url "https://plugins.gradle.org/m2/" } CommunityProjectsBuild.addDevRepositoryIfEnabled(delegate, project) @@ -54,7 +54,7 @@ index e7d405e12..db5dcec66 100644 // Configure repositories allprojects { repositories { -+ /* %{PROJECT_LOCAL_MAVEN_DIR}% */ ++ /* %{DOKKA_IT_MAVEN_REPO}% */ /* * google should be first in the repository list because some of the play services * transitive dependencies was removed from jcenter, thus breaking gradle dependency resolution @@ -80,7 +80,7 @@ index ae54ad0f6..00963f5b2 100644 val kotlinDevUrl = project.rootProject.properties["kotlin_repo_url"] as? String repositories { -+ /* %{PROJECT_LOCAL_MAVEN_DIR}% */ ++ /* %{DOKKA_IT_MAVEN_REPO}% */ mavenCentral() if (cacheRedirectorEnabled) { maven("https://cache-redirector.jetbrains.com/plugins.gradle.org/m2") @@ -120,7 +120,7 @@ index c2e859f65..9cc749a1f 100644 pluginManagement { val build_snapshot_train: String? by settings repositories { -+ /* %{PROJECT_LOCAL_MAVEN_DIR}% */ ++ /* %{DOKKA_IT_MAVEN_REPO}% */ val cacheRedirectorEnabled = System.getenv("CACHE_REDIRECTOR")?.toBoolean() == true if (cacheRedirectorEnabled) { println("Redirecting repositories for buildSrc buildscript") @@ -177,7 +177,7 @@ index 151c087fd..e4433c24f 100644 repositories { - maven { url "https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev/" } -+ /* %{PROJECT_LOCAL_MAVEN_DIR}% */ ++ /* %{DOKKA_IT_MAVEN_REPO}% */ + //maven { url "https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev/" } gradlePluginPortal() } diff --git a/dokka-integration-tests/gradle/projects/serialization/serialization.diff b/dokka-integration-tests/gradle/projects/serialization/serialization.diff index da51d8667e..31c7ac8fe2 100644 --- a/dokka-integration-tests/gradle/projects/serialization/serialization.diff +++ b/dokka-integration-tests/gradle/projects/serialization/serialization.diff @@ -7,7 +7,7 @@ index 73b566ae..e2af43bd 100644 repositories { - maven { url 'https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev' } -+ /* %{PROJECT_LOCAL_MAVEN_DIR}% */ ++ /* %{DOKKA_IT_MAVEN_REPO}% */ + //maven { url 'https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev' } // kotlin-dev with space redirector maven { url "https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" } @@ -61,7 +61,7 @@ index 73b566ae..e2af43bd 100644 // Snapshot-specific repositories { - mavenLocal() -+ /* %{PROJECT_LOCAL_MAVEN_DIR}% */ ++ /* %{DOKKA_IT_MAVEN_REPO}% */ + //mavenLocal() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } @@ -70,7 +70,7 @@ index 73b566ae..e2af43bd 100644 } repositories { -+ /* %{PROJECT_LOCAL_MAVEN_DIR}% */ ++ /* %{DOKKA_IT_MAVEN_REPO}% */ mavenCentral() - maven { url 'https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev' } + //maven { url 'https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev' } @@ -92,7 +92,7 @@ index c999bcd2..98afdae7 100644 } repositories { -+ /* %{PROJECT_LOCAL_MAVEN_DIR}% */ ++ /* %{DOKKA_IT_MAVEN_REPO}% */ mavenCentral() - mavenLocal() + //mavenLocal() @@ -143,7 +143,7 @@ index dda68347..119c321a 100644 repositories { - mavenLocal() -+ /* %{PROJECT_LOCAL_MAVEN_DIR}% */ ++ /* %{DOKKA_IT_MAVEN_REPO}% */ + //mavenLocal() mavenCentral() maven { url "https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" } @@ -153,7 +153,7 @@ index dda68347..119c321a 100644 repositories { - mavenLocal() -+ /* %{PROJECT_LOCAL_MAVEN_DIR}% */ ++ /* %{DOKKA_IT_MAVEN_REPO}% */ + //mavenLocal() mavenCentral() maven { url "https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" } @@ -166,7 +166,7 @@ index f8cb2d87..beebf995 100644 } repositories { -+ /* %{PROJECT_LOCAL_MAVEN_DIR}% */ ++ /* %{DOKKA_IT_MAVEN_REPO}% */ mavenCentral() maven { url 'https://plugins.gradle.org/m2/' } maven { url "https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" } diff --git a/dokka-integration-tests/gradle/projects/template.settings.gradle.kts b/dokka-integration-tests/gradle/projects/template.settings.gradle.kts index 05d176a6ae..663399a7a4 100644 --- a/dokka-integration-tests/gradle/projects/template.settings.gradle.kts +++ b/dokka-integration-tests/gradle/projects/template.settings.gradle.kts @@ -36,7 +36,7 @@ pluginManagement { } } repositories { - /* %{PROJECT_LOCAL_MAVEN_DIR}% */ + /* %{DOKKA_IT_MAVEN_REPO}% */ mavenCentral() gradlePluginPortal() google() @@ -47,7 +47,7 @@ pluginManagement { dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) repositories { - /* %{PROJECT_LOCAL_MAVEN_DIR}% */ + /* %{DOKKA_IT_MAVEN_REPO}% */ mavenCentral() google() maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven") { diff --git a/dokka-integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt b/dokka-integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt index f85ba6859d..0af61ccfbb 100644 --- a/dokka-integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt +++ b/dokka-integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt @@ -184,7 +184,7 @@ abstract class AbstractGradleIntegrationTest : AbstractIntegrationTest() { fun File.updateProjectLocalMavenDir() { - val dokkaMavenRepoMarker = "/* %{PROJECT_LOCAL_MAVEN_DIR}% */" + val dokkaMavenRepoMarker = "/* %{DOKKA_IT_MAVEN_REPO}% */" // Exclusive repository containing local Dokka artifacts. // Must be compatible with both Groovy and Kotlin DSL. From c92c8c5c4132efe581d2203de93ac0b85dbcb1b7 Mon Sep 17 00:00:00 2001 From: Oleg Yukhnevich Date: Mon, 13 May 2024 15:37:19 +0300 Subject: [PATCH 7/7] Simplify repositories specification in test --- CONTRIBUTING.md | 2 +- .../gradle/projects/ui-showcase/README.md | 2 +- .../gradle/AbstractGradleIntegrationTest.kt | 29 +++++-------------- 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3113112b2f..3973619dcb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -109,7 +109,7 @@ It's possible to run integration tests with a custom Dokka version published to [MavenCentral](https://central.sonatype.com), [dev](https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev), [test](https://maven.pkg.jetbrains.space/kotlin/p/dokka/test) or -`mavenLocal` (in this case the version should contain `-local-` suffix, f.e `2.0.0-local-reproducing-bug`) +`mavenLocal` via `org.jetbrains.dokka.integration_test.dokkaVersionOverride` Gradle property: ```bash diff --git a/dokka-integration-tests/gradle/projects/ui-showcase/README.md b/dokka-integration-tests/gradle/projects/ui-showcase/README.md index 39d4c1629a..0ef78cee47 100644 --- a/dokka-integration-tests/gradle/projects/ui-showcase/README.md +++ b/dokka-integration-tests/gradle/projects/ui-showcase/README.md @@ -18,7 +18,7 @@ Dokka should be published in one of the following repositories: [MavenCentral](https://central.sonatype.com), [dev](https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev), [test](https://maven.pkg.jetbrains.space/kotlin/p/dokka/test) or -`mavenLocal` (in this case the version should contain `-local-` suffix, f.e `2.0.0-local-reproducing-bug`) +`mavenLocal` ```bash export DOKKA_TEST_OUTPUT_PATH="build/ui-showcase-result" diff --git a/dokka-integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt b/dokka-integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt index 0af61ccfbb..18539b2cf1 100644 --- a/dokka-integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt +++ b/dokka-integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt @@ -129,30 +129,15 @@ abstract class AbstractGradleIntegrationTest : AbstractIntegrationTest() { private val mavenRepositories: String by lazy { val reposSpecs = if (dokkaVersionOverride != null) { + println("Dokka version overridden with $dokkaVersionOverride") // if `DOKKA_VERSION_OVERRIDE` environment variable is provided, // we allow running tests on a custom Dokka version from specific repositories - when { - // release version like `2.0.0` - !dokkaVersion.contains("-") -> "mavenCentral()" - // locally published version for testing some bug like `2.0.0-local-reproducing-bug` - dokkaVersion.contains("-local-") -> "mavenLocal()" - // dev version like `2.0.0-dev-329` - dokkaVersion.contains("-dev-") -> "maven(\"https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev\")" - // test version like `2.0.0-test-49477c44dfc58e2702f4c145ff41190b39d117fb` - dokkaVersion.contains("-test-") -> "maven(\"https://maven.pkg.jetbrains.space/kotlin/p/dokka/test\")" - else -> error( - """ - Provided Dokka version override is not supported: $dokkaVersion. - Supported versions are: - - release versions like '2.0.0' - - dev versions like `2.0.0-dev-329` - - test versions like `2.0.0-test-49477c44dfc58e2702f4c145ff41190b39d117fb` - - locally published (to mavenLocal) versions with `-local-` suffix like `2.0.0-local-reproducing-bug` - """.trimIndent() - ) - }.also { repository -> - println("Dokka version overridden with ${dokkaVersionOverride}. Using $repository for resolving Dokka") - } + """ + maven("https://maven.pkg.jetbrains.space/kotlin/p/dokka/test"), + maven("https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev"), + mavenCentral(), + mavenLocal() + """.trimIndent() } else { // otherwise - use locally published versions via `devMavenPublish` devMavenRepositories.withIndex().joinToString(",\n") { (i, repoPath) ->