Skip to content
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
39 changes: 39 additions & 0 deletions examples/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
val exampleTestTasks = ArrayList<TaskProvider<*>>()

exampleTestTasks += tasks.register<Exec>("runExampleScript") {
group = "Application"
description = "Runs the 'example-script.main.kts' script"
commandLine("kotlinc", "-script", file("example-script.main.kts"))
}

exampleTestTasks += tasks.register<GradleBuild>("runExampleProject") {
group = "Verification"
description = "Runs examples/example-project as a standalone build"
dir = file("example-project")
tasks = listOf("run")
}

val notebooks = fileTree(file("example-notebooks")) {
exclude(".ipynb_checkpoints")
}

exampleTestTasks += notebooks.map { notebook ->
val buildDir = project.layout.buildDirectory.asFile.get()
tasks.register<Exec>("run${notebook.nameWithoutExtension}Notebook") {
group = "Application"
description = "Runs the '${notebook.name}' notebook with 'jupyter nbconvert --execute'"
commandLine(
"jupyter", "nbconvert",
"--execute",
"--to", "ipynb",
"--output-dir=$buildDir",
notebook,
)
}
}

tasks.register("runExamples") {
group = "Application"
description = "Runs everything in 'examples' directory"
dependsOn(exampleTestTasks)
}
Loading