aboutsummaryrefslogtreecommitdiff
path: root/integration-tests
diff options
context:
space:
mode:
Diffstat (limited to 'integration-tests')
-rw-r--r--integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicCachingIntegrationTest.kt35
-rw-r--r--integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/GradleRelocatedCachingIntegrationTest.kt6
2 files changed, 35 insertions, 6 deletions
diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicCachingIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicCachingIntegrationTest.kt
index f47f7e2a..ada6c26c 100644
--- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicCachingIntegrationTest.kt
+++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicCachingIntegrationTest.kt
@@ -20,8 +20,39 @@ class BasicCachingIntegrationTest(override val versions: BuildVersions) : Abstra
@Test
fun execute() {
+ runAndAssertOutcomeAndContents(TaskOutcome.SUCCESS)
+ runAndAssertOutcomeAndContents(TaskOutcome.FROM_CACHE)
+ }
+
+ @Test
+ fun localDirectoryPointingToRoot() {
+ fun String.findAndReplace(oldValue: String, newValue: String): String {
+ assertTrue(oldValue in this, "Expected to replace '$oldValue'")
+ return replace(oldValue, newValue)
+ }
+ val projectKts = projectDir.resolve("build.gradle.kts")
+
+ projectKts.readText()
+ .findAndReplace("localDirectory.set(file(\"src/main\"))", "localDirectory.set(projectDir)")
+ .findAndReplace("integration-tests/gradle/projects/it-basic/src/main", "integration-tests/gradle/projects/it-basic")
+ .also { projectKts.writeText(it) }
+
+ runAndAssertOutcomeAndContents(TaskOutcome.SUCCESS)
+ projectDir.resolve("unrelated.txt").writeText("modified")
+ // despite projectDir is used as an input in localDirectory, changing its contents shouldn't invalidate the cache
+ runAndAssertOutcomeAndContents(TaskOutcome.FROM_CACHE)
+
+ projectKts.readText()
+ .findAndReplace("localDirectory.set(projectDir)", "localDirectory.set(file(\"src\"))")
+ .also { projectKts.writeText(it) }
+ // changing localDirectory path invalidates cached task results
runAndAssertOutcome(TaskOutcome.SUCCESS)
- runAndAssertOutcome(TaskOutcome.FROM_CACHE)
+ }
+
+
+ private fun runAndAssertOutcomeAndContents(expectedOutcome: TaskOutcome) {
+ runAndAssertOutcome(expectedOutcome)
+ File(projectDir, "build/dokka/html").assertHtmlOutputDir()
}
private fun runAndAssertOutcome(expectedOutcome: TaskOutcome) {
@@ -35,7 +66,5 @@ class BasicCachingIntegrationTest(override val versions: BuildVersions) : Abstra
).buildRelaxed()
assertEquals(expectedOutcome, assertNotNull(result.task(":dokkaHtml")).outcome)
-
- File(projectDir, "build/dokka/html").assertHtmlOutputDir()
}
}
diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/GradleRelocatedCachingIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/GradleRelocatedCachingIntegrationTest.kt
index 28b8d22c..2ac129af 100644
--- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/GradleRelocatedCachingIntegrationTest.kt
+++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/GradleRelocatedCachingIntegrationTest.kt
@@ -21,11 +21,11 @@ class GradleRelocatedCachingIntegrationTest(override val versions: BuildVersions
@Test
fun execute() {
- runAndAssertOutcome(projectFolder(1), TaskOutcome.SUCCESS)
- runAndAssertOutcome(projectFolder(2), TaskOutcome.FROM_CACHE)
+ runAndAssertOutcomeAndContents(projectFolder(1), TaskOutcome.SUCCESS)
+ runAndAssertOutcomeAndContents(projectFolder(2), TaskOutcome.FROM_CACHE)
}
- private fun runAndAssertOutcome(project: File, expectedOutcome: TaskOutcome) {
+ private fun runAndAssertOutcomeAndContents(project: File, expectedOutcome: TaskOutcome) {
val result = createGradleRunner("clean", "dokkaHtml", "-i", "-s", "-Dorg.gradle.caching.debug=true", "--build-cache")
.withProjectDir(project)
.buildRelaxed()