From b3913d0b32e90bee2ccd9fe7325b20be561851a2 Mon Sep 17 00:00:00 2001 From: IgnatBeresnev Date: Fri, 27 Oct 2023 02:17:16 +0200 Subject: [PATCH] Make integration tests runnable from IDEA --- .../main/kotlin/dokkabuild.kotlin-jvm.gradle.kts | 15 +++++++++++---- build.gradle.kts | 6 ++++++ dokka-integration-tests/cli/build.gradle.kts | 1 + dokka-integration-tests/maven/build.gradle.kts | 1 + 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/build-logic/src/main/kotlin/dokkabuild.kotlin-jvm.gradle.kts b/build-logic/src/main/kotlin/dokkabuild.kotlin-jvm.gradle.kts index 7e861f0c6f..796ce6c9d2 100644 --- a/build-logic/src/main/kotlin/dokkabuild.kotlin-jvm.gradle.kts +++ b/build-logic/src/main/kotlin/dokkabuild.kotlin-jvm.gradle.kts @@ -7,16 +7,23 @@ plugins { kotlin("jvm") } +val rootProjectsWithoutDependencyOnDokkaCore = listOf("dokka-integration-tests") + kotlin { explicitApi() compilerOptions { allWarningsAsErrors.set(true) languageVersion.set(dokkaBuild.kotlinLanguageLevel) apiVersion.set(dokkaBuild.kotlinLanguageLevel) - optIn.addAll( - "kotlin.RequiresOptIn", - "org.jetbrains.dokka.InternalDokkaApi" - ) + + // These projects know nothing about the `@InternalDokkaApi` annotation, so the Kotlin compiler + // will complain about an unresolved opt-in requirement marker and fail the build if it's not excluded. + if (rootProject.name !in rootProjectsWithoutDependencyOnDokkaCore) { + optIn.addAll( + "kotlin.RequiresOptIn", + "org.jetbrains.dokka.InternalDokkaApi" + ) + } freeCompilerArgs.addAll( // need 1.4 support, otherwise there might be problems diff --git a/build.gradle.kts b/build.gradle.kts index 63d78d9f0e..c1808dd6e7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -26,6 +26,12 @@ registerParentTaskOfIncludedBuilds("publishPlugins", groupName = "publication") it.name in listOf("gradle-plugin-classic") } +tasks.register("integrationTest") { + group = "verification" + description = "Runs integration tests of this project. Might take a while and require additional setup." + dependsOn(gradle.includedBuilds.single { it.name == "dokka-integration-tests" }.task(":integrationTest")) +} + fun addDependencyOnSameTaskOfIncludedBuilds(existingTaskName: String, filter: (IncludedBuild) -> Boolean = { true }) { tasks.named(existingTaskName) { dependsOn(includedBuildTasks(existingTaskName, filter)) diff --git a/dokka-integration-tests/cli/build.gradle.kts b/dokka-integration-tests/cli/build.gradle.kts index 5262cdb8bb..fda35071be 100644 --- a/dokka-integration-tests/cli/build.gradle.kts +++ b/dokka-integration-tests/cli/build.gradle.kts @@ -11,6 +11,7 @@ plugins { dependencies { implementation(kotlin("test-junit5")) + implementation(libs.junit.jupiterApi) implementation(projects.utilities) } diff --git a/dokka-integration-tests/maven/build.gradle.kts b/dokka-integration-tests/maven/build.gradle.kts index f916754551..7b9c651479 100644 --- a/dokka-integration-tests/maven/build.gradle.kts +++ b/dokka-integration-tests/maven/build.gradle.kts @@ -11,6 +11,7 @@ dependencies { implementation(projects.utilities) implementation(kotlin("test-junit5")) + implementation(libs.junit.jupiterApi) } val dokkaSubprojects = gradle.includedBuild("dokka-subprojects")