Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Korro outputs #370

Merged
merged 4 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import com.google.devtools.ksp.gradle.KspTaskJvm
import com.google.devtools.ksp.gradle.KspTask
import io.github.devcrocod.korro.KorroTask
import nl.jolanrensen.docProcessor.defaultProcessors.*
import nl.jolanrensen.docProcessor.gradle.creatingProcessDocTask
import org.gradle.jvm.tasks.Jar
Expand Down Expand Up @@ -76,7 +77,7 @@ val samplesImplementation by configurations.getting {
extendsFrom(configurations.testImplementation.get())
}

val myKotlinCompileTask = tasks.named<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>("compileSamplesKotlin") {
val compileSamplesKotlin = tasks.named<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>("compileSamplesKotlin") {
friendPaths.from(sourceSets["main"].output.classesDirs)
source(sourceSets["test"].kotlin)
destinationDirectory.set(file("$buildDir/classes/testWithOutputs/kotlin"))
Expand All @@ -94,17 +95,17 @@ tasks.named("lintKotlinSamples") {
onlyIf { false }
}

val clearTestResults by tasks.creating(Delete::class) {
delete(File(buildDir, "dataframes"))
delete(File(buildDir, "korroOutputLines"))
}

val samplesTest = tasks.register<Test>("samplesTest") {
group = "Verification"
description = "Runs the custom tests."

dependsOn(myKotlinCompileTask)

doFirst {
delete {
delete(fileTree(File(buildDir, "dataframes")))
}
}
dependsOn(compileSamplesKotlin)
dependsOn(clearTestResults)

environment("DATAFRAME_SAVE_OUTPUTS", "")

Expand Down Expand Up @@ -132,11 +133,15 @@ val copySamplesOutputs = tasks.register<JavaExec>("copySamplesOutputs") {
group = "documentation"
mainClass.set("org.jetbrains.kotlinx.dataframe.explainer.SampleAggregatorKt")

dependsOn(samplesTest)
dependsOn(clearSamplesOutputs)
dependsOn(samplesTest)
classpath = sourceSets.test.get().runtimeClasspath
}

tasks.withType<KorroTask> {
dependsOn(copySamplesOutputs)
}

val generatedSourcesFolderName = "generated-sources"
val addGeneratedSourcesToGit by tasks.creating(GitTask::class) {
directory.set(file("."))
Expand Down Expand Up @@ -217,6 +222,10 @@ korro {
include("src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/*.kt")
}

outputs = fileTree(project.buildDir) {
include("korroOutputLines/*")
}

groupSamples {

beforeSample.set("<tab title=\"NAME\">\n")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,17 @@ object PluginCallbackProxy : PluginCallback {
it.mkdirs()
}
output.writeHTML(File(destination, "$name.html"))
val korro = File("build/korroOutputLines").also {
it.mkdirs()
}

val group = name.substringBefore("_")
File(korro, group).writeText(
"""

<dataFrame src="$group.html"/>
""".trimIndent()
)
}

private fun statementOutput(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class Render : TestBase() {
}

@Test
@TransformDataFrameExpressions
fun composeTables() {
// SampleStart
val df1 = df.reorderColumnsByName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,17 @@ object PluginCallbackProxy : PluginCallback {
it.mkdirs()
}
output.writeHTML(File(destination, "$name.html"))
val korro = File("build/korroOutputLines").also {
it.mkdirs()
}

val group = name.substringBefore("_")
File(korro, group).writeText(
"""

<dataFrame src="$group.html"/>
""".trimIndent()
)
}

private fun statementOutput(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class Render : TestBase() {
}

@Test
@TransformDataFrameExpressions
fun composeTables() {
// SampleStart
val df1 = df.reorderColumnsByName()
Expand Down
Loading