From b58d42f5b19263ef3a113c5062d73de9310aa884 Mon Sep 17 00:00:00 2001 From: Adam Semenenko <152864218+adam-enko@users.noreply.github.com> Date: Tue, 26 Nov 2024 12:53:27 +0100 Subject: [PATCH] log dokka config --- .../src/test/kotlin/AndroidComposeIT.kt | 4 ++- .../src/test/kotlin/AndroidProjectIT.kt | 3 ++ .../src/test/kotlin/KotlinMultiplatformIT.kt | 32 +++++++++---------- .../kotlin/ExampleProjectsTest.kt | 6 ++-- .../testFixtures/kotlin/GradleTestKitUtils.kt | 4 +-- .../KotlinMultiplatformFunctionalTest.kt | 2 ++ .../kotlin/MultiModuleFunctionalTest.kt | 1 + 7 files changed, 29 insertions(+), 23 deletions(-) diff --git a/dokka-integration-tests/gradle/src/test/kotlin/AndroidComposeIT.kt b/dokka-integration-tests/gradle/src/test/kotlin/AndroidComposeIT.kt index ead53fa2c4..5caf8ddb79 100644 --- a/dokka-integration-tests/gradle/src/test/kotlin/AndroidComposeIT.kt +++ b/dokka-integration-tests/gradle/src/test/kotlin/AndroidComposeIT.kt @@ -6,7 +6,7 @@ package org.jetbrains.dokka.it.gradle import io.kotest.assertions.asClue import io.kotest.assertions.withClue import io.kotest.inspectors.shouldForAll -import io.kotest.matchers.file.shouldBeAFile +import io.kotest.matchers.paths.shouldBeAFile import io.kotest.matchers.shouldBe import io.kotest.matchers.string.shouldContain import io.kotest.matchers.string.shouldNotContain @@ -16,6 +16,8 @@ import org.jetbrains.dokka.gradle.utils.addArguments import org.jetbrains.dokka.gradle.utils.build import org.jetbrains.dokka.it.gradle.junit.* import kotlin.io.path.deleteRecursively +import kotlin.io.path.name +import kotlin.io.path.readText /** * Integration test for the `it-android-compose` project. diff --git a/dokka-integration-tests/gradle/src/test/kotlin/AndroidProjectIT.kt b/dokka-integration-tests/gradle/src/test/kotlin/AndroidProjectIT.kt index aa1578306e..584e1cfcf3 100644 --- a/dokka-integration-tests/gradle/src/test/kotlin/AndroidProjectIT.kt +++ b/dokka-integration-tests/gradle/src/test/kotlin/AndroidProjectIT.kt @@ -7,6 +7,7 @@ import io.kotest.assertions.asClue import io.kotest.assertions.withClue import io.kotest.inspectors.shouldForAll import io.kotest.matchers.file.shouldBeAFile +import io.kotest.matchers.paths.shouldBeAFile import io.kotest.matchers.shouldBe import io.kotest.matchers.string.shouldContain import io.kotest.matchers.string.shouldNotContain @@ -16,6 +17,8 @@ import org.jetbrains.dokka.gradle.utils.addArguments import org.jetbrains.dokka.gradle.utils.build import org.jetbrains.dokka.it.gradle.junit.* import kotlin.io.path.deleteRecursively +import kotlin.io.path.name +import kotlin.io.path.readText /** * Integration test for the `it-android` project. diff --git a/dokka-integration-tests/gradle/src/test/kotlin/KotlinMultiplatformIT.kt b/dokka-integration-tests/gradle/src/test/kotlin/KotlinMultiplatformIT.kt index ffa3c81831..b8c3334e13 100644 --- a/dokka-integration-tests/gradle/src/test/kotlin/KotlinMultiplatformIT.kt +++ b/dokka-integration-tests/gradle/src/test/kotlin/KotlinMultiplatformIT.kt @@ -17,10 +17,7 @@ import org.jetbrains.dokka.it.gradle.junit.DokkaGradleProjectRunner import org.jetbrains.dokka.it.gradle.junit.TestsDGPv2 import org.jetbrains.dokka.it.gradle.junit.TestsKotlinMultiplatform import org.junit.jupiter.api.Disabled -import kotlin.io.path.deleteRecursively -import kotlin.io.path.isRegularFile -import kotlin.io.path.useLines -import kotlin.io.path.walk +import kotlin.io.path.* /** * Integration test for the `it-kotlin-multiplatform` project. @@ -34,6 +31,7 @@ class KotlinMultiplatformIT { project.runner .addArguments( ":dokkaGenerate", + "--rerun-tasks", // TODO remove before merging ) .build { withClue("expect project builds successfully") { @@ -45,24 +43,24 @@ class KotlinMultiplatformIT { val expectedHtml = project.projectDir.resolve("expectedData/html") val actualHtmlDir = project.projectDir.resolve("build/dokka/html") - val dokkaConfigurationJsons = project.findFiles { it.name == "dokka-configuration.json" } + val dokkaConfigurationJsons = project + .findFiles { it.name == "dokka-configuration.json" } .joinToString("\n\n") { - buildString { - """ - --- - ${it.invariantSeparatorsPath} - ${it.readText()} - --- - """.trimIndent() - }.prependIndent() + """ + --- + ${it.invariantSeparatorsPathString} + ${it.readText()} + --- + """.trimIndent() } withClue( """ - expectedHtml: ${expectedHtml.toUri()} - actualHtmlDir: ${actualHtmlDir.toUri()} - dokkaConfigurationJsons: $dokkaConfigurationJsons - """.trimIndent() + |expectedHtml: ${expectedHtml.toUri()} + |actualHtmlDir: ${actualHtmlDir.toUri()} + |dokkaConfigurationJsons: + |$dokkaConfigurationJsons + """.trimMargin() ) { val expectedFileTree = expectedHtml.toTreeString() val actualFileTree = actualHtmlDir.toTreeString() diff --git a/dokka-integration-tests/gradle/src/testExampleProjects/kotlin/ExampleProjectsTest.kt b/dokka-integration-tests/gradle/src/testExampleProjects/kotlin/ExampleProjectsTest.kt index 84ace5e0bf..fe36d458be 100644 --- a/dokka-integration-tests/gradle/src/testExampleProjects/kotlin/ExampleProjectsTest.kt +++ b/dokka-integration-tests/gradle/src/testExampleProjects/kotlin/ExampleProjectsTest.kt @@ -317,9 +317,9 @@ class ExampleProjectsTest { fun `test configuration cache`(testCase: TestCase) { // delete old configuration cache results and reports, to make sure we can fetch the newest report testCase.project.findFiles { - val isCCDir = it.invariantSeparatorsPath.endsWith(".gradle/configuration-cache") - val isCCReportDir = it.invariantSeparatorsPath.endsWith("build/reports/configuration-cache") - it.isDirectory && (isCCReportDir || isCCDir) + val isCCDir = it.invariantSeparatorsPathString.endsWith(".gradle/configuration-cache") + val isCCReportDir = it.invariantSeparatorsPathString.endsWith("build/reports/configuration-cache") + it.isDirectory() && (isCCReportDir || isCCDir) }.forEach { it.deleteRecursively() } val configCacheRunner: GradleRunner = diff --git a/dokka-runners/dokka-gradle-plugin/src/testFixtures/kotlin/GradleTestKitUtils.kt b/dokka-runners/dokka-gradle-plugin/src/testFixtures/kotlin/GradleTestKitUtils.kt index 2590c4c809..78469651a2 100644 --- a/dokka-runners/dokka-gradle-plugin/src/testFixtures/kotlin/GradleTestKitUtils.kt +++ b/dokka-runners/dokka-gradle-plugin/src/testFixtures/kotlin/GradleTestKitUtils.kt @@ -285,8 +285,8 @@ fun ProjectDirectoryScope.file( ): Path = projectDir.resolve(path) -fun ProjectDirectoryScope.findFiles(matcher: (File) -> Boolean): Sequence = - projectDir.toFile().walk().filter(matcher) +fun ProjectDirectoryScope.findFiles(matcher: (Path) -> Boolean): Sequence = + projectDir.walk().filter(matcher) /** Set the content of `settings.gradle.kts` */ diff --git a/dokka-runners/dokka-gradle-plugin/src/testFunctional/kotlin/KotlinMultiplatformFunctionalTest.kt b/dokka-runners/dokka-gradle-plugin/src/testFunctional/kotlin/KotlinMultiplatformFunctionalTest.kt index e3246a4e92..c669628ea5 100644 --- a/dokka-runners/dokka-gradle-plugin/src/testFunctional/kotlin/KotlinMultiplatformFunctionalTest.kt +++ b/dokka-runners/dokka-gradle-plugin/src/testFunctional/kotlin/KotlinMultiplatformFunctionalTest.kt @@ -8,12 +8,14 @@ import io.kotest.core.spec.style.FunSpec import io.kotest.inspectors.shouldForAll import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder import io.kotest.matchers.file.shouldBeAFile +import io.kotest.matchers.paths.shouldBeAFile import io.kotest.matchers.sequences.shouldNotBeEmpty import io.kotest.matchers.string.shouldContain import io.kotest.matchers.string.shouldNotContain import org.jetbrains.dokka.gradle.internal.DokkaConstants import org.jetbrains.dokka.gradle.utils.* import kotlin.io.path.extension +import kotlin.io.path.name import kotlin.io.path.readText class KotlinMultiplatformFunctionalTest : FunSpec({ diff --git a/dokka-runners/dokka-gradle-plugin/src/testFunctional/kotlin/MultiModuleFunctionalTest.kt b/dokka-runners/dokka-gradle-plugin/src/testFunctional/kotlin/MultiModuleFunctionalTest.kt index d07bc9cbd1..9d0c278150 100644 --- a/dokka-runners/dokka-gradle-plugin/src/testFunctional/kotlin/MultiModuleFunctionalTest.kt +++ b/dokka-runners/dokka-gradle-plugin/src/testFunctional/kotlin/MultiModuleFunctionalTest.kt @@ -11,6 +11,7 @@ import io.kotest.matchers.collections.shouldContainAll import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder import io.kotest.matchers.collections.shouldNotBeEmpty import io.kotest.matchers.file.shouldBeAFile +import io.kotest.matchers.paths.shouldBeAFile import io.kotest.matchers.paths.shouldNotExist import io.kotest.matchers.sequences.shouldNotBeEmpty import io.kotest.matchers.shouldBe