aboutsummaryrefslogtreecommitdiff
path: root/runners
diff options
context:
space:
mode:
Diffstat (limited to 'runners')
-rw-r--r--runners/gradle-integration-tests/build.gradle4
-rw-r--r--runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/MultiplatformProjectTest.kt54
-rw-r--r--runners/gradle-integration-tests/testData/multiplatformProject/build.gradle56
-rw-r--r--runners/gradle-integration-tests/testData/multiplatformProject/fileTree.txt17
-rw-r--r--runners/gradle-integration-tests/testData/multiplatformProject/settings.gradle1
-rw-r--r--runners/gradle-integration-tests/testData/multiplatformProject/src/jsMain/kotlin/org/kotlintestmpp/main.kt14
-rw-r--r--runners/gradle-integration-tests/testData/multiplatformProject/src/jvmMain/kotlin/org/kotlintestmpp/main.kt20
7 files changed, 166 insertions, 0 deletions
diff --git a/runners/gradle-integration-tests/build.gradle b/runners/gradle-integration-tests/build.gradle
index 1bfdbd5b..2430d46b 100644
--- a/runners/gradle-integration-tests/build.gradle
+++ b/runners/gradle-integration-tests/build.gradle
@@ -14,6 +14,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
configurations {
dokkaPlugin
dokkaFatJar
+ kotlinGradle
}
dependencies {
@@ -25,6 +26,8 @@ dependencies {
dokkaPlugin project(path: ':runners:gradle-plugin', configuration: 'shadow')
dokkaFatJar project(path: ":runners:fatjar", configuration: 'shadow')
+ kotlinGradle "org.jetbrains.kotlin:kotlin-gradle-plugin"
+
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile gradleTestKit()
}
@@ -41,6 +44,7 @@ task createClasspathManifest {
outputDir.mkdirs()
file("$outputDir/dokka-plugin-classpath.txt").text = configurations.dokkaPlugin.join("\n")
file("$outputDir/fatjar.txt").text = configurations.dokkaFatJar.join("\n")
+ file("$outputDir/kotlin-gradle.txt").text = configurations.kotlinGradle.join("\n")
}
}
diff --git a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/MultiplatformProjectTest.kt b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/MultiplatformProjectTest.kt
new file mode 100644
index 00000000..3e61d79e
--- /dev/null
+++ b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/MultiplatformProjectTest.kt
@@ -0,0 +1,54 @@
+package org.jetbrains.dokka.gradle
+
+import org.gradle.testkit.runner.TaskOutcome
+import org.junit.Test
+import java.io.File
+import kotlin.test.assertEquals
+
+class MultiplatformProjectTest : AbstractDokkaGradleTest() {
+
+ fun prepareTestData(testDataRootPath: String) {
+ val testDataRoot = testDataFolder.resolve(testDataRootPath)
+ val tmpRoot = testProjectDir.root.toPath()
+
+ testDataRoot.apply {
+ resolve("build.gradle").copy(tmpRoot.resolve("build.gradle"))
+ resolve("settings.gradle").copy(tmpRoot.resolve("settings.gradle"))
+ resolve("src").copy(tmpRoot.resolve("src"))
+ }
+ }
+
+ private fun doTest(gradleVersion: String, kotlinVersion: String) {
+ val kotlinGradlePlugin = pluginClasspathData.resolveSibling("kotlin-gradle.txt").toFile().readLines().map { File(it) }
+ prepareTestData("multiplatformProject")
+
+ // Remove withDebug(false) when https://github.com/gradle/gradle/issues/6862 is solved
+ val result = configure(gradleVersion, kotlinVersion, arguments = arrayOf("dokka", "--stacktrace"))
+ .withDebug(false)
+ .withPluginClasspath(pluginClasspath.union(kotlinGradlePlugin))
+ .build()
+
+ println(result.output)
+
+ assertEquals(TaskOutcome.SUCCESS, result.task(":dokka")?.outcome)
+
+ val docsOutput = "build/dokka"
+
+ checkOutputStructure("multiplatformProject/fileTree.txt", docsOutput)
+
+ checkNoErrorClasses(docsOutput)
+ checkNoUnresolvedLinks(docsOutput)
+ }
+
+ @Test fun `test kotlin 1_3_30 and gradle 4_7`() {
+ doTest("4.7", "1.3.30")
+ }
+
+ @Test fun `test kotlin 1_3_40 and gradle 4_10_3`() {
+ doTest("4.10.3", "1.3.40")
+ }
+
+ @Test fun `test kotlin 1_3_40 and gradle 5_6_1`() {
+ doTest("5.6.1", "1.3.50")
+ }
+} \ No newline at end of file
diff --git a/runners/gradle-integration-tests/testData/multiplatformProject/build.gradle b/runners/gradle-integration-tests/testData/multiplatformProject/build.gradle
new file mode 100644
index 00000000..be7ae999
--- /dev/null
+++ b/runners/gradle-integration-tests/testData/multiplatformProject/build.gradle
@@ -0,0 +1,56 @@
+buildscript {
+ repositories {
+ mavenCentral()
+ jcenter()
+ maven { url "https://dl.bintray.com/kotlin/kotlin-eap-1.1" }
+ maven { url "https://dl.bintray.com/kotlin/kotlin-dev" }
+ }
+ dependencies {
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$test_kotlin_version"
+ }
+}
+
+plugins {
+ id 'org.jetbrains.dokka'
+}
+
+repositories {
+ jcenter()
+ mavenLocal()
+}
+
+group 'org.test'
+version '1.0-SNAPSHOT'
+
+apply plugin: "org.jetbrains.kotlin.multiplatform"
+
+kotlin {
+ jvm() // Create a JVM target with the default name 'jvm'
+ js()
+ sourceSets {
+ jsMain {
+ dependencies{
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-js"
+ }
+ }
+ jvmMain {
+ dependencies {
+ implementation kotlin('stdlib-jdk8')
+ }
+ }
+ }
+}
+
+apply plugin: 'org.jetbrains.dokka'
+
+dokka {
+
+ multiplatform {
+ javascript {
+ targets = ["js"]
+ platform = "js"
+ kotlinTasks { [tasks.getByPath(":compileKotlinJs")] }
+ }
+ jvm {}
+ }
+}
diff --git a/runners/gradle-integration-tests/testData/multiplatformProject/fileTree.txt b/runners/gradle-integration-tests/testData/multiplatformProject/fileTree.txt
new file mode 100644
index 00000000..51a5df94
--- /dev/null
+++ b/runners/gradle-integration-tests/testData/multiplatformProject/fileTree.txt
@@ -0,0 +1,17 @@
+/
+ multiplatform-project-root/
+ alltypes/
+ index.html
+ index-outline.html
+ index.html
+ org.kotlintestmpp/
+ get-current-date.html
+ index.html
+ js.html
+ jvm.html
+ kotlin.-string/
+ index.html
+ main.html
+ shared.html
+ package-list
+ style.css
diff --git a/runners/gradle-integration-tests/testData/multiplatformProject/settings.gradle b/runners/gradle-integration-tests/testData/multiplatformProject/settings.gradle
new file mode 100644
index 00000000..0bb1e91b
--- /dev/null
+++ b/runners/gradle-integration-tests/testData/multiplatformProject/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = "multiplatformProjectRoot"
diff --git a/runners/gradle-integration-tests/testData/multiplatformProject/src/jsMain/kotlin/org/kotlintestmpp/main.kt b/runners/gradle-integration-tests/testData/multiplatformProject/src/jsMain/kotlin/org/kotlintestmpp/main.kt
new file mode 100644
index 00000000..a77b50f9
--- /dev/null
+++ b/runners/gradle-integration-tests/testData/multiplatformProject/src/jsMain/kotlin/org/kotlintestmpp/main.kt
@@ -0,0 +1,14 @@
+package org.kotlintestmpp
+
+fun main(args : Array<String>) {
+ console.log("Hello, world!")
+}
+
+fun js(){}
+fun shared(){}
+
+fun getCurrentDate(): String {
+ return "test"
+}
+
+fun String.myExtension() = println("test") \ No newline at end of file
diff --git a/runners/gradle-integration-tests/testData/multiplatformProject/src/jvmMain/kotlin/org/kotlintestmpp/main.kt b/runners/gradle-integration-tests/testData/multiplatformProject/src/jvmMain/kotlin/org/kotlintestmpp/main.kt
new file mode 100644
index 00000000..96d725fc
--- /dev/null
+++ b/runners/gradle-integration-tests/testData/multiplatformProject/src/jvmMain/kotlin/org/kotlintestmpp/main.kt
@@ -0,0 +1,20 @@
+package org.kotlintestmpp
+
+
+fun main(args : Array<String>) {
+ println("Hello, world!")
+}
+
+/**
+ * comment for this class
+ */
+fun jvm(){}
+fun shared(){}
+
+fun getCurrentDate(): String {
+ return "test"
+}
+
+fun String.myExtension() = println("test2")
+
+