From cb99d93049c3813fc4f940fc1c5211589de438ce Mon Sep 17 00:00:00 2001 From: Jolan Rensen Date: Thu, 22 Feb 2024 19:14:50 +0100 Subject: [PATCH] added DataFrameTest, updating java version to 11, gradle to 8.5, fixing test --- .gitignore | 1 + .../jolanrensen/docProcessor/TestInclude.kt | 2 + doc-processor-gradle-plugin/build.gradle.kts | 4 +- .../jolanrensen/docProcessor/DataFrameTest.kt | 39 +++++++++++++++++++ .../jolanrensen/docProcessor/TestInclude.kt | 12 +++--- gradle/wrapper/gradle-wrapper.properties | 2 +- 6 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 doc-processor-gradle-plugin/src/functionalTest/kotlin/nl/jolanrensen/docProcessor/DataFrameTest.kt diff --git a/.gitignore b/.gitignore index b98f340e..759dd729 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ hs_err_pid* /kdoc-include-gradle-plugin/build/ /build/ /.idea/ +/doc-processor-gradle-plugin/src/functionalTest/resources/dataframe/ diff --git a/doc-processor-common/src/test/kotlin/nl/jolanrensen/docProcessor/TestInclude.kt b/doc-processor-common/src/test/kotlin/nl/jolanrensen/docProcessor/TestInclude.kt index f44f9811..c6099783 100644 --- a/doc-processor-common/src/test/kotlin/nl/jolanrensen/docProcessor/TestInclude.kt +++ b/doc-processor-common/src/test/kotlin/nl/jolanrensen/docProcessor/TestInclude.kt @@ -4,6 +4,7 @@ import io.kotest.matchers.shouldBe import nl.jolanrensen.docProcessor.defaultProcessors.IncludeDocProcessor import org.intellij.lang.annotations.Language import org.junit.jupiter.api.Test +import kotlin.test.Ignore class TestInclude : DocProcessorTest("include") { @@ -14,6 +15,7 @@ class TestInclude : DocProcessorTest("include") { // TODO @Test + @Ignore fun `Include with and without package kotlin`() { @Language("kt") diff --git a/doc-processor-gradle-plugin/build.gradle.kts b/doc-processor-gradle-plugin/build.gradle.kts index 58f59271..05e4aabd 100644 --- a/doc-processor-gradle-plugin/build.gradle.kts +++ b/doc-processor-gradle-plugin/build.gradle.kts @@ -111,11 +111,11 @@ tasks.check { } tasks.withType { - kotlinOptions.jvmTarget = "1.8" + kotlinOptions.jvmTarget = "11" } java { toolchain { - languageVersion.set(JavaLanguageVersion.of(8)) + languageVersion.set(JavaLanguageVersion.of(11)) } } \ No newline at end of file diff --git a/doc-processor-gradle-plugin/src/functionalTest/kotlin/nl/jolanrensen/docProcessor/DataFrameTest.kt b/doc-processor-gradle-plugin/src/functionalTest/kotlin/nl/jolanrensen/docProcessor/DataFrameTest.kt new file mode 100644 index 00000000..aa3a61fb --- /dev/null +++ b/doc-processor-gradle-plugin/src/functionalTest/kotlin/nl/jolanrensen/docProcessor/DataFrameTest.kt @@ -0,0 +1,39 @@ +package nl.jolanrensen.docProcessor + +import org.gradle.testkit.runner.GradleRunner +import org.junit.Ignore +import org.junit.Test +import java.io.File +import kotlin.io.path.Path +import kotlin.io.path.exists + +class DataFrameTest : DocProcessorFunctionalTest("df") { + + private val projectDirectory = File("src/functionalTest/resources/dataframe") + private val outputDirectory = File(projectDirectory, "core/build/generated-sources") + + init { + require(projectDirectory.exists()) { + "The DataFrame directory does not exist. Please git clone the repository in the resources folder." + } + updateVersionInFiles() + } + + private fun updateVersionInFiles() { + val tomlFile = projectDirectory.resolve("gradle/libs.versions.toml") + var txt = tomlFile.readText() + txt = txt.replace("docProcessor = \"[^\"]+\"".toRegex(), "docProcessor = \"$version\"") + tomlFile.write(txt) + } + + @Test +// @Ignore + fun `build DataFrame`() { + GradleRunner.create() + .forwardOutput() + .withArguments("clean", "core:processKDocsMain") + .withProjectDir(projectDirectory) + .withDebug(true) + .build() + } +} \ No newline at end of file diff --git a/doc-processor-gradle-plugin/src/functionalTest/kotlin/nl/jolanrensen/docProcessor/TestInclude.kt b/doc-processor-gradle-plugin/src/functionalTest/kotlin/nl/jolanrensen/docProcessor/TestInclude.kt index 741a8bba..c42f0b11 100644 --- a/doc-processor-gradle-plugin/src/functionalTest/kotlin/nl/jolanrensen/docProcessor/TestInclude.kt +++ b/doc-processor-gradle-plugin/src/functionalTest/kotlin/nl/jolanrensen/docProcessor/TestInclude.kt @@ -200,12 +200,12 @@ class TestInclude : DocProcessorFunctionalTest(name = "include") { val expectedOutput = """ package com.example.plugin - /** - * Hello World! - * [Some aliased link][helloWorld2] - * [helloWorld\] - * [helloWorld] - */ + /** + * Hello World! + * [Some aliased link][helloWorld2] + * [helloWorld] + * [helloWorld] + */ fun helloWorld() {} /** Hello World! diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index da1db5f0..a5952066 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists