diff options
author | sebastian.sellmair <sebastian.sellmair@jetbrains.com> | 2020-07-02 11:12:49 +0200 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-07-02 12:48:53 +0200 |
commit | 11a80c62d09d89803016c0feb3f41678bff41cfd (patch) | |
tree | a49e3ab7f4b6816c706073be462a014d21d77fde /integration-tests/gradle/src/main/kotlin | |
parent | 76132da3437873f5483b8a7ce03b1028fa37d139 (diff) | |
download | dokka-11a80c62d09d89803016c0feb3f41678bff41cfd.tar.gz dokka-11a80c62d09d89803016c0feb3f41678bff41cfd.tar.bz2 dokka-11a80c62d09d89803016c0feb3f41678bff41cfd.zip |
Add basic multiplatform gradle integration test
Diffstat (limited to 'integration-tests/gradle/src/main/kotlin')
3 files changed, 50 insertions, 16 deletions
diff --git a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractDefaultVersionsGradleIntegrationTest.kt b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractDefaultVersionsGradleIntegrationTest.kt index b7f44a4c..80737129 100644 --- a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractDefaultVersionsGradleIntegrationTest.kt +++ b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractDefaultVersionsGradleIntegrationTest.kt @@ -1,14 +1,30 @@ package org.jetbrains.dokka.it.gradle +import org.gradle.util.GradleVersion +import org.junit.Assume import org.junit.Test -abstract class AbstractDefaultVersionsGradleIntegrationTest : AbstractGradleIntegrationTest() { +abstract class AbstractDefaultVersionsGradleIntegrationTest( + private val minGradleVersion: GradleVersion? = null, + private val maxGradleVersion: GradleVersion? = null +) : AbstractGradleIntegrationTest() { protected abstract fun execute(versions: BuildVersions) + private fun executeIfRequirementsAreMet(versions: BuildVersions) { + if (minGradleVersion != null) { + Assume.assumeTrue(versions.gradleVersion >= minGradleVersion) + } + if (maxGradleVersion != null) { + Assume.assumeTrue(versions.gradleVersion <= maxGradleVersion) + } + + execute(versions ) + } + @Test - fun `gradle 5_6_4 kotlin 1_3_72`() { - execute( + open fun `gradle 5_6_4 kotlin 1_3_72`() { + executeIfRequirementsAreMet( BuildVersions( gradleVersion = "5.6.4", kotlinVersion = "1.3.72" @@ -17,8 +33,8 @@ abstract class AbstractDefaultVersionsGradleIntegrationTest : AbstractGradleInte } @Test - fun `gradle 5_6_4 kotlin 1_3_30`() { - execute( + open fun `gradle 5_6_4 kotlin 1_3_30`() { + executeIfRequirementsAreMet( BuildVersions( gradleVersion = "5.6.4", kotlinVersion = "1.3.30" @@ -27,8 +43,8 @@ abstract class AbstractDefaultVersionsGradleIntegrationTest : AbstractGradleInte } @Test - fun `gradle 5_6_4 kotlin 1_4_M2_eap_70`() { - execute( + open fun `gradle 5_6_4 kotlin 1_4_M2_eap_70`() { + executeIfRequirementsAreMet( BuildVersions( gradleVersion = "5.6.4", kotlinVersion = "1.4-M2-eap-70" @@ -37,8 +53,8 @@ abstract class AbstractDefaultVersionsGradleIntegrationTest : AbstractGradleInte } @Test - fun `gradle 6_1_1 kotlin 1_3_72`() { - execute( + open fun `gradle 6_1_1 kotlin 1_3_72`() { + executeIfRequirementsAreMet( BuildVersions( gradleVersion = "6.1.1", kotlinVersion = "1.3.72" @@ -47,8 +63,8 @@ abstract class AbstractDefaultVersionsGradleIntegrationTest : AbstractGradleInte } @Test - fun `gradle 6_5_1 kotlin 1_4_M2_eap_70`() { - execute( + open fun `gradle 6_5_1 kotlin 1_4_M2_eap_70`() { + executeIfRequirementsAreMet( BuildVersions( gradleVersion = "6.5.1", kotlinVersion = "1.4-M2-eap-70" @@ -57,8 +73,8 @@ abstract class AbstractDefaultVersionsGradleIntegrationTest : AbstractGradleInte } @Test - fun `gradle 6_5_1 kotlin 1_3_72`() { - execute( + open fun `gradle 6_5_1 kotlin 1_3_72`() { + executeIfRequirementsAreMet( BuildVersions( gradleVersion = "6.5.1", kotlinVersion = "1.3.72" 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 2efb9c55..e6b6b0eb 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 @@ -29,7 +29,7 @@ abstract class AbstractGradleIntegrationTest { ): GradleRunner { return GradleRunner.create() .withProjectDir(projectDir) - .withGradleVersion(buildVersions.gradleVersion) + .withGradleVersion(buildVersions.gradleVersion.version) .forwardOutput() .withArguments( "-Pkotlin_version=${buildVersions.kotlinVersion}", @@ -40,6 +40,14 @@ abstract class AbstractGradleIntegrationTest { } + fun File.allDescendentsWithExtension(extension: String): Sequence<File> { + return this.walkTopDown().filter { it.isFile && it.extension == extension } + } + + fun File.allHtmlFiles(): Sequence<File> { + return allDescendentsWithExtension("html") + } + protected fun assertContainsNoErrorClass(file: File) { val fileText = file.readText() assertFalse( diff --git a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/BuildVersions.kt b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/BuildVersions.kt index 6aa41e7a..2fdd0368 100644 --- a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/BuildVersions.kt +++ b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/BuildVersions.kt @@ -1,6 +1,16 @@ package org.jetbrains.dokka.it.gradle +import org.gradle.util.GradleVersion + data class BuildVersions( - val gradleVersion: String, + val gradleVersion: GradleVersion, val kotlinVersion: String -) +) { + constructor( + gradleVersion: String, + kotlinVersion: String + ) : this( + gradleVersion = GradleVersion.version(gradleVersion), + kotlinVersion = kotlinVersion + ) +} |