aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-integration-tests/src/test
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-06-19 18:52:49 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-06-20 16:15:48 +0300
commit24e3ebb492436ed53b7a4cda5fc7568004471b73 (patch)
tree8f9afc7426279f9f9324e6acf0afc62af227030f /runners/gradle-integration-tests/src/test
parent438fffa8b59c3aca1fd016fbf11689b34eeb0976 (diff)
downloaddokka-24e3ebb492436ed53b7a4cda5fc7568004471b73.tar.gz
dokka-24e3ebb492436ed53b7a4cda5fc7568004471b73.tar.bz2
dokka-24e3ebb492436ed53b7a4cda5fc7568004471b73.zip
Add android integration test, multi-flavour app test
Diffstat (limited to 'runners/gradle-integration-tests/src/test')
-rw-r--r--runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaGradleTest.kt2
-rw-r--r--runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAppTest.kt66
-rw-r--r--runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidMultiFlavourAppTest.kt58
3 files changed, 126 insertions, 0 deletions
diff --git a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaGradleTest.kt b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaGradleTest.kt
index f93e1868..255138a9 100644
--- a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaGradleTest.kt
+++ b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaGradleTest.kt
@@ -17,6 +17,8 @@ val androidPluginClasspathData = pluginClasspathData.resolveSibling("android-dok
val dokkaFatJarPathData = pluginClasspathData.resolveSibling("fatjar.txt")
+val androidLocalProperties = testDataFolder.resolve("android.local.properties").let { if (Files.exists(it)) it else null }
+
abstract class AbstractDokkaGradleTest {
@get:Rule val testProjectDir = TemporaryFolder()
diff --git a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAppTest.kt b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAppTest.kt
new file mode 100644
index 00000000..de22a980
--- /dev/null
+++ b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAppTest.kt
@@ -0,0 +1,66 @@
+package org.jetbrains.dokka.gradle
+
+import org.gradle.testkit.runner.TaskOutcome
+import org.junit.Test
+import java.io.File
+import java.nio.file.Files
+import kotlin.test.assertEquals
+
+class AndroidAppTest : AbstractDokkaGradleTest() {
+ override val pluginClasspath: List<File> = androidPluginClasspathData.toFile().readLines().map { File(it) }
+
+ fun prepareTestData(testDataRootPath: String) {
+ val testDataRoot = testDataFolder.resolve(testDataRootPath)
+ val tmpRoot = testProjectDir.root.toPath()
+
+ testDataRoot.resolve("app").copy(tmpRoot.resolve("app"))
+ testDataRoot.resolve("build.gradle").copy(tmpRoot.resolve("build.gradle"))
+ testDataRoot.resolve("settings.gradle").copy(tmpRoot.resolve("settings.gradle"))
+
+ androidLocalProperties?.copy(tmpRoot.resolve("local.properties"))
+ }
+
+
+ data class AndroidPluginParams(val pluginVersion: String, val buildToolsVersion: String, val compileSdk: Int) {
+ fun asArguments(): List<String> = listOf(
+ "-Pabt_plugin_version=$pluginVersion",
+ "-Pabt_version=$buildToolsVersion",
+ "-Psdk_version=$compileSdk"
+ )
+ }
+
+
+ private fun doTest(gradleVersion: String, kotlinVersion: String, androidPluginParams: AndroidPluginParams) {
+ prepareTestData("androidApp")
+
+ val result = configure(gradleVersion, kotlinVersion,
+ arguments = arrayOf("dokka", "--stacktrace") + androidPluginParams.asArguments())
+ .build()
+
+ println(result.output)
+
+ assertEquals(TaskOutcome.SUCCESS, result.task(":app:dokka")?.outcome)
+
+ val docsOutput = "app/build/dokka"
+
+ checkOutputStructure("androidApp/fileTree.txt", docsOutput)
+
+ checkNoErrorClasses(docsOutput)
+ checkNoUnresolvedLinks(docsOutput)
+
+ checkExternalLink(docsOutput, "<span class=\"identifier\">Activity</span>",
+ """<a href="https://developer.android.com/reference/android/app/Activity.html"><span class="identifier">Activity</span></a>""")
+ }
+
+ @Test fun `test kotlin 1_1_2-5 and gradle 4_0 and abt 3_0_0-alpha3`() {
+ doTest("4.0", "1.1.2-5", AndroidPluginParams("3.0.0-alpha3", "25.0.2", 25))
+ }
+
+ @Test fun `test kotlin 1_1_2 and gradle 3_5 and abt 2_3_0`() {
+ doTest("3.5", "1.1.2", AndroidPluginParams("2.3.0", "25.0.0", 24))
+ }
+
+ @Test fun `test kotlin 1_0_7 and gradle 2_14_1 and abt 2_2_3`() {
+ doTest("2.14.1", "1.0.7", AndroidPluginParams("2.2.3", "25.0.0", 24))
+ }
+} \ No newline at end of file
diff --git a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidMultiFlavourAppTest.kt b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidMultiFlavourAppTest.kt
new file mode 100644
index 00000000..aee0e14c
--- /dev/null
+++ b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidMultiFlavourAppTest.kt
@@ -0,0 +1,58 @@
+package org.jetbrains.dokka.gradle
+
+import org.gradle.testkit.runner.TaskOutcome
+import org.jetbrains.dokka.gradle.AndroidAppTest.AndroidPluginParams
+import org.junit.Test
+import java.io.File
+import kotlin.test.assertEquals
+
+class AndroidMultiFlavourAppTest : AbstractDokkaGradleTest() {
+ override val pluginClasspath: List<File> = androidPluginClasspathData.toFile().readLines().map { File(it) }
+
+ fun prepareTestData(testDataRootPath: String) {
+ val testDataRoot = testDataFolder.resolve(testDataRootPath)
+ val tmpRoot = testProjectDir.root.toPath()
+
+ testDataRoot.resolve("app").copy(tmpRoot.resolve("app"))
+ testDataRoot.resolve("build.gradle").copy(tmpRoot.resolve("build.gradle"))
+ testDataRoot.resolve("settings.gradle").copy(tmpRoot.resolve("settings.gradle"))
+
+ androidLocalProperties?.copy(tmpRoot.resolve("local.properties"))
+ }
+
+ private fun doTest(gradleVersion: String, kotlinVersion: String, androidPluginParams: AndroidPluginParams) {
+ prepareTestData("androidMultiFlavourApp")
+
+ val result = configure(gradleVersion, kotlinVersion,
+ arguments = arrayOf("dokka", "dokkaFullFlavourOnly", "--stacktrace") + androidPluginParams.asArguments())
+ .build()
+
+ println(result.output)
+
+ assertEquals(TaskOutcome.SUCCESS, result.task(":app:dokka")?.outcome)
+ assertEquals(TaskOutcome.SUCCESS, result.task(":app:dokkaFullFlavourOnly")?.outcome)
+
+ val docsOutput = "app/build/dokka"
+
+ checkOutputStructure("androidMultiFlavourApp/fileTree.txt", docsOutput)
+
+ checkNoErrorClasses(docsOutput)
+ checkNoUnresolvedLinks(docsOutput)
+
+ checkExternalLink(docsOutput, "<span class=\"identifier\">Activity</span>",
+ """<a href="https://developer.android.com/reference/android/app/Activity.html"><span class="identifier">Activity</span></a>""")
+ }
+
+ @Test fun `test kotlin 1_1_2-5 and gradle 4_0 and abt 3_0_0-alpha3`() {
+ doTest("4.0", "1.1.2-5", AndroidPluginParams("3.0.0-alpha3", "25.0.2", 25))
+ }
+
+ @Test fun `test kotlin 1_1_2 and gradle 3_5 and abt 2_3_0`() {
+ doTest("3.5", "1.1.2", AndroidPluginParams("2.3.0", "25.0.0", 24))
+ }
+
+ @Test fun `test kotlin 1_0_7 and gradle 2_14_1 and abt 2_2_3`() {
+ doTest("2.14.1", "1.0.7", AndroidPluginParams("2.2.3", "25.0.0", 24))
+ }
+
+} \ No newline at end of file