From a573641a70a626983c1d63965e377ea0be274f41 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Thu, 2 Jul 2020 14:18:51 +0200 Subject: Implement AndroidGradleIntegrationTest --- .../it/gradle/Android0GradleIntegrationTest.kt | 69 +++++++++++++++++++++ .../dokka/it/gradle/BasicGradleIntegrationTest.kt | 71 ++++++++++++++++++++++ .../gradle/Multiplatform0GradleIntegrationTest.kt | 43 +++++++++++++ 3 files changed, 183 insertions(+) create mode 100644 integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt create mode 100644 integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt create mode 100644 integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multiplatform0GradleIntegrationTest.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 new file mode 100644 index 00000000..93d84e1f --- /dev/null +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt @@ -0,0 +1,69 @@ +package org.jetbrains.dokka.it.gradle + +import org.gradle.testkit.runner.TaskOutcome +import org.junit.Assume +import org.junit.runners.Parameterized.Parameters +import java.io.File +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNotNull + +class Android0GradleIntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() { + + companion object { + @get:JvmStatic + @get:Parameters(name = "{0}") + val versions = BuildVersions.permutations( + gradleVersions = listOf("6.5.1", "5.6.4"), + kotlinVersions = listOf("1.3.72", "1.4-M2-eap-70"), + androidGradlePluginVersions = listOf("3.5.3", "3.6.3") + ) + BuildVersions.permutations( + gradleVersions = listOf("6.5.1","6.1.1"), + kotlinVersions = listOf("1.3.72", "1.4-M2-eap-70"), + androidGradlePluginVersions = listOf("4.0.0") + ) + BuildVersions.permutations( + gradleVersions = listOf("6.5.1"), + kotlinVersions = listOf("1.3.72", "1.4-M2-eap-70"), + androidGradlePluginVersions = listOf("4.1.0-beta02") + ) + } + + @BeforeTest + fun assumeAndroidInstallation() { + val isCI = System.getenv("CI") != null + if (isCI) { + return + } + + val androidSdkRoot = System.getenv("ANDROID_SDK_ROOT") + val androidHome = System.getenv("ANDROID_HOME") + + val isAndroidSdkInstalled = androidSdkRoot != null || androidHome != null + + Assume.assumeTrue( + "Missing ANDROID_SDK_ROOT", + isAndroidSdkInstalled + ) + } + + @BeforeTest + fun prepareProjectFiles() { + val templateProjectDir = File("projects", "it-android-0") + + templateProjectDir.listFiles().orEmpty() + .filter { it.isFile } + .filterNot { it.name == "local.properties" } + .filterNot { it.name.startsWith("gradlew") } + .forEach { topLevelFile -> topLevelFile.copyTo(File(projectDir, topLevelFile.name)) } + + File(templateProjectDir, "src").copyRecursively(File(projectDir, "src")) + } + + @Test + fun execute() { + val result = createGradleRunner("dokka", "--stacktrace").build() + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokka")).outcome) + } + +} 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 new file mode 100644 index 00000000..c3adce4f --- /dev/null +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt @@ -0,0 +1,71 @@ +package org.jetbrains.dokka.it.gradle + +import org.gradle.testkit.runner.TaskOutcome +import org.junit.runners.Parameterized +import org.junit.runners.Parameterized.Parameters +import java.io.File +import kotlin.test.* + +class BasicGradleIntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() { + + companion object { + @get:JvmStatic + @get:Parameters(name = "{0}") + val versions = BuildVersions.permutations( + gradleVersions = listOf("6.5.1", "6.4.1", "6.3", "6.2.2", "6.1.1", "6.0", "5.6.4"), + kotlinVersions = listOf("1.3.30", "1.3.72", "1.4-M2-eap-70") + ) + } + + @BeforeTest + fun prepareProjectFiles() { + val templateProjectDir = File("projects", "it-basic") + + templateProjectDir.listFiles().orEmpty() + .filter { it.isFile } + .forEach { topLevelFile -> topLevelFile.copyTo(File(projectDir, topLevelFile.name)) } + + File(templateProjectDir, "src").copyRecursively(File(projectDir, "src")) + } + + @Test + fun execute() { + val result = createGradleRunner("dokka", "--stacktrace").build() + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokka")).outcome) + + val dokkaOutputDir = File(projectDir, "build/dokka") + assertTrue(dokkaOutputDir.isDirectory, "Missing dokka output directory") + + val imagesDir = File(dokkaOutputDir, "images") + assertTrue(imagesDir.isDirectory, "Missing images directory") + + val scriptsDir = File(dokkaOutputDir, "scripts") + assertTrue(scriptsDir.isDirectory, "Missing scripts directory") + + val stylesDir = File(dokkaOutputDir, "styles") + assertTrue(stylesDir.isDirectory, "Missing styles directory") + + val navigationHtml = File(dokkaOutputDir, "navigation.html") + assertTrue(navigationHtml.isFile, "Missing navigation.html") + + val moduleOutputDir = File(dokkaOutputDir, "it-basic") + assertTrue(moduleOutputDir.isDirectory, "Missing module directory") + + val moduleIndexHtml = File(moduleOutputDir, "index.html") + assertTrue(moduleIndexHtml.isFile, "Missing module index.html") + + val modulePackageDir = File(moduleOutputDir, "it.basic") + assertTrue(modulePackageDir.isDirectory, "Missing it.basic package directory") + + val modulePackageIndexHtml = File(modulePackageDir, "index.html") + assertTrue(modulePackageIndexHtml.isFile, "Missing module package index.html") + + val moduleJavaPackageDir = File(moduleOutputDir, "it.basic.java") + assertTrue(moduleJavaPackageDir.isDirectory, "Missing it.basic.java package directory") + + dokkaOutputDir.allHtmlFiles().forEach { file -> + assertContainsNoErrorClass(file) + assertNoUnresolvedLInks(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 new file mode 100644 index 00000000..b54eecb1 --- /dev/null +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multiplatform0GradleIntegrationTest.kt @@ -0,0 +1,43 @@ +package org.jetbrains.dokka.it.gradle + +import org.gradle.testkit.runner.TaskOutcome +import org.gradle.util.GradleVersion +import org.junit.runners.Parameterized +import java.io.File +import kotlin.test.* + +class Multiplatform0GradleIntegrationTest(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.3.30", "1.3.72", "1.4-M2-eap-70") + ) + } + + @BeforeTest + fun prepareProjectFiles() { + val templateProjectDir = File("projects", "it-multiplatform-0") + templateProjectDir.listFiles().orEmpty() + .filter { it.isFile } + .forEach { topLevelFile -> topLevelFile.copyTo(File(projectDir, topLevelFile.name)) } + File(templateProjectDir, "src").copyRecursively(File(projectDir, "src")) + } + + @Test + fun execute() { + val result = createGradleRunner("dokka", "--stacktrace").build() + + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokka")).outcome) + + val dokkaOutputDir = File(projectDir, "build/dokka") + assertTrue(dokkaOutputDir.isDirectory, "Missing dokka output directory") + + dokkaOutputDir.allHtmlFiles().forEach { file -> + assertContainsNoErrorClass(file) + assertNoUnresolvedLInks(file) + } + } +} -- cgit From 163a7c484125a78cfe618f5ff363d36ad4cc3e5f Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Fri, 3 Jul 2020 16:58:14 +0200 Subject: Android0GradleIntegrationTest.kt: Assert link to developer.android.com --- .../dokka/it/gradle/Android0GradleIntegrationTest.kt | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (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 93d84e1f..e08dbca5 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 @@ -4,10 +4,7 @@ import org.gradle.testkit.runner.TaskOutcome import org.junit.Assume import org.junit.runners.Parameterized.Parameters import java.io.File -import kotlin.test.BeforeTest -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertNotNull +import kotlin.test.* class Android0GradleIntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() { @@ -19,7 +16,7 @@ class Android0GradleIntegrationTest(override val versions: BuildVersions) : Abst kotlinVersions = listOf("1.3.72", "1.4-M2-eap-70"), androidGradlePluginVersions = listOf("3.5.3", "3.6.3") ) + BuildVersions.permutations( - gradleVersions = listOf("6.5.1","6.1.1"), + gradleVersions = listOf("6.5.1", "6.1.1"), kotlinVersions = listOf("1.3.72", "1.4-M2-eap-70"), androidGradlePluginVersions = listOf("4.0.0") ) + BuildVersions.permutations( @@ -64,6 +61,16 @@ class Android0GradleIntegrationTest(override val versions: BuildVersions) : Abst fun execute() { val result = createGradleRunner("dokka", "--stacktrace").build() assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokka")).outcome) - } + projectDir.allHtmlFiles().forEach { file -> + assertContainsNoErrorClass(file) + assertNoUnresolvedLInks(file) + } + + assertTrue( + projectDir.allHtmlFiles().any { file -> + "https://developer.android.com/reference/android/content/Context.html" in file.readText() + }, "Expected link to developer.android.com" + ) + } } -- cgit From caf48e76f3bff5e9907cd094cf0719f623e528d5 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Wed, 8 Jul 2020 10:47:05 +0200 Subject: Implement simple MavenIntegrationTest.kt --- .../src/main/kotlin/org/jetbrains/taskUtils.kt | 13 ++ integration-tests/build.gradle.kts | 3 +- integration-tests/cli/build.gradle.kts | 5 +- .../jetbrains/dokka/it/cli/CliIntegrationTest.kt | 1 + .../org/jetbrains/dokka/it/cli/processUtils.kt | 51 ------- integration-tests/gradle/build.gradle.kts | 10 +- .../it/gradle/Android0GradleIntegrationTest.kt | 14 +- integration-tests/maven/build.gradle.kts | 17 +++ integration-tests/maven/projects/it-maven/pom.xml | 170 +++++++++++++++++++++ .../main/java/it/basic/java/SampleJavaClass.java | 22 +++ .../src/main/kotlin/it/basic/PublicClass.kt | 48 ++++++ .../dokka/it/maven/MavenIntegrationTest.kt | 78 ++++++++++ .../org/jetbrains/dokka/it/environmentUtils.kt | 16 ++ .../kotlin/org/jetbrains/dokka/it/processUtils.kt | 51 +++++++ runners/maven-plugin/build.gradle.kts | 3 + runners/maven-plugin/src/main/kotlin/DokkaMojo.kt | 3 - settings.gradle.kts | 1 + 17 files changed, 428 insertions(+), 78 deletions(-) create mode 100644 buildSrc/src/main/kotlin/org/jetbrains/taskUtils.kt delete mode 100644 integration-tests/cli/src/main/kotlin/org/jetbrains/dokka/it/cli/processUtils.kt create mode 100644 integration-tests/maven/build.gradle.kts create mode 100644 integration-tests/maven/projects/it-maven/pom.xml create mode 100644 integration-tests/maven/projects/it-maven/src/main/java/it/basic/java/SampleJavaClass.java create mode 100644 integration-tests/maven/projects/it-maven/src/main/kotlin/it/basic/PublicClass.kt create mode 100644 integration-tests/maven/src/integrationTest/kotlin/org/jetbrains/dokka/it/maven/MavenIntegrationTest.kt create mode 100644 integration-tests/src/main/kotlin/org/jetbrains/dokka/it/environmentUtils.kt create mode 100644 integration-tests/src/main/kotlin/org/jetbrains/dokka/it/processUtils.kt (limited to 'integration-tests/gradle/src/integrationTest') diff --git a/buildSrc/src/main/kotlin/org/jetbrains/taskUtils.kt b/buildSrc/src/main/kotlin/org/jetbrains/taskUtils.kt new file mode 100644 index 00000000..b018ba13 --- /dev/null +++ b/buildSrc/src/main/kotlin/org/jetbrains/taskUtils.kt @@ -0,0 +1,13 @@ +package org.jetbrains + +import org.gradle.api.Task + +fun Task.dependsOnMavenLocalPublication() { + project.rootProject.allprojects.forEach { otherProject -> + otherProject.invokeWhenEvaluated { evaluatedProject -> + evaluatedProject.tasks.findByName("publishToMavenLocal")?.let { publishingTask -> + this.dependsOn(publishingTask) + } + } + } +} diff --git a/integration-tests/build.gradle.kts b/integration-tests/build.gradle.kts index 70b6db26..070091a0 100644 --- a/integration-tests/build.gradle.kts +++ b/integration-tests/build.gradle.kts @@ -37,4 +37,5 @@ subprojects { dependencies { implementation(kotlin("stdlib")) implementation(kotlin("test-junit")) -} + val coroutines_version: String by project + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")} diff --git a/integration-tests/cli/build.gradle.kts b/integration-tests/cli/build.gradle.kts index 5fdf0ff5..60d3a298 100644 --- a/integration-tests/cli/build.gradle.kts +++ b/integration-tests/cli/build.gradle.kts @@ -12,10 +12,6 @@ evaluationDependsOn(":plugins:base") dependencies { implementation(kotlin("stdlib")) implementation(kotlin("test-junit")) - - val coroutines_version: String by project - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") - } /* Create a fat base plugin jar for cli tests */ @@ -35,6 +31,7 @@ val basePluginShadowJar by tasks.register("basePluginShadowJar", ShadowJar::clas } tasks.integrationTest { + inputs.dir((file("projects"))) val cliJar = tasks.getByPath(":runners:cli:shadowJar") as ShadowJar environment("CLI_JAR_PATH", cliJar.archiveFile.get()) environment("BASE_PLUGIN_JAR_PATH", basePluginShadowJar.archiveFile.get()) diff --git a/integration-tests/cli/src/integrationTest/kotlin/org/jetbrains/dokka/it/cli/CliIntegrationTest.kt b/integration-tests/cli/src/integrationTest/kotlin/org/jetbrains/dokka/it/cli/CliIntegrationTest.kt index 49030c73..9f83c869 100644 --- a/integration-tests/cli/src/integrationTest/kotlin/org/jetbrains/dokka/it/cli/CliIntegrationTest.kt +++ b/integration-tests/cli/src/integrationTest/kotlin/org/jetbrains/dokka/it/cli/CliIntegrationTest.kt @@ -1,5 +1,6 @@ package org.jetbrains.dokka.it.cli +import org.jetbrains.dokka.it.awaitProcessResult import java.io.File import kotlin.test.BeforeTest import kotlin.test.Test diff --git a/integration-tests/cli/src/main/kotlin/org/jetbrains/dokka/it/cli/processUtils.kt b/integration-tests/cli/src/main/kotlin/org/jetbrains/dokka/it/cli/processUtils.kt deleted file mode 100644 index d2fa3b31..00000000 --- a/integration-tests/cli/src/main/kotlin/org/jetbrains/dokka/it/cli/processUtils.kt +++ /dev/null @@ -1,51 +0,0 @@ -package org.jetbrains.dokka.it.cli - -import kotlinx.coroutines.CompletableDeferred -import kotlinx.coroutines.async -import kotlinx.coroutines.runBlocking -import kotlin.concurrent.thread - -class ProcessResult( - val exitCode: Int, - val output: String -) - -fun Process.awaitProcessResult() = runBlocking { - val exitCode = async { awaitExitCode() } - val output = async { awaitOutput() } - ProcessResult( - exitCode.await(), - output.await() - ) -} - -private suspend fun Process.awaitExitCode(): Int { - val deferred = CompletableDeferred() - thread { - try { - deferred.complete(this.waitFor()) - } catch (e: Throwable) { - deferred.completeExceptionally(e) - } - } - - return deferred.await() -} - -private suspend fun Process.awaitOutput(): String { - val deferred = CompletableDeferred() - thread { - try { - var string = "" - this.inputStream.bufferedReader().forEachLine { line -> - println(line) - string += line + System.lineSeparator() - } - deferred.complete(string) - } catch (e: Throwable) { - deferred.completeExceptionally(e) - } - } - - return deferred.await() -} diff --git a/integration-tests/gradle/build.gradle.kts b/integration-tests/gradle/build.gradle.kts index 28e20cf9..3da416bb 100644 --- a/integration-tests/gradle/build.gradle.kts +++ b/integration-tests/gradle/build.gradle.kts @@ -1,4 +1,4 @@ -import org.jetbrains.invokeWhenEvaluated +import org.jetbrains.dependsOnMavenLocalPublication dependencies { implementation(kotlin("stdlib")) @@ -8,13 +8,7 @@ dependencies { tasks.integrationTest { inputs.dir(file("projects")) - rootProject.allprojects.forEach { otherProject -> - otherProject.invokeWhenEvaluated { evaluatedProject -> - evaluatedProject.tasks.findByName("publishToMavenLocal")?.let { publishingTask -> - this.dependsOn(publishingTask) - } - } - } + dependsOnMavenLocalPublication() } tasks.clean { 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 e08dbca5..0a29555f 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 @@ -1,6 +1,8 @@ package org.jetbrains.dokka.it.gradle import org.gradle.testkit.runner.TaskOutcome +import org.jetbrains.dokka.it.isAndroidSdkInstalled +import org.jetbrains.dokka.it.isCI import org.junit.Assume import org.junit.runners.Parameterized.Parameters import java.io.File @@ -28,20 +30,10 @@ class Android0GradleIntegrationTest(override val versions: BuildVersions) : Abst @BeforeTest fun assumeAndroidInstallation() { - val isCI = System.getenv("CI") != null if (isCI) { return } - - val androidSdkRoot = System.getenv("ANDROID_SDK_ROOT") - val androidHome = System.getenv("ANDROID_HOME") - - val isAndroidSdkInstalled = androidSdkRoot != null || androidHome != null - - Assume.assumeTrue( - "Missing ANDROID_SDK_ROOT", - isAndroidSdkInstalled - ) + Assume.assumeTrue("Missing ANDROID_SDK_ROOT", isAndroidSdkInstalled) } @BeforeTest diff --git a/integration-tests/maven/build.gradle.kts b/integration-tests/maven/build.gradle.kts new file mode 100644 index 00000000..b0187b13 --- /dev/null +++ b/integration-tests/maven/build.gradle.kts @@ -0,0 +1,17 @@ +import org.jetbrains.dependsOnMavenLocalPublication + +evaluationDependsOn(":runners:maven-plugin") + +dependencies { + implementation(kotlin("stdlib")) + implementation(kotlin("test-junit")) +} + +tasks.integrationTest { + dependsOnMavenLocalPublication() + dependsOn(":runners:maven-plugin:setupMaven") + + val dokka_version: String by project + environment("DOKKA_VERSION", dokka_version) + environment("MVN_BINARY_PATH", project(":runners:maven-plugin").extra["MVN_BINARY_PATH"].toString()) +} diff --git a/integration-tests/maven/projects/it-maven/pom.xml b/integration-tests/maven/projects/it-maven/pom.xml new file mode 100644 index 00000000..47bd633c --- /dev/null +++ b/integration-tests/maven/projects/it-maven/pom.xml @@ -0,0 +1,170 @@ + + 4.0.0 + + org.jetbrains.dokka + it-maven + 1.0-SNAPSHOT + + + 1.3.72 + + + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + + compile + + compile + + + + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/main/java + + + + + test-compile + + test-compile + + + + ${project.basedir}/src/test/kotlin + ${project.basedir}/src/test/java + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.5.1 + + + + default-compile + none + + + + default-testCompile + none + + + java-compile + compile + + compile + + + + java-test-compile + test-compile + + testCompile + + + + + + org.jetbrains.dokka + dokka-maven-plugin + $dokka_version + + + pre-site + + dokka + + + + + + + false + + + Maven Integration Test Module + + + html + + ${project.basedir}/output + + + + default + + + + 8 + + + false + + true + + true + + + + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/main/java + + + + + false + + + false + + + + + + kotlin + + + false + + true + false + + + + + + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/test/kotlin + + + + + kotlin-dev + https://dl.bintray.com/kotlin/kotlin-dev/ + + + jcenter + JCenter + https://jcenter.bintray.com/ + + + + + + org.jetbrains.kotlin + kotlin-stdlib + ${kotlin.version} + + + + + diff --git a/integration-tests/maven/projects/it-maven/src/main/java/it/basic/java/SampleJavaClass.java b/integration-tests/maven/projects/it-maven/src/main/java/it/basic/java/SampleJavaClass.java new file mode 100644 index 00000000..e08bb66a --- /dev/null +++ b/integration-tests/maven/projects/it-maven/src/main/java/it/basic/java/SampleJavaClass.java @@ -0,0 +1,22 @@ +package it.basic.java; + +import it.basic.PublicClass; + +/** + * This class is, unlike {@link PublicClass}, written in Java + */ +@SuppressWarnings("unused") +public class SampleJavaClass { + + /** + * @return Empty instance of {@link PublicClass} + */ + public PublicClass publicDocumentedFunction() { + return new PublicClass(); + } + + + public PublicClass publicUndocumentedFunction() { + return new PublicClass(); + } +} diff --git a/integration-tests/maven/projects/it-maven/src/main/kotlin/it/basic/PublicClass.kt b/integration-tests/maven/projects/it-maven/src/main/kotlin/it/basic/PublicClass.kt new file mode 100644 index 00000000..71bc7e63 --- /dev/null +++ b/integration-tests/maven/projects/it-maven/src/main/kotlin/it/basic/PublicClass.kt @@ -0,0 +1,48 @@ +@file:Suppress("unused") + +package it.basic + +class PublicClass { + /** + * This function is public and documented + */ + fun publicDocumentedFunction(): String = "" + + fun publicUndocumentedFunction(): String = "" + + /** + * This function is internal and documented + */ + internal fun internalDocumentedFunction(): String = "" + + internal fun internalUndocumentedFunction(): String = "" + + /** + * This function is private and documented + */ + private fun privateDocumentedFunction(): String = "" + + private fun privateUndocumentedFunction(): String = "" + + + /** + * This property is public and documented + */ + val publicDocumentedProperty: Int = 0 + + val publicUndocumentedProperty: Int = 0 + + /** + * This property internal and documented + */ + val internalDocumentedProperty: Int = 0 + + val internalUndocumentedProperty: Int = 0 + + /** + * This property private and documented + */ + private val privateDocumentedProperty: Int = 0 + + private val privateUndocumentedProperty: Int = 0 +} diff --git a/integration-tests/maven/src/integrationTest/kotlin/org/jetbrains/dokka/it/maven/MavenIntegrationTest.kt b/integration-tests/maven/src/integrationTest/kotlin/org/jetbrains/dokka/it/maven/MavenIntegrationTest.kt new file mode 100644 index 00000000..e52debf4 --- /dev/null +++ b/integration-tests/maven/src/integrationTest/kotlin/org/jetbrains/dokka/it/maven/MavenIntegrationTest.kt @@ -0,0 +1,78 @@ +package org.jetbrains.dokka.it.maven + +import org.jetbrains.dokka.it.AbstractIntegrationTest +import org.jetbrains.dokka.it.awaitProcessResult +import java.io.File +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertTrue + +class MavenIntegrationTest : AbstractIntegrationTest() { + + val currentDokkaVersion: String = checkNotNull(System.getenv("DOKKA_VERSION")) + + val mavenBinaryFile: File = File(checkNotNull(System.getenv("MVN_BINARY_PATH"))) + + @BeforeTest + fun prepareProjectFiles() { + val templateProjectDir = File("projects", "it-maven") + templateProjectDir.copyRecursively(projectDir) + val pomXml = File(projectDir, "pom.xml") + assertTrue(pomXml.isFile) + pomXml.apply { + writeText(readText().replace("\$dokka_version", currentDokkaVersion)) + } + } + + @Test + fun run() { + val result = ProcessBuilder().directory(projectDir) + .command(mavenBinaryFile.absolutePath, "dokka:dokka", "-U", "-e").start().awaitProcessResult() + + assertEquals(0, result.exitCode, "Expected exitCode 0 (Success)") + + val extensionLoadedRegex = Regex("""Extension: org\.jetbrains\.dokka\.base\.DokkaBase""") + val amountOfExtensionsLoaded = extensionLoadedRegex.findAll(result.output).count() + + assertTrue( + amountOfExtensionsLoaded > 10, + "Expected more than 10 extensions being present (found $amountOfExtensionsLoaded)" + ) + + val undocumentedReportRegex = Regex("""Undocumented:""") + val amountOfUndocumentedReports = undocumentedReportRegex.findAll(result.output).count() + assertTrue( + amountOfUndocumentedReports > 0, + "Expected at least one report of undocumented code (found $amountOfUndocumentedReports)" + ) + + val undocumentedJavaReportRegex = Regex("""Undocumented: it\.basic\.java""") + val amountOfUndocumentedJavaReports = undocumentedJavaReportRegex.findAll(result.output).count() + assertTrue( + amountOfUndocumentedJavaReports > 0, + "Expected at least one report of undocumented java code (found $amountOfUndocumentedJavaReports)" + ) + + val dokkaOutputDir = File(projectDir, "output") + assertTrue(dokkaOutputDir.isDirectory, "Missing dokka output directory") + + val imagesDir = File(dokkaOutputDir, "images") + assertTrue(imagesDir.isDirectory, "Missing images directory") + + val scriptsDir = File(dokkaOutputDir, "scripts") + assertTrue(scriptsDir.isDirectory, "Missing scripts directory") + + val stylesDir = File(dokkaOutputDir, "styles") + assertTrue(stylesDir.isDirectory, "Missing styles directory") + + val navigationHtml = File(dokkaOutputDir, "navigation.html") + assertTrue(navigationHtml.isFile, "Missing navigation.html") + + projectDir.allHtmlFiles().forEach { file -> + assertContainsNoErrorClass(file) + assertNoUnresolvedLInks(file) + } + + } +} diff --git a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/environmentUtils.kt b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/environmentUtils.kt new file mode 100644 index 00000000..eadf5a8c --- /dev/null +++ b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/environmentUtils.kt @@ -0,0 +1,16 @@ +package org.jetbrains.dokka.it + +import java.io.File + +/** + * Indicating whether or not the current machine executing the test is a CI + */ +val isCI: Boolean get() = System.getenv("CI") == "true" + +val isAndroidSdkInstalled: Boolean = System.getenv("ANDROID_SDK_ROOT") != null || + System.getenv("ANDROID_HOME") != null + +val isMavenInstalled: Boolean = System.getenv("PATH").orEmpty() + .split(File.pathSeparator) + .flatMap { pathElement -> File(pathElement).listFiles().orEmpty().toList() } + .any { pathElement -> "mvn" == pathElement.name } diff --git a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/processUtils.kt b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/processUtils.kt new file mode 100644 index 00000000..d2c048ac --- /dev/null +++ b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/processUtils.kt @@ -0,0 +1,51 @@ +package org.jetbrains.dokka.it + +import kotlinx.coroutines.CompletableDeferred +import kotlinx.coroutines.async +import kotlinx.coroutines.runBlocking +import kotlin.concurrent.thread + +class ProcessResult( + val exitCode: Int, + val output: String +) + +fun Process.awaitProcessResult() = runBlocking { + val exitCode = async { awaitExitCode() } + val output = async { awaitOutput() } + ProcessResult( + exitCode.await(), + output.await() + ) +} + +private suspend fun Process.awaitExitCode(): Int { + val deferred = CompletableDeferred() + thread { + try { + deferred.complete(this.waitFor()) + } catch (e: Throwable) { + deferred.completeExceptionally(e) + } + } + + return deferred.await() +} + +private suspend fun Process.awaitOutput(): String { + val deferred = CompletableDeferred() + thread { + try { + var string = "" + this.inputStream.bufferedReader().forEachLine { line -> + println(line) + string += line + System.lineSeparator() + } + deferred.complete(string) + } catch (e: Throwable) { + deferred.completeExceptionally(e) + } + } + + return deferred.await() +} diff --git a/runners/maven-plugin/build.gradle.kts b/runners/maven-plugin/build.gradle.kts index d9fc4f6f..8e412b43 100644 --- a/runners/maven-plugin/build.gradle.kts +++ b/runners/maven-plugin/build.gradle.kts @@ -1,5 +1,6 @@ import org.jetbrains.configureBintrayPublication import org.jetbrains.CrossPlatformExec + /** * [mavenBin] configuration is used to download Maven Plugin Plugin * for generating plugin-help.xml and plugin.xml files @@ -30,6 +31,7 @@ dependencies { val mavenBinDir = "$buildDir/maven-bin" val mavenBuildDir = "$buildDir/maven" val mvn = File(mavenBinDir, "apache-maven-$mavenVersion/bin/mvn") +extra.set("MVN_BINARY_PATH", mvn.absolutePath) tasks.named("clean") { delete(mavenBinDir) @@ -48,6 +50,7 @@ val setupMaven by tasks.registering(Sync::class) { */ val generatePom by tasks.registering(Copy::class) { val dokka_version: String by project + inputs.property("dokka_version", dokka_version) from("$projectDir/pom.tpl.xml") { rename("(.*).tpl.xml", "$1.xml") diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt index 8160ab87..aa92516f 100644 --- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt +++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt @@ -87,9 +87,6 @@ abstract class AbstractDokkaMojo : AbstractMojo() { @Parameter(required = true, defaultValue = "\${project.compileSourceRoots}") var sourceDirectories: List = emptyList() - @Parameter - var sourceRoots: List = emptyList() - @Parameter var samples: List = emptyList() diff --git a/settings.gradle.kts b/settings.gradle.kts index 409dca88..ecee8020 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -21,6 +21,7 @@ include("plugins:javadoc") include("integration-tests") include("integration-tests:gradle") include("integration-tests:cli") +include("integration-tests:maven") pluginManagement { val kotlin_version: String by settings -- cgit From 171f7faed806c9c744d16cf6fafa10f0edcc69b4 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Fri, 10 Jul 2020 09:08:49 +0200 Subject: Run all formats in BasicGradleIntegrationTest --- .../dokka/it/gradle/BasicGradleIntegrationTest.kt | 42 ++++++++++++++++------ 1 file changed, 32 insertions(+), 10 deletions(-) (limited to 'integration-tests/gradle/src/integrationTest') 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 c3adce4f..a15dc60a 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 @@ -30,25 +30,35 @@ class BasicGradleIntegrationTest(override val versions: BuildVersions) : Abstrac @Test fun execute() { - val result = createGradleRunner("dokka", "--stacktrace").build() - assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokka")).outcome) + val result = createGradleRunner("dokkaKdoc", "dokkaJavadoc", "dokkaGfm", "dokkaJekyll", "--stacktrace").build() - val dokkaOutputDir = File(projectDir, "build/dokka") - assertTrue(dokkaOutputDir.isDirectory, "Missing dokka output directory") + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaKdoc")).outcome) + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaJavadoc")).outcome) + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaGfm")).outcome) + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaJekyll")).outcome) - val imagesDir = File(dokkaOutputDir, "images") + File(projectDir, "build/dokka/kdoc").assertKdocOutputDir() + File(projectDir, "build/dokka/javadoc").assertJavadocOutputDir() + File(projectDir, "build/dokka/gfm").assertGfmOutputDir() + File(projectDir, "build/dokka/jekyll").assertJekyllOutputDir() + } + + private fun File.assertKdocOutputDir() { + assertTrue(isDirectory, "Missing dokka kdoc output directory") + + val imagesDir = File(this, "images") assertTrue(imagesDir.isDirectory, "Missing images directory") - val scriptsDir = File(dokkaOutputDir, "scripts") + val scriptsDir = File(this, "scripts") assertTrue(scriptsDir.isDirectory, "Missing scripts directory") - val stylesDir = File(dokkaOutputDir, "styles") + val stylesDir = File(this, "styles") assertTrue(stylesDir.isDirectory, "Missing styles directory") - val navigationHtml = File(dokkaOutputDir, "navigation.html") + val navigationHtml = File(this, "navigation.html") assertTrue(navigationHtml.isFile, "Missing navigation.html") - val moduleOutputDir = File(dokkaOutputDir, "it-basic") + val moduleOutputDir = File(this, "it-basic") assertTrue(moduleOutputDir.isDirectory, "Missing module directory") val moduleIndexHtml = File(moduleOutputDir, "index.html") @@ -63,9 +73,21 @@ class BasicGradleIntegrationTest(override val versions: BuildVersions) : Abstrac val moduleJavaPackageDir = File(moduleOutputDir, "it.basic.java") assertTrue(moduleJavaPackageDir.isDirectory, "Missing it.basic.java package directory") - dokkaOutputDir.allHtmlFiles().forEach { file -> + allHtmlFiles().forEach { file -> assertContainsNoErrorClass(file) assertNoUnresolvedLInks(file) } } + + private fun File.assertJavadocOutputDir() { + assertTrue(isDirectory, "Missing dokka javadoc output directory") + } + + private fun File.assertGfmOutputDir() { + assertTrue(isDirectory, "Missing dokka gfm output directory") + } + + private fun File.assertJekyllOutputDir() { + assertTrue(isDirectory, "Missing dokka jekyll output directory") + } } -- cgit From 7b78890681ba81f1e38f5868fe9e6162efc540c0 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Fri, 10 Jul 2020 11:53:53 +0200 Subject: Implement basic MultiModule0IntegrationTest.kt --- .../it-multimodule-0/moduleA/moduleB/README.md | 2 +- .../it-multimodule-0/moduleA/moduleC/README.md | 2 +- .../dokka/it/gradle/MultiModule0IntegrationTest.kt | 41 ++++++++++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule0IntegrationTest.kt (limited to 'integration-tests/gradle/src/integrationTest') diff --git a/integration-tests/gradle/projects/it-multimodule-0/moduleA/moduleB/README.md b/integration-tests/gradle/projects/it-multimodule-0/moduleA/moduleB/README.md index 5f22dd72..f8c52880 100644 --- a/integration-tests/gradle/projects/it-multimodule-0/moduleA/moduleB/README.md +++ b/integration-tests/gradle/projects/it-multimodule-0/moduleA/moduleB/README.md @@ -1,2 +1,2 @@ # Module moduleB -Here is some description +Here is some description for module B diff --git a/integration-tests/gradle/projects/it-multimodule-0/moduleA/moduleC/README.md b/integration-tests/gradle/projects/it-multimodule-0/moduleA/moduleC/README.md index 7e1da8ec..4ead5671 100644 --- a/integration-tests/gradle/projects/it-multimodule-0/moduleA/moduleC/README.md +++ b/integration-tests/gradle/projects/it-multimodule-0/moduleA/moduleC/README.md @@ -1,2 +1,2 @@ # Module moduleC -Here is some description +Here is some description for module C 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 new file mode 100644 index 00000000..36362552 --- /dev/null +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule0IntegrationTest.kt @@ -0,0 +1,41 @@ +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 MultiModule0IntegrationTest(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-M2-eap-70") + ) + } + + @BeforeTest + fun prepareProjectFiles() { + val templateProjectDir = File("projects", "it-multimodule-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("dokkaKdoc", ":moduleA:dokkaKdocMultimodule", "--stacktrace").build() + + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":moduleA:dokkaKdocMultimodule")).outcome) + + val dokkaOutputDir = File(projectDir, "moduleA/build/dokka/kdocMultimodule") + assertTrue(dokkaOutputDir.isDirectory, "Missing dokka output directory") + + dokkaOutputDir.allHtmlFiles().forEach { file -> + assertContainsNoErrorClass(file) + assertNoUnresolvedLInks(file) + } + } +} -- cgit From e940349980c40f87309c9ae80593519952d9dd7f Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Fri, 10 Jul 2020 12:34:15 +0200 Subject: Implement basic assertNoUnresolvedHref --- integration-tests/build.gradle.kts | 4 +++- .../it/gradle/Android0GradleIntegrationTest.kt | 1 + .../dokka/it/gradle/BasicGradleIntegrationTest.kt | 2 +- .../dokka/it/gradle/MultiModule0IntegrationTest.kt | 1 + .../gradle/Multiplatform0GradleIntegrationTest.kt | 2 +- .../jetbrains/dokka/it/AbstractIntegrationTest.kt | 28 ++++++++++++++++++++++ 6 files changed, 35 insertions(+), 3 deletions(-) (limited to 'integration-tests/gradle/src/integrationTest') diff --git a/integration-tests/build.gradle.kts b/integration-tests/build.gradle.kts index 8458f1fe..fb987c36 100644 --- a/integration-tests/build.gradle.kts +++ b/integration-tests/build.gradle.kts @@ -38,4 +38,6 @@ dependencies { implementation(kotlin("stdlib")) implementation(kotlin("test-junit")) val coroutines_version: String by project - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")} + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") + implementation("org.jsoup:jsoup:1.12.1") +} 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 0a29555f..2b8ba45d 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 @@ -57,6 +57,7 @@ class Android0GradleIntegrationTest(override val versions: BuildVersions) : Abst projectDir.allHtmlFiles().forEach { file -> assertContainsNoErrorClass(file) assertNoUnresolvedLInks(file) + assertNoHrefToMissingLocalFileOrDirectory(file) } assertTrue( 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 a15dc60a..87460080 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 @@ -1,7 +1,6 @@ package org.jetbrains.dokka.it.gradle import org.gradle.testkit.runner.TaskOutcome -import org.junit.runners.Parameterized import org.junit.runners.Parameterized.Parameters import java.io.File import kotlin.test.* @@ -76,6 +75,7 @@ class BasicGradleIntegrationTest(override val versions: BuildVersions) : Abstrac allHtmlFiles().forEach { file -> assertContainsNoErrorClass(file) assertNoUnresolvedLInks(file) + assertNoHrefToMissingLocalFileOrDirectory(file) } } 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 36362552..e4f8b189 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 @@ -36,6 +36,7 @@ class MultiModule0IntegrationTest(override val versions: BuildVersions) : Abstra dokkaOutputDir.allHtmlFiles().forEach { file -> assertContainsNoErrorClass(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 b54eecb1..491f5610 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 @@ -1,7 +1,6 @@ package org.jetbrains.dokka.it.gradle import org.gradle.testkit.runner.TaskOutcome -import org.gradle.util.GradleVersion import org.junit.runners.Parameterized import java.io.File import kotlin.test.* @@ -38,6 +37,7 @@ class Multiplatform0GradleIntegrationTest(override val versions: BuildVersions) dokkaOutputDir.allHtmlFiles().forEach { file -> assertContainsNoErrorClass(file) assertNoUnresolvedLInks(file) + assertNoHrefToMissingLocalFileOrDirectory(file) } } } diff --git a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt index 4af523a2..0a83045e 100644 --- a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt +++ b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt @@ -1,9 +1,11 @@ package org.jetbrains.dokka.it +import org.jsoup.Jsoup import org.junit.Rule import org.junit.rules.TemporaryFolder import java.io.File import kotlin.test.assertFalse +import kotlin.test.assertTrue abstract class AbstractIntegrationTest { @@ -36,4 +38,30 @@ abstract class AbstractIntegrationTest { "Unexpected unresolved link in ${file.path}\n" + fileText ) } + + protected fun assertNoHrefToMissingLocalFileOrDirectory( + file: File, fileExtensions: Set = setOf("html") + ) { + val fileText = file.readText() + val html = Jsoup.parse(fileText) + html.allElements.toList().forEach { element -> + val href = element.attr("href") ?: return@forEach + + if (href.startsWith("#")) return@forEach + if (href.startsWith("https")) return@forEach + if (href.startsWith("http")) return@forEach + + val targetFile = File(file.parent, href) + if (targetFile.extension.isNotEmpty() && targetFile.extension !in fileExtensions) return@forEach + + if ( + targetFile.extension.isEmpty() || targetFile.extension == "html" && !href.startsWith("#")) { + assertTrue( + targetFile.exists(), + "${file.relativeTo(projectDir).path}: href=\"$href\"\n" + + "file does not exist: ${targetFile.relativeTo(projectDir).path}" + ) + } + } + } } -- cgit From e9b3fead277bdbf0aced2801812cd22c3b8fd625 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Fri, 10 Jul 2020 13:50:01 +0200 Subject: Fix first integration tests --- .../dokka/it/gradle/MultiModule0IntegrationTest.kt | 42 --------------- .../dokka/it/gradle/Multimodule0IntegrationTest.kt | 61 ++++++++++++++++++++++ .../gradle/Multiplatform0GradleIntegrationTest.kt | 6 +-- integration-tests/maven/projects/it-maven/pom.xml | 2 - .../jetbrains/dokka/it/AbstractIntegrationTest.kt | 12 +++-- 5 files changed, 72 insertions(+), 51 deletions(-) delete mode 100644 integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule0IntegrationTest.kt create mode 100644 integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multimodule0IntegrationTest.kt (limited to 'integration-tests/gradle/src/integrationTest') 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 deleted file mode 100644 index e4f8b189..00000000 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule0IntegrationTest.kt +++ /dev/null @@ -1,42 +0,0 @@ -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 MultiModule0IntegrationTest(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-M2-eap-70") - ) - } - - @BeforeTest - fun prepareProjectFiles() { - val templateProjectDir = File("projects", "it-multimodule-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("dokkaKdoc", ":moduleA:dokkaKdocMultimodule", "--stacktrace").build() - - assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":moduleA:dokkaKdocMultimodule")).outcome) - - val dokkaOutputDir = File(projectDir, "moduleA/build/dokka/kdocMultimodule") - assertTrue(dokkaOutputDir.isDirectory, "Missing dokka output directory") - - dokkaOutputDir.allHtmlFiles().forEach { file -> - assertContainsNoErrorClass(file) - assertNoUnresolvedLInks(file) - assertNoHrefToMissingLocalFileOrDirectory(file) - } - } -} 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 new file mode 100644 index 00000000..75ef547a --- /dev/null +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multimodule0IntegrationTest.kt @@ -0,0 +1,61 @@ +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 Multimodule0IntegrationTest(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-M2-eap-70") + ) + } + + @BeforeTest + fun prepareProjectFiles() { + val templateProjectDir = File("projects", "it-multimodule-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("dokkaKdoc", ":moduleA:dokkaKdocMultimodule", "--stacktrace").build() + + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":moduleA:dokkaKdocMultimodule")).outcome) + + val outputDir = File(projectDir, "moduleA/build/dokka/kdocMultimodule") + assertTrue(outputDir.isDirectory, "Missing dokka output directory") + + assertTrue( + outputDir.allHtmlFiles().any(), + "Expected at least one html file being generated" + ) + + outputDir.allHtmlFiles().forEach { file -> + assertContainsNoErrorClass(file) + assertNoUnresolvedLInks(file) + assertNoHrefToMissingLocalFileOrDirectory(file) + } + + val modulesFile = File(outputDir, "-modules.html") + assertTrue(modulesFile.isFile, "Missing -modules.html file") + + val modulesFileText = modulesFile.readText() + assertTrue( + "moduleB" in modulesFileText, + "Expected moduleB being mentioned in -modules.html" + ) + assertTrue( + "moduleC" in modulesFileText, + "Expected moduleC being mentioned in -modules.html" + ) + + } +} 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 491f5610..8fa1d3de 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 @@ -27,11 +27,11 @@ class Multiplatform0GradleIntegrationTest(override val versions: BuildVersions) @Test fun execute() { - val result = createGradleRunner("dokka", "--stacktrace").build() + val result = createGradleRunner("dokkaKdoc", "--stacktrace").build() - assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokka")).outcome) + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaKdoc")).outcome) - val dokkaOutputDir = File(projectDir, "build/dokka") + val dokkaOutputDir = File(projectDir, "build/dokka/kdoc") assertTrue(dokkaOutputDir.isDirectory, "Missing dokka output directory") dokkaOutputDir.allHtmlFiles().forEach { file -> diff --git a/integration-tests/maven/projects/it-maven/pom.xml b/integration-tests/maven/projects/it-maven/pom.xml index 47bd633c..9be87779 100644 --- a/integration-tests/maven/projects/it-maven/pom.xml +++ b/integration-tests/maven/projects/it-maven/pom.xml @@ -93,8 +93,6 @@ Maven Integration Test Module - - html ${project.basedir}/output diff --git a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt index 0a83045e..aeebe552 100644 --- a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt +++ b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt @@ -45,13 +45,17 @@ abstract class AbstractIntegrationTest { val fileText = file.readText() val html = Jsoup.parse(fileText) html.allElements.toList().forEach { element -> - val href = element.attr("href") ?: return@forEach - - if (href.startsWith("#")) return@forEach + val href = (element.attr("href") ?: return@forEach) if (href.startsWith("https")) return@forEach if (href.startsWith("http")) return@forEach - val targetFile = File(file.parent, href) + val hrefWithoutAnchors = if (href.contains("#")) { + val hrefSplits = href.split("#") + if (hrefSplits.count() != 2) return@forEach + hrefSplits.first() + } else href + + val targetFile = File(file.parent, hrefWithoutAnchors) if (targetFile.extension.isNotEmpty() && targetFile.extension !in fileExtensions) return@forEach if ( -- cgit From 141f0f8591ca92dadde56ae1f17732c831000c7e Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Fri, 10 Jul 2020 14:44:25 +0200 Subject: Implement BasicGroovyIntegrationTest.kt --- .../gradle/projects/it-basic-groovy/build.gradle | 37 +++++ .../projects/it-basic-groovy/gradle.properties | 1 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 58910 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + .../gradle/projects/it-basic-groovy/gradlew | 185 +++++++++++++++++++++ .../gradle/projects/it-basic-groovy/gradlew.bat | 104 ++++++++++++ .../projects/it-basic-groovy/settings.gradle.kts | 5 + .../main/java/it/basic/java/SampleJavaClass.java | 17 ++ .../src/main/kotlin/it/basic/PublicClass.kt | 48 ++++++ .../dokka/it/gradle/BasicGroovyIntegrationTest.kt | 96 +++++++++++ .../main/kotlin/org/jetbrains/dokka/gradle/main.kt | 1 + 11 files changed, 499 insertions(+) create mode 100644 integration-tests/gradle/projects/it-basic-groovy/build.gradle create mode 100644 integration-tests/gradle/projects/it-basic-groovy/gradle.properties create mode 100644 integration-tests/gradle/projects/it-basic-groovy/gradle/wrapper/gradle-wrapper.jar create mode 100644 integration-tests/gradle/projects/it-basic-groovy/gradle/wrapper/gradle-wrapper.properties create mode 100755 integration-tests/gradle/projects/it-basic-groovy/gradlew create mode 100644 integration-tests/gradle/projects/it-basic-groovy/gradlew.bat create mode 100644 integration-tests/gradle/projects/it-basic-groovy/settings.gradle.kts create mode 100644 integration-tests/gradle/projects/it-basic-groovy/src/main/java/it/basic/java/SampleJavaClass.java create mode 100644 integration-tests/gradle/projects/it-basic-groovy/src/main/kotlin/it/basic/PublicClass.kt create mode 100644 integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGroovyIntegrationTest.kt (limited to 'integration-tests/gradle/src/integrationTest') diff --git a/integration-tests/gradle/projects/it-basic-groovy/build.gradle b/integration-tests/gradle/projects/it-basic-groovy/build.gradle new file mode 100644 index 00000000..05b680a1 --- /dev/null +++ b/integration-tests/gradle/projects/it-basic-groovy/build.gradle @@ -0,0 +1,37 @@ +plugins { + id 'org.jetbrains.kotlin.jvm' + id("org.jetbrains.dokka") +} + +apply from: '../template.root.gradle.kts' + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib" +} + +dokkaKdoc { + outputDirectory = "$buildDir/dokka/customKdoc" + + failOnWarning = false + dokkaSourceSets { + customSourceSet { + sourceRoot { path = "$projectDir/src/main/java" } + sourceRoot { path = "$projectDir/src/main/kotlin" } + displayName = "custom" + reportUndocumented = true + } + } +} + +dokkaJavadoc { + outputDirectory = "$buildDir/dokka/customJavadoc" +} + +dokkaGfm { + outputDirectory = "$buildDir/dokka/customGfm" +} + +dokkaJekyll { + outputDirectory = "$buildDir/dokka/customJekyll" +} + diff --git a/integration-tests/gradle/projects/it-basic-groovy/gradle.properties b/integration-tests/gradle/projects/it-basic-groovy/gradle.properties new file mode 100644 index 00000000..7ebac3ad --- /dev/null +++ b/integration-tests/gradle/projects/it-basic-groovy/gradle.properties @@ -0,0 +1 @@ +dokka_it_kotlin_version=1.3.72 diff --git a/integration-tests/gradle/projects/it-basic-groovy/gradle/wrapper/gradle-wrapper.jar b/integration-tests/gradle/projects/it-basic-groovy/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..62d4c053 Binary files /dev/null and b/integration-tests/gradle/projects/it-basic-groovy/gradle/wrapper/gradle-wrapper.jar differ diff --git a/integration-tests/gradle/projects/it-basic-groovy/gradle/wrapper/gradle-wrapper.properties b/integration-tests/gradle/projects/it-basic-groovy/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..622ab64a --- /dev/null +++ b/integration-tests/gradle/projects/it-basic-groovy/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/integration-tests/gradle/projects/it-basic-groovy/gradlew b/integration-tests/gradle/projects/it-basic-groovy/gradlew new file mode 100755 index 00000000..fbd7c515 --- /dev/null +++ b/integration-tests/gradle/projects/it-basic-groovy/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/integration-tests/gradle/projects/it-basic-groovy/gradlew.bat b/integration-tests/gradle/projects/it-basic-groovy/gradlew.bat new file mode 100644 index 00000000..a9f778a7 --- /dev/null +++ b/integration-tests/gradle/projects/it-basic-groovy/gradlew.bat @@ -0,0 +1,104 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/integration-tests/gradle/projects/it-basic-groovy/settings.gradle.kts b/integration-tests/gradle/projects/it-basic-groovy/settings.gradle.kts new file mode 100644 index 00000000..cb6af4e9 --- /dev/null +++ b/integration-tests/gradle/projects/it-basic-groovy/settings.gradle.kts @@ -0,0 +1,5 @@ +@file:Suppress("LocalVariableName", "UnstableApiUsage") + +apply(from = "../template.settings.gradle.kts") +rootProject.name = "it-basic-groovy" + diff --git a/integration-tests/gradle/projects/it-basic-groovy/src/main/java/it/basic/java/SampleJavaClass.java b/integration-tests/gradle/projects/it-basic-groovy/src/main/java/it/basic/java/SampleJavaClass.java new file mode 100644 index 00000000..23b0202c --- /dev/null +++ b/integration-tests/gradle/projects/it-basic-groovy/src/main/java/it/basic/java/SampleJavaClass.java @@ -0,0 +1,17 @@ +package it.basic.java; + +import it.basic.PublicClass; + +/** + * This class is, unlike {@link PublicClass}, written in Java + */ +@SuppressWarnings("unused") +public class SampleJavaClass { + + /** + * @return Empty instance of {@link PublicClass} + */ + public PublicClass publicDocumentedFunction() { + return new PublicClass(); + } +} diff --git a/integration-tests/gradle/projects/it-basic-groovy/src/main/kotlin/it/basic/PublicClass.kt b/integration-tests/gradle/projects/it-basic-groovy/src/main/kotlin/it/basic/PublicClass.kt new file mode 100644 index 00000000..71bc7e63 --- /dev/null +++ b/integration-tests/gradle/projects/it-basic-groovy/src/main/kotlin/it/basic/PublicClass.kt @@ -0,0 +1,48 @@ +@file:Suppress("unused") + +package it.basic + +class PublicClass { + /** + * This function is public and documented + */ + fun publicDocumentedFunction(): String = "" + + fun publicUndocumentedFunction(): String = "" + + /** + * This function is internal and documented + */ + internal fun internalDocumentedFunction(): String = "" + + internal fun internalUndocumentedFunction(): String = "" + + /** + * This function is private and documented + */ + private fun privateDocumentedFunction(): String = "" + + private fun privateUndocumentedFunction(): String = "" + + + /** + * This property is public and documented + */ + val publicDocumentedProperty: Int = 0 + + val publicUndocumentedProperty: Int = 0 + + /** + * This property internal and documented + */ + val internalDocumentedProperty: Int = 0 + + val internalUndocumentedProperty: Int = 0 + + /** + * This property private and documented + */ + private val privateDocumentedProperty: Int = 0 + + private val privateUndocumentedProperty: Int = 0 +} 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 new file mode 100644 index 00000000..ffd04ae0 --- /dev/null +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGroovyIntegrationTest.kt @@ -0,0 +1,96 @@ +package org.jetbrains.dokka.it.gradle + +import org.gradle.testkit.runner.TaskOutcome +import org.junit.runners.Parameterized +import java.io.File +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertTrue +import kotlin.test.BeforeTest +import kotlin.test.Test + +class BasicGroovyIntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() { + + companion object { + @get:JvmStatic + @get:Parameterized.Parameters(name = "{0}") + val versions = BuildVersions.permutations( + gradleVersions = listOf("6.5.1", "5.6.4"), + kotlinVersions = listOf("1.4-M2-eap-70") + ) + } + @BeforeTest + fun prepareProjectFiles() { + val templateProjectDir = File("projects", "it-basic-groovy") + + templateProjectDir.listFiles().orEmpty() + .filter { it.isFile } + .forEach { topLevelFile -> topLevelFile.copyTo(File(projectDir, topLevelFile.name)) } + + File(templateProjectDir, "src").copyRecursively(File(projectDir, "src")) + } + + @Test + fun execute() { + val result = createGradleRunner("dokkaKdoc", "dokkaJavadoc", "dokkaGfm", "dokkaJekyll", "--stacktrace").build() + + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaKdoc")).outcome) + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaJavadoc")).outcome) + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaGfm")).outcome) + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaJekyll")).outcome) + + File(projectDir, "build/dokka/customKdoc").assertKdocOutputDir() + File(projectDir, "build/dokka/customJavadoc").assertJavadocOutputDir() + File(projectDir, "build/dokka/customGfm").assertGfmOutputDir() + File(projectDir, "build/dokka/customJekyll").assertJekyllOutputDir() + } + + private fun File.assertKdocOutputDir() { + assertTrue(isDirectory, "Missing dokka kdoc output directory") + + val imagesDir = File(this, "images") + assertTrue(imagesDir.isDirectory, "Missing images directory") + + val scriptsDir = File(this, "scripts") + assertTrue(scriptsDir.isDirectory, "Missing scripts directory") + + val stylesDir = File(this, "styles") + assertTrue(stylesDir.isDirectory, "Missing styles directory") + + val navigationHtml = File(this, "navigation.html") + assertTrue(navigationHtml.isFile, "Missing navigation.html") + + val moduleOutputDir = File(this, "it-basic-groovy") + assertTrue(moduleOutputDir.isDirectory, "Missing module directory") + + val moduleIndexHtml = File(moduleOutputDir, "index.html") + assertTrue(moduleIndexHtml.isFile, "Missing module index.html") + + val modulePackageDir = File(moduleOutputDir, "it.basic") + assertTrue(modulePackageDir.isDirectory, "Missing it.basic package directory") + + val modulePackageIndexHtml = File(modulePackageDir, "index.html") + assertTrue(modulePackageIndexHtml.isFile, "Missing module package index.html") + + val moduleJavaPackageDir = File(moduleOutputDir, "it.basic.java") + assertTrue(moduleJavaPackageDir.isDirectory, "Missing it.basic.java package directory") + + allHtmlFiles().forEach { file -> + assertContainsNoErrorClass(file) + assertNoUnresolvedLInks(file) + assertNoHrefToMissingLocalFileOrDirectory(file) + } + } + + private fun File.assertJavadocOutputDir() { + assertTrue(isDirectory, "Missing dokka javadoc output directory") + } + + private fun File.assertGfmOutputDir() { + assertTrue(isDirectory, "Missing dokka gfm output directory") + } + + private fun File.assertJekyllOutputDir() { + assertTrue(isDirectory, "Missing dokka jekyll output directory") + } +} diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt index 6114dbce..46b49660 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt @@ -6,6 +6,7 @@ import org.gradle.kotlin.dsl.create open class DokkaPlugin : Plugin { override fun apply(project: Project) { + project.createDokkaTasks("dokka") { outputDirectory = defaultDokkaOutputDirectory(project.buildDir, "dokkaKdoc").absolutePath doFirst { -- cgit From 61d78081f09aa3d751cfa5ddc6aafb5e11a262f1 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Fri, 10 Jul 2020 15:52:24 +0200 Subject: Rename default format "html" --- README.md | 8 ++++---- integration-tests/gradle/projects/it-basic-groovy/build.gradle | 4 ++-- .../org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt | 8 ++++---- .../org/jetbrains/dokka/it/gradle/BasicGroovyIntegrationTest.kt | 8 ++++---- .../org/jetbrains/dokka/it/gradle/Multimodule0IntegrationTest.kt | 6 +++--- .../dokka/it/gradle/Multiplatform0GradleIntegrationTest.kt | 6 +++--- plugins/base/build.gradle.kts | 2 +- .../src/main/kotlin/org/jetbrains/dokka/gradle/main.kt | 4 ++-- 8 files changed, 23 insertions(+), 23 deletions(-) (limited to 'integration-tests/gradle/src/integrationTest') diff --git a/README.md b/README.md index 5a96c60a..1730c87d 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ dokka { Kotlin ```kotlin -tasks.dokkaKdoc { +tasks.dokkaHtml { outputDirectory = "$buildDir/dokka" } ``` @@ -190,7 +190,7 @@ kotlin { // Kotlin Multiplatform plugin configuration js("customName") // Define a js platform named "customName" If you want to generate docs for it, you need to have this name in dokka configuration below } -dokkaKdoc { +dokkaHtml { outputDirectory = "$buildDir/dokka" multiplatform { @@ -220,7 +220,7 @@ kotlin { // Kotlin Multiplatform plugin configuration js("customName") } -dokkaKdoc { +dokkaHtml { outputDirectory = "$buildDir/dokka" multiplatform { @@ -246,7 +246,7 @@ dokkaKdoc { For convenience, there is also a reserved block called `global`, which is a top-level configuration of `perPackageOptions`, `externalDocumentationLinks`, and `sourceLinks` shared by every platform. Eg. ```groovy -dokkaKdoc { +dokkaHtml { multiplatform { global { // perPackageOptions, sourceLinks and externalDocumentationLinks from here will be copied to every other platform (jvm and js in eg.) perPackageOption { diff --git a/integration-tests/gradle/projects/it-basic-groovy/build.gradle b/integration-tests/gradle/projects/it-basic-groovy/build.gradle index 05b680a1..1ffa75bc 100644 --- a/integration-tests/gradle/projects/it-basic-groovy/build.gradle +++ b/integration-tests/gradle/projects/it-basic-groovy/build.gradle @@ -9,8 +9,8 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib" } -dokkaKdoc { - outputDirectory = "$buildDir/dokka/customKdoc" +dokkaHtml { + outputDirectory = "$buildDir/dokka/customHtml" failOnWarning = false dokkaSourceSets { 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 87460080..9ea47d96 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 @@ -29,21 +29,21 @@ class BasicGradleIntegrationTest(override val versions: BuildVersions) : Abstrac @Test fun execute() { - val result = createGradleRunner("dokkaKdoc", "dokkaJavadoc", "dokkaGfm", "dokkaJekyll", "--stacktrace").build() + val result = createGradleRunner("dokkaHtml", "dokkaJavadoc", "dokkaGfm", "dokkaJekyll", "--stacktrace").build() - assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaKdoc")).outcome) + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtml")).outcome) assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaJavadoc")).outcome) assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaGfm")).outcome) assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaJekyll")).outcome) - File(projectDir, "build/dokka/kdoc").assertKdocOutputDir() + File(projectDir, "build/dokka/html").assertKdocOutputDir() File(projectDir, "build/dokka/javadoc").assertJavadocOutputDir() File(projectDir, "build/dokka/gfm").assertGfmOutputDir() File(projectDir, "build/dokka/jekyll").assertJekyllOutputDir() } private fun File.assertKdocOutputDir() { - assertTrue(isDirectory, "Missing dokka kdoc output directory") + assertTrue(isDirectory, "Missing dokka html output directory") val imagesDir = File(this, "images") assertTrue(imagesDir.isDirectory, "Missing images directory") 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 ffd04ae0..7a620d9c 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 @@ -32,21 +32,21 @@ class BasicGroovyIntegrationTest(override val versions: BuildVersions) : Abstrac @Test fun execute() { - val result = createGradleRunner("dokkaKdoc", "dokkaJavadoc", "dokkaGfm", "dokkaJekyll", "--stacktrace").build() + val result = createGradleRunner("dokkaHtml", "dokkaJavadoc", "dokkaGfm", "dokkaJekyll", "--stacktrace").build() - assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaKdoc")).outcome) + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtml")).outcome) assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaJavadoc")).outcome) assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaGfm")).outcome) assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaJekyll")).outcome) - File(projectDir, "build/dokka/customKdoc").assertKdocOutputDir() + File(projectDir, "build/dokka/customHtml").assertKdocOutputDir() File(projectDir, "build/dokka/customJavadoc").assertJavadocOutputDir() File(projectDir, "build/dokka/customGfm").assertGfmOutputDir() File(projectDir, "build/dokka/customJekyll").assertJekyllOutputDir() } private fun File.assertKdocOutputDir() { - assertTrue(isDirectory, "Missing dokka kdoc output directory") + assertTrue(isDirectory, "Missing dokka html output directory") val imagesDir = File(this, "images") assertTrue(imagesDir.isDirectory, "Missing images 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 75ef547a..95b6e683 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 @@ -26,11 +26,11 @@ class Multimodule0IntegrationTest(override val versions: BuildVersions) : Abstra @Test fun execute() { - val result = createGradleRunner("dokkaKdoc", ":moduleA:dokkaKdocMultimodule", "--stacktrace").build() + val result = createGradleRunner("dokkaHtml", ":moduleA:dokkaHtmlMultimodule", "--stacktrace").build() - assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":moduleA:dokkaKdocMultimodule")).outcome) + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":moduleA:dokkaHtmlMultimodule")).outcome) - val outputDir = File(projectDir, "moduleA/build/dokka/kdocMultimodule") + val outputDir = File(projectDir, "moduleA/build/dokka/htmlMultimodule") assertTrue(outputDir.isDirectory, "Missing dokka output directory") assertTrue( 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 8fa1d3de..0a8c4fe0 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 @@ -27,11 +27,11 @@ class Multiplatform0GradleIntegrationTest(override val versions: BuildVersions) @Test fun execute() { - val result = createGradleRunner("dokkaKdoc", "--stacktrace").build() + val result = createGradleRunner("dokkaHtml", "--stacktrace").build() - assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaKdoc")).outcome) + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtml")).outcome) - val dokkaOutputDir = File(projectDir, "build/dokka/kdoc") + val dokkaOutputDir = File(projectDir, "build/dokka/html") assertTrue(dokkaOutputDir.isDirectory, "Missing dokka output directory") dokkaOutputDir.allHtmlFiles().forEach { file -> diff --git a/plugins/base/build.gradle.kts b/plugins/base/build.gradle.kts index 1cedf354..1fe3dbc2 100644 --- a/plugins/base/build.gradle.kts +++ b/plugins/base/build.gradle.kts @@ -39,4 +39,4 @@ publishing { } } -configureBintrayPublication("basePlugin") \ No newline at end of file +configureBintrayPublication("basePlugin") diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt index 46b49660..ccb7ae0e 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt @@ -10,11 +10,11 @@ open class DokkaPlugin : Plugin { project.createDokkaTasks("dokka") { outputDirectory = defaultDokkaOutputDirectory(project.buildDir, "dokkaKdoc").absolutePath doFirst { - logger.warn(":dokka task is deprecated in favor of :dokkaKdoc") + logger.warn(":dokka task is deprecated in favor of :dokkaHtml") } } - project.createDokkaTasks("dokkaKdoc") + project.createDokkaTasks("dokkaHtml") project.createDokkaTasks("dokkaJavadoc") { plugins.dependencies.add(project.dokkaArtifacts.javadocPlugin) -- cgit From a904221e2f64093eb72f786584671f875aabf6ed Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Mon, 13 Jul 2020 08:21:27 +0200 Subject: Adapt Android0GradleIntegrationTest for new format configuration --- .../dokka/it/gradle/Android0GradleIntegrationTest.kt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (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 2b8ba45d..52dc6f0c 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 @@ -51,17 +51,25 @@ class Android0GradleIntegrationTest(override val versions: BuildVersions) : Abst @Test fun execute() { - val result = createGradleRunner("dokka", "--stacktrace").build() - assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokka")).outcome) + val result = createGradleRunner("dokkaHtml", "--stacktrace").build() + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtml")).outcome) - projectDir.allHtmlFiles().forEach { file -> + val htmlOutputDir = File(projectDir, "build/dokka/html") + assertTrue(htmlOutputDir.isDirectory, "Missing html output directory") + + assertTrue( + htmlOutputDir.allHtmlFiles().count() > 0, + "Expected html files in html output directory" + ) + + htmlOutputDir.allHtmlFiles().forEach { file -> assertContainsNoErrorClass(file) assertNoUnresolvedLInks(file) assertNoHrefToMissingLocalFileOrDirectory(file) } assertTrue( - projectDir.allHtmlFiles().any { file -> + htmlOutputDir.allHtmlFiles().any { file -> "https://developer.android.com/reference/android/content/Context.html" in file.readText() }, "Expected link to developer.android.com" ) -- cgit From 57b9432fb971926c9a6a904f932d69c7fa022ef3 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Mon, 13 Jul 2020 13:44:05 +0200 Subject: BasicGradleIntegrationTest: Cover dokkaSourceSet configureEach --- integration-tests/gradle/projects/it-basic/build.gradle.kts | 9 +++++++++ .../org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'integration-tests/gradle/src/integrationTest') diff --git a/integration-tests/gradle/projects/it-basic/build.gradle.kts b/integration-tests/gradle/projects/it-basic/build.gradle.kts index e5a44555..1de92418 100644 --- a/integration-tests/gradle/projects/it-basic/build.gradle.kts +++ b/integration-tests/gradle/projects/it-basic/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.dokka.gradle.DokkaTask + plugins { kotlin("jvm") id("org.jetbrains.dokka") @@ -9,3 +11,10 @@ dependencies { implementation(kotlin("stdlib")) } +tasks.withType { + dokkaSourceSets { + configureEach { + moduleDisplayName = "Basic Project" + } + } +} 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 9ea47d96..5e23a753 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 @@ -57,7 +57,7 @@ class BasicGradleIntegrationTest(override val versions: BuildVersions) : Abstrac val navigationHtml = File(this, "navigation.html") assertTrue(navigationHtml.isFile, "Missing navigation.html") - val moduleOutputDir = File(this, "it-basic") + val moduleOutputDir = File(this, "-basic -project") assertTrue(moduleOutputDir.isDirectory, "Missing module directory") val moduleIndexHtml = File(moduleOutputDir, "index.html") @@ -77,6 +77,11 @@ class BasicGradleIntegrationTest(override val versions: BuildVersions) : Abstrac assertNoUnresolvedLInks(file) assertNoHrefToMissingLocalFileOrDirectory(file) } + + assertTrue( + allHtmlFiles().any { file -> "Basic Project" in file.readText() }, + "Expected configured moduleDisplayName to be present in html" + ) } private fun File.assertJavadocOutputDir() { -- cgit From 62e208137f8058e075d1d38a5b167c8241871ce0 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Tue, 14 Jul 2020 12:14:51 +0200 Subject: DokkaMultimoduleTask: Automatically declare dependencies to sub dokka tasks --- .../dokka/it/gradle/Multimodule0IntegrationTest.kt | 2 +- .../jetbrains/dokka/gradle/DokkaCollectorTask.kt | 2 +- .../jetbrains/dokka/gradle/DokkaMultimoduleTask.kt | 33 ++++++++++++++-------- .../main/kotlin/org/jetbrains/dokka/gradle/main.kt | 4 +-- 4 files changed, 26 insertions(+), 15 deletions(-) (limited to 'integration-tests/gradle/src/integrationTest') 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 95b6e683..821ae08b 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 @@ -26,7 +26,7 @@ class Multimodule0IntegrationTest(override val versions: BuildVersions) : Abstra @Test fun execute() { - val result = createGradleRunner("dokkaHtml", ":moduleA:dokkaHtmlMultimodule", "--stacktrace").build() + val result = createGradleRunner(":moduleA:dokkaHtmlMultimodule", "--stacktrace").build() assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":moduleA:dokkaHtmlMultimodule")).outcome) diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt index 0270dbe2..38da9631 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt @@ -16,7 +16,7 @@ open class DokkaCollectorTask : DefaultTask() { private lateinit var configuration: GradleDokkaConfigurationImpl @Input - val dokkaTaskNames: MutableSet = mutableSetOf() + var dokkaTaskNames: Set = setOf() @TaskAction fun collect() { diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultimoduleTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultimoduleTask.kt index affab485..cc7b8d86 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultimoduleTask.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultimoduleTask.kt @@ -12,7 +12,12 @@ open class DokkaMultimoduleTask : AbstractDokkaTask(), Configurable { @Input - val dokkaTaskNames: MutableSet = mutableSetOf() + var dokkaTaskNames: Set = setOf() + set(value) { + field = value.toSet() + setDependsOn(getSubprojectDokkaTasks(value)) + } + override fun generate() { val bootstrap = DokkaBootstrap("org.jetbrains.dokka.DokkaMultimoduleBootstrapImpl") @@ -36,16 +41,22 @@ open class DokkaMultimoduleTask : AbstractDokkaTask(), Configurable { outputDir = project.file(outputDirectory).absolutePath pluginsClasspath = plugins.resolve().toList() pluginsConfiguration = this@DokkaMultimoduleTask.pluginsConfiguration - modules = project.subprojects - .flatMap { subProject -> dokkaTaskNames.mapNotNull(subProject.tasks::findByName) } - .filterIsInstance() - .map { dokkaTask -> - GradleDokkaModuleDescription().apply { - name = dokkaTask.project.name - path = dokkaTask.project.projectDir.resolve(dokkaTask.outputDirectory) - .toRelativeString(project.file(outputDirectory)) - docFile = dokkaTask.project.projectDir.resolve(documentationFileName).absolutePath - } + modules = getSubprojectDokkaTasks(dokkaTaskNames).map { dokkaTask -> + GradleDokkaModuleDescription().apply { + name = dokkaTask.project.name + path = dokkaTask.project.projectDir.resolve(dokkaTask.outputDirectory) + .toRelativeString(project.file(outputDirectory)) + docFile = dokkaTask.project.projectDir.resolve(documentationFileName).absolutePath } + } } + + private fun getSubprojectDokkaTasks(dokkaTaskName: String): List { + return project.subprojects + .mapNotNull { subproject -> subproject.tasks.findByName(dokkaTaskName) as? DokkaTask } + } + + private fun getSubprojectDokkaTasks(dokkaTaskNames: Set): List { + return dokkaTaskNames.flatMap { dokkaTaskName -> getSubprojectDokkaTasks(dokkaTaskName) } + } } diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt index a851ee13..5bf76880 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt @@ -37,12 +37,12 @@ open class DokkaPlugin : Plugin { project.maybeCreateDokkaPluginConfiguration(multimoduleName) project.maybeCreateDokkaRuntimeConfiguration(multimoduleName) project.tasks.register(multimoduleName) { - dokkaTaskNames.add(name) + dokkaTaskNames = dokkaTaskNames + name configuration() } project.tasks.register("${name}Collector") { - dokkaTaskNames.add(name) + dokkaTaskNames = dokkaTaskNames + name } } } -- cgit From 2c9fe4c22e13f4d84f4085563715162fcdf2ec85 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Tue, 14 Jul 2020 14:55:46 +0200 Subject: Implement GradleRunner.buildRelaxed API --- .../it/gradle/Android0GradleIntegrationTest.kt | 2 +- .../dokka/it/gradle/BasicGradleIntegrationTest.kt | 3 ++- .../dokka/it/gradle/BasicGroovyIntegrationTest.kt | 4 ++- .../dokka/it/gradle/Multimodule0IntegrationTest.kt | 2 +- .../gradle/Multiplatform0GradleIntegrationTest.kt | 2 +- .../it/gradle/AbstractGradleIntegrationTest.kt | 30 ++++++++++++++++++++++ 6 files changed, 38 insertions(+), 5 deletions(-) (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 52dc6f0c..19235597 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 @@ -51,7 +51,7 @@ class Android0GradleIntegrationTest(override val versions: BuildVersions) : Abst @Test fun execute() { - val result = createGradleRunner("dokkaHtml", "--stacktrace").build() + val result = createGradleRunner("dokkaHtml", "--stacktrace").buildRelaxed() assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtml")).outcome) val htmlOutputDir = File(projectDir, "build/dokka/html") 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 5e23a753..c9c45d58 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 @@ -29,7 +29,8 @@ class BasicGradleIntegrationTest(override val versions: BuildVersions) : Abstrac @Test fun execute() { - val result = createGradleRunner("dokkaHtml", "dokkaJavadoc", "dokkaGfm", "dokkaJekyll", "--stacktrace").build() + val result = createGradleRunner("dokkaHtml", "dokkaJavadoc", "dokkaGfm", "dokkaJekyll", "--stacktrace") + .buildRelaxed() assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtml")).outcome) assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaJavadoc")).outcome) 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 7a620d9c..b20a7b2d 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 @@ -19,6 +19,7 @@ class BasicGroovyIntegrationTest(override val versions: BuildVersions) : Abstrac kotlinVersions = listOf("1.4-M2-eap-70") ) } + @BeforeTest fun prepareProjectFiles() { val templateProjectDir = File("projects", "it-basic-groovy") @@ -32,7 +33,8 @@ class BasicGroovyIntegrationTest(override val versions: BuildVersions) : Abstrac @Test fun execute() { - val result = createGradleRunner("dokkaHtml", "dokkaJavadoc", "dokkaGfm", "dokkaJekyll", "--stacktrace").build() + val result = createGradleRunner("dokkaHtml", "dokkaJavadoc", "dokkaGfm", "dokkaJekyll", "--stacktrace") + .buildRelaxed() assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtml")).outcome) assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaJavadoc")).outcome) 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 821ae08b..50ae22f9 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 @@ -26,7 +26,7 @@ class Multimodule0IntegrationTest(override val versions: BuildVersions) : Abstra @Test fun execute() { - val result = createGradleRunner(":moduleA:dokkaHtmlMultimodule", "--stacktrace").build() + val result = createGradleRunner(":moduleA:dokkaHtmlMultimodule", "--stacktrace").buildRelaxed() assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":moduleA:dokkaHtmlMultimodule")).outcome) 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 0a8c4fe0..3e254dd0 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 @@ -27,7 +27,7 @@ class Multiplatform0GradleIntegrationTest(override val versions: BuildVersions) @Test fun execute() { - val result = createGradleRunner("dokkaHtml", "--stacktrace").build() + val result = createGradleRunner("dokkaHtml", "--stacktrace").buildRelaxed() assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtml")).outcome) diff --git a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt index 5b3e3250..f852dc8b 100644 --- a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt +++ b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt @@ -1,8 +1,13 @@ package org.jetbrains.dokka.it.gradle +import org.gradle.testkit.runner.BuildResult import org.gradle.testkit.runner.GradleRunner import org.gradle.testkit.runner.internal.DefaultGradleRunner +import org.gradle.tooling.GradleConnectionException import org.jetbrains.dokka.it.AbstractIntegrationTest +import org.junit.Assume +import org.junit.Assume.assumeFalse +import org.junit.AssumptionViolatedException import org.junit.runner.RunWith import org.junit.runners.Parameterized import java.io.File @@ -41,4 +46,29 @@ abstract class AbstractGradleIntegrationTest : AbstractIntegrationTest() { ).run { this as DefaultGradleRunner } .withJvmArguments("-Xmx4G", "-XX:MaxMetaspaceSize=2G") } + + fun GradleRunner.buildRelaxed(): BuildResult { + return try { + build() + } catch (e: Throwable) { + val gradleConnectionException = e.withAllCauses().find { it is GradleConnectionException } + if (gradleConnectionException != null) { + gradleConnectionException.printStackTrace() + throw AssumptionViolatedException("Assumed Gradle connection", gradleConnectionException) + + } + throw e + } + } +} + +private fun Throwable.withAllCauses(): Sequence { + val root = this + return sequence { + yield(root) + val cause = root.cause + if (cause != null && cause != root) { + yieldAll(cause.withAllCauses()) + } + } } -- cgit From e32e42e084d4e150387a7e9ec4ee00ae3974babd Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Wed, 15 Jul 2020 16:38:25 +0200 Subject: Use DokkaLogger instead of println and adjust log levels for less verbosity by default --- core/src/main/kotlin/DokkaBootstrapImpl.kt | 13 ----------- core/src/main/kotlin/DokkaGenerator.kt | 9 ++++---- core/src/main/kotlin/plugability/DokkaContext.kt | 8 +++---- core/src/main/kotlin/utilities/DokkaLogging.kt | 25 +++++++++++----------- .../it/gradle/Android0GradleIntegrationTest.kt | 2 +- .../dokka/it/gradle/BasicGradleIntegrationTest.kt | 2 +- .../dokka/it/gradle/BasicGroovyIntegrationTest.kt | 2 +- .../dokka/it/gradle/Multimodule0IntegrationTest.kt | 2 +- .../gradle/Multiplatform0GradleIntegrationTest.kt | 2 +- .../src/main/kotlin/MavenDokkaLogger.kt | 14 +----------- .../src/main/kotlin/testApi/logger/TestLogger.kt | 7 +----- 11 files changed, 28 insertions(+), 58 deletions(-) (limited to 'integration-tests/gradle/src/integrationTest') diff --git a/core/src/main/kotlin/DokkaBootstrapImpl.kt b/core/src/main/kotlin/DokkaBootstrapImpl.kt index 936fbe6c..fabbc889 100644 --- a/core/src/main/kotlin/DokkaBootstrapImpl.kt +++ b/core/src/main/kotlin/DokkaBootstrapImpl.kt @@ -66,19 +66,6 @@ class DokkaBootstrapImpl : DokkaBootstrap { override fun error(message: String) { consumer.accept("error", message).also { errorsCount++ } } - - override fun report() { - if (warningsCount > 0 || errorsCount > 0) { - println( - "Generation completed with $warningsCount warning" + - (if (warningsCount == 1) "" else "s") + - " and $errorsCount error" + - if (errorsCount == 1) "" else "s" - ) - } else { - println("generation completed successfully") - } - } } private lateinit var generator: DokkaGenerator diff --git a/core/src/main/kotlin/DokkaGenerator.kt b/core/src/main/kotlin/DokkaGenerator.kt index d694cc8c..4262d890 100644 --- a/core/src/main/kotlin/DokkaGenerator.kt +++ b/core/src/main/kotlin/DokkaGenerator.kt @@ -6,6 +6,7 @@ import org.jetbrains.dokka.pages.RootPageNode import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.DokkaPlugin import org.jetbrains.dokka.utilities.DokkaLogger +import org.jetbrains.dokka.utilities.report /** @@ -17,7 +18,7 @@ class DokkaGenerator( private val configuration: DokkaConfiguration, private val logger: DokkaLogger ) { - fun generate() = timed { + fun generate() = timed(logger) { report("Initializing plugins") val context = initializePlugins(configuration, logger) @@ -115,7 +116,7 @@ class DokkaGenerator( fun reportAfterRendering(context: DokkaContext) { context.unusedPoints.takeIf { it.isNotEmpty() }?.also { - logger.warn("Unused extension points found: ${it.joinToString(", ")}") + logger.info("Unused extension points found: ${it.joinToString(", ")}") } logger.report() @@ -142,12 +143,12 @@ private class Timer(startTime: Long, private val logger: DokkaLogger?) { } fun dump(prefix: String = "") { - println(prefix) + logger?.info(prefix) val namePad = steps.map { it.first.length }.max() ?: 0 val timePad = steps.windowed(2).map { (p1, p2) -> p2.second - p1.second }.max()?.toString()?.length ?: 0 steps.windowed(2).forEach { (p1, p2) -> if (p1.first.isNotBlank()) { - println("${p1.first.padStart(namePad)}: ${(p2.second - p1.second).toString().padStart(timePad)}") + logger?.info("${p1.first.padStart(namePad)}: ${(p2.second - p1.second).toString().padStart(timePad)}") } } } diff --git a/core/src/main/kotlin/plugability/DokkaContext.kt b/core/src/main/kotlin/plugability/DokkaContext.kt index 61ae1918..323039e9 100644 --- a/core/src/main/kotlin/plugability/DokkaContext.kt +++ b/core/src/main/kotlin/plugability/DokkaContext.kt @@ -205,9 +205,9 @@ private class DokkaContextConfigurationImpl( "\t${it.key} by " + (it.value.singleOrNull() ?: it.value) } - logger.progress("Loaded plugins: $pluginNames") - logger.progress("Loaded: $loadedListForDebug") - logger.progress("Suppressed: $suppressedList") + logger.info("Loaded plugins: $pluginNames") + logger.info("Loaded: $loadedListForDebug") + logger.info("Suppressed: $suppressedList") } } @@ -220,4 +220,4 @@ private fun checkClasspath(classLoader: URLClassLoader) { } } -private fun MutableMap>.listFor(key: K) = getOrPut(key, ::mutableListOf) \ No newline at end of file +private fun MutableMap>.listFor(key: K) = getOrPut(key, ::mutableListOf) diff --git a/core/src/main/kotlin/utilities/DokkaLogging.kt b/core/src/main/kotlin/utilities/DokkaLogging.kt index 4b671f7b..6b8ed5d2 100644 --- a/core/src/main/kotlin/utilities/DokkaLogging.kt +++ b/core/src/main/kotlin/utilities/DokkaLogging.kt @@ -8,7 +8,18 @@ interface DokkaLogger { fun progress(message: String) fun warn(message: String) fun error(message: String) - fun report() +} + +fun DokkaLogger.report() { + if (DokkaConsoleLogger.warningsCount > 0 || DokkaConsoleLogger.errorsCount > 0) { + info("Generation completed with ${DokkaConsoleLogger.warningsCount} warning" + + (if(DokkaConsoleLogger.warningsCount == 1) "" else "s") + + " and ${DokkaConsoleLogger.errorsCount} error" + + if(DokkaConsoleLogger.errorsCount == 1) "" else "s" + ) + } else { + info("generation completed successfully") + } } object DokkaConsoleLogger : DokkaLogger { @@ -24,16 +35,4 @@ object DokkaConsoleLogger : DokkaLogger { override fun warn(message: String) = println("WARN: $message").also { warningsCount++ } override fun error(message: String) = println("ERROR: $message").also { errorsCount++ } - - override fun report() { - if (warningsCount > 0 || errorsCount > 0) { - println("Generation completed with $warningsCount warning" + - (if(warningsCount == 1) "" else "s") + - " and $errorsCount error" + - if(errorsCount == 1) "" else "s" - ) - } else { - println("generation completed successfully") - } - } } 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 19235597..30c3d07f 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 @@ -51,7 +51,7 @@ class Android0GradleIntegrationTest(override val versions: BuildVersions) : Abst @Test fun execute() { - val result = createGradleRunner("dokkaHtml", "--stacktrace").buildRelaxed() + val result = createGradleRunner("dokkaHtml", "-i", "-s").buildRelaxed() assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtml")).outcome) val htmlOutputDir = File(projectDir, "build/dokka/html") 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 c9c45d58..929c99aa 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 @@ -29,7 +29,7 @@ class BasicGradleIntegrationTest(override val versions: BuildVersions) : Abstrac @Test fun execute() { - val result = createGradleRunner("dokkaHtml", "dokkaJavadoc", "dokkaGfm", "dokkaJekyll", "--stacktrace") + val result = createGradleRunner("dokkaHtml", "dokkaJavadoc", "dokkaGfm", "dokkaJekyll", "-i", "-s") .buildRelaxed() assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtml")).outcome) 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 b20a7b2d..0d812ca9 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 @@ -33,7 +33,7 @@ class BasicGroovyIntegrationTest(override val versions: BuildVersions) : Abstrac @Test fun execute() { - val result = createGradleRunner("dokkaHtml", "dokkaJavadoc", "dokkaGfm", "dokkaJekyll", "--stacktrace") + val result = createGradleRunner("dokkaHtml", "dokkaJavadoc", "dokkaGfm", "dokkaJekyll", "-i", "-s") .buildRelaxed() assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtml")).outcome) 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 50ae22f9..64cf3d75 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 @@ -26,7 +26,7 @@ class Multimodule0IntegrationTest(override val versions: BuildVersions) : Abstra @Test fun execute() { - val result = createGradleRunner(":moduleA:dokkaHtmlMultimodule", "--stacktrace").buildRelaxed() + val result = createGradleRunner(":moduleA:dokkaHtmlMultimodule", "-i","-s").buildRelaxed() assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":moduleA:dokkaHtmlMultimodule")).outcome) 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 3e254dd0..d6d2ff6a 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 @@ -27,7 +27,7 @@ class Multiplatform0GradleIntegrationTest(override val versions: BuildVersions) @Test fun execute() { - val result = createGradleRunner("dokkaHtml", "--stacktrace").buildRelaxed() + val result = createGradleRunner("dokkaHtml", "-i", "-s").buildRelaxed() assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtml")).outcome) diff --git a/runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt b/runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt index 403fc773..4b5f4fa9 100644 --- a/runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt +++ b/runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt @@ -12,16 +12,4 @@ class MavenDokkaLogger(val log: Log) : DokkaLogger { override fun progress(message: String) = log.info(message) override fun warn(message: String) = log.warn(message).also { warningsCount++ } override fun error(message: String) = log.error(message).also { errorsCount++ } - - override fun report() { - if (warningsCount > 0 || errorsCount > 0) { - log.info("Generation completed with $warningsCount warning" + - (if(warningsCount == 1) "" else "s") + - " and $errorsCount error" + - if(errorsCount == 1) "" else "s" - ) - } else { - log.info("generation completed successfully") - } - } -} \ No newline at end of file +} diff --git a/testApi/src/main/kotlin/testApi/logger/TestLogger.kt b/testApi/src/main/kotlin/testApi/logger/TestLogger.kt index 8f88f88b..1dbe4a48 100644 --- a/testApi/src/main/kotlin/testApi/logger/TestLogger.kt +++ b/testApi/src/main/kotlin/testApi/logger/TestLogger.kt @@ -45,9 +45,4 @@ class TestLogger(private val logger: DokkaLogger) : DokkaLogger { _errorMessages.add(message) logger.error(message) } - - override fun report() { - logger.report() - } - -} \ No newline at end of file +} -- cgit From 47e5f565d28f1bf1a5a822e8f30f989abc2ced99 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Thu, 16 Jul 2020 11:44:25 +0200 Subject: Use kotlin "1.4-M3" artifact --- gradle.properties | 2 +- .../org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt | 6 +++--- .../org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt | 2 +- .../org/jetbrains/dokka/it/gradle/BasicGroovyIntegrationTest.kt | 2 +- .../org/jetbrains/dokka/it/gradle/Multimodule0IntegrationTest.kt | 2 +- .../dokka/it/gradle/Multiplatform0GradleIntegrationTest.kt | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) (limited to 'integration-tests/gradle/src/integrationTest') diff --git a/gradle.properties b/gradle.properties index 3d00dff9..81b55546 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ dokka_version_base=1.4-M3 dokka_publication_channel=dokka # Kotlin compiler and plugin -kotlin_version=1.4-M3-eap-197 +kotlin_version=1.4-M3 kotlin_plugin_version=1.4-M3-release-207 coroutines_version=1.3.7-1.4-M3 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 30c3d07f..2a9d7a70 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 @@ -15,15 +15,15 @@ class Android0GradleIntegrationTest(override val versions: BuildVersions) : Abst @get:Parameters(name = "{0}") val versions = BuildVersions.permutations( gradleVersions = listOf("6.5.1", "5.6.4"), - kotlinVersions = listOf("1.3.72", "1.4-M2-eap-70"), + kotlinVersions = listOf("1.3.72", "1.4-M3"), androidGradlePluginVersions = listOf("3.5.3", "3.6.3") ) + BuildVersions.permutations( gradleVersions = listOf("6.5.1", "6.1.1"), - kotlinVersions = listOf("1.3.72", "1.4-M2-eap-70"), + kotlinVersions = listOf("1.3.72", "1.4-M3"), androidGradlePluginVersions = listOf("4.0.0") ) + BuildVersions.permutations( gradleVersions = listOf("6.5.1"), - kotlinVersions = listOf("1.3.72", "1.4-M2-eap-70"), + kotlinVersions = listOf("1.3.72", "1.4-M3"), androidGradlePluginVersions = listOf("4.1.0-beta02") ) } 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 929c99aa..30b560e7 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 @@ -12,7 +12,7 @@ class BasicGradleIntegrationTest(override val versions: BuildVersions) : Abstrac @get:Parameters(name = "{0}") val versions = BuildVersions.permutations( gradleVersions = listOf("6.5.1", "6.4.1", "6.3", "6.2.2", "6.1.1", "6.0", "5.6.4"), - kotlinVersions = listOf("1.3.30", "1.3.72", "1.4-M2-eap-70") + kotlinVersions = listOf("1.3.30", "1.3.72", "1.4-M3") ) } 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 0d812ca9..92b7ec40 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 @@ -16,7 +16,7 @@ class BasicGroovyIntegrationTest(override val versions: BuildVersions) : Abstrac @get:Parameterized.Parameters(name = "{0}") val versions = BuildVersions.permutations( gradleVersions = listOf("6.5.1", "5.6.4"), - kotlinVersions = listOf("1.4-M2-eap-70") + kotlinVersions = listOf("1.4-M3") ) } 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 64cf3d75..390db3a0 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 @@ -11,7 +11,7 @@ class Multimodule0IntegrationTest(override val versions: BuildVersions) : Abstra @get:Parameterized.Parameters(name = "{0}") val versions = BuildVersions.permutations( gradleVersions = listOf("6.5.1", "6.1.1"), - kotlinVersions = listOf("1.4-M2-eap-70") + kotlinVersions = listOf("1.4-M3") ) } 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 d6d2ff6a..6a3b9c83 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 @@ -12,7 +12,7 @@ class Multiplatform0GradleIntegrationTest(override val versions: BuildVersions) @get:Parameterized.Parameters(name = "{0}") val versions = BuildVersions.permutations( gradleVersions = listOf("6.5.1", "6.1.1"), - kotlinVersions = listOf("1.3.30", "1.3.72", "1.4-M2-eap-70") + kotlinVersions = listOf("1.3.30", "1.3.72", "1.4-M3") ) } -- cgit