Skip to content

Commit

Permalink
log dokka config
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-enko committed Nov 26, 2024
1 parent f582d0d commit b58d42f
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -34,6 +31,7 @@ class KotlinMultiplatformIT {
project.runner
.addArguments(
":dokkaGenerate",
"--rerun-tasks", // TODO remove before merging
)
.build {
withClue("expect project builds successfully") {
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ fun ProjectDirectoryScope.file(
): Path = projectDir.resolve(path)


fun ProjectDirectoryScope.findFiles(matcher: (File) -> Boolean): Sequence<File> =
projectDir.toFile().walk().filter(matcher)
fun ProjectDirectoryScope.findFiles(matcher: (Path) -> Boolean): Sequence<Path> =
projectDir.walk().filter(matcher)


/** Set the content of `settings.gradle.kts` */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b58d42f

Please sign in to comment.