From f39971875c4f7d98dc1add2a8ed949d22b25600b Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Mon, 20 Jul 2020 14:20:17 +0200 Subject: Re-introduce default DokkaCollectorTask, run on all submodules by default, add Collector0IntegrationTest --- .../it/gradle/Android0GradleIntegrationTest.kt | 2 +- .../dokka/it/gradle/BasicGradleIntegrationTest.kt | 6 +- .../dokka/it/gradle/BasicGroovyIntegrationTest.kt | 2 +- .../dokka/it/gradle/Collector0IntegrationTest.kt | 79 ++++++++++++++++++++++ .../dokka/it/gradle/Multimodule0IntegrationTest.kt | 2 +- .../gradle/Multiplatform0GradleIntegrationTest.kt | 2 +- 6 files changed, 86 insertions(+), 7 deletions(-) create mode 100644 integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Collector0IntegrationTest.kt (limited to 'integration-tests/gradle/src/integrationTest') diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt index 2a9d7a70..92ea4c3e 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt @@ -64,7 +64,7 @@ class Android0GradleIntegrationTest(override val versions: BuildVersions) : Abst htmlOutputDir.allHtmlFiles().forEach { file -> assertContainsNoErrorClass(file) - assertNoUnresolvedLInks(file) + assertNoUnresolvedLinks(file) assertNoHrefToMissingLocalFileOrDirectory(file) } diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt index 30b560e7..d31c23b6 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt @@ -37,13 +37,13 @@ class BasicGradleIntegrationTest(override val versions: BuildVersions) : Abstrac assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaGfm")).outcome) assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaJekyll")).outcome) - File(projectDir, "build/dokka/html").assertKdocOutputDir() + File(projectDir, "build/dokka/html").assertHtmlOutputDir() File(projectDir, "build/dokka/javadoc").assertJavadocOutputDir() File(projectDir, "build/dokka/gfm").assertGfmOutputDir() File(projectDir, "build/dokka/jekyll").assertJekyllOutputDir() } - private fun File.assertKdocOutputDir() { + private fun File.assertHtmlOutputDir() { assertTrue(isDirectory, "Missing dokka html output directory") val imagesDir = File(this, "images") @@ -75,7 +75,7 @@ class BasicGradleIntegrationTest(override val versions: BuildVersions) : Abstrac allHtmlFiles().forEach { file -> assertContainsNoErrorClass(file) - assertNoUnresolvedLInks(file) + assertNoUnresolvedLinks(file) assertNoHrefToMissingLocalFileOrDirectory(file) } diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGroovyIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGroovyIntegrationTest.kt index 92b7ec40..24e105df 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGroovyIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGroovyIntegrationTest.kt @@ -79,7 +79,7 @@ class BasicGroovyIntegrationTest(override val versions: BuildVersions) : Abstrac allHtmlFiles().forEach { file -> assertContainsNoErrorClass(file) - assertNoUnresolvedLInks(file) + assertNoUnresolvedLinks(file) assertNoHrefToMissingLocalFileOrDirectory(file) } } diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Collector0IntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Collector0IntegrationTest.kt new file mode 100644 index 00000000..9866712d --- /dev/null +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Collector0IntegrationTest.kt @@ -0,0 +1,79 @@ +package org.jetbrains.dokka.it.gradle + +import org.gradle.testkit.runner.TaskOutcome +import org.junit.runners.Parameterized +import java.io.File +import kotlin.test.* + +class Collector0IntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() { + companion object { + @get:JvmStatic + @get:Parameterized.Parameters(name = "{0}") + val versions = BuildVersions.permutations( + gradleVersions = listOf("6.5.1", "6.1.1"), + kotlinVersions = listOf("1.4-M3") + ) + } + + @BeforeTest + fun prepareProjectFiles() { + val templateProjectDir = File("projects", "it-collector-0") + templateProjectDir.listFiles().orEmpty() + .filter { it.isFile } + .forEach { topLevelFile -> topLevelFile.copyTo(File(projectDir, topLevelFile.name)) } + File(templateProjectDir, "moduleA").copyRecursively(File(projectDir, "moduleA")) + } + + @Test + fun execute() { + val result = createGradleRunner( + ":moduleA:dokkaHtmlCollector", + ":moduleA:dokkaJavadocCollector", + ":moduleA:dokkaGfmCollector", + ":moduleA:dokkaJekyllCollector", + "-i", "-s" + ).buildRelaxed() + + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":moduleA:dokkaHtmlCollector")).outcome) + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":moduleA:dokkaJavadocCollector")).outcome) + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":moduleA:dokkaGfmCollector")).outcome) + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":moduleA:dokkaJekyllCollector")).outcome) + + File(projectDir, "moduleA/build/dokka/htmlCollector").assertHtmlOutputDir() + File(projectDir, "moduleA/build/dokka/javadocCollector").assertJavadocOutputDir() + File(projectDir, "moduleA/build/dokka/gfmCollector").assertGfmOutputDir() + File(projectDir, "moduleA/build/dokka/jekyllCollector").assertJekyllOutputDir() + } + + private fun File.assertHtmlOutputDir() { + assertTrue(isDirectory, "Missing dokka htmlCollector output directory") + allHtmlFiles().forEach { file -> + assertContainsNoErrorClass(file) + assertNoUnresolvedLinks(file) + assertNoHrefToMissingLocalFileOrDirectory(file) + } + + assertTrue( + allHtmlFiles().any { file -> "moduleB" in file.readText() }, + "Expected moduleB to be present in html" + ) + + assertTrue( + allHtmlFiles().any { file -> "moduleC" in file.readText() }, + "Expected moduleC to be present in html" + ) + } + + private fun File.assertJavadocOutputDir() { + assertTrue(isDirectory, "Missing dokka javadocCollector output directory") + } + + private fun File.assertJekyllOutputDir() { + assertTrue(isDirectory, "Missing dokka jekyllCollector output directory") + } + + private fun File.assertGfmOutputDir() { + assertTrue(isDirectory, "Missing dokka gfmCollector output directory") + } +} + diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multimodule0IntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multimodule0IntegrationTest.kt index 390db3a0..91afeaa0 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multimodule0IntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multimodule0IntegrationTest.kt @@ -40,7 +40,7 @@ class Multimodule0IntegrationTest(override val versions: BuildVersions) : Abstra outputDir.allHtmlFiles().forEach { file -> assertContainsNoErrorClass(file) - assertNoUnresolvedLInks(file) + assertNoUnresolvedLinks(file) assertNoHrefToMissingLocalFileOrDirectory(file) } diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multiplatform0GradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multiplatform0GradleIntegrationTest.kt index 6a3b9c83..ae0f342c 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multiplatform0GradleIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multiplatform0GradleIntegrationTest.kt @@ -36,7 +36,7 @@ class Multiplatform0GradleIntegrationTest(override val versions: BuildVersions) dokkaOutputDir.allHtmlFiles().forEach { file -> assertContainsNoErrorClass(file) - assertNoUnresolvedLInks(file) + assertNoUnresolvedLinks(file) assertNoHrefToMissingLocalFileOrDirectory(file) } } -- cgit