Skip to content

Commit c7ce1ac

Browse files
committed
Adding exportAsHtml option to processKDocsMain task and small readability improvement
1 parent 58943ab commit c7ce1ac

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

core/build.gradle.kts

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ val samplesTest = tasks.register<Test>("samplesTest") {
128128
ignoreFailures = true
129129

130130
testClassesDirs = fileTree("${layout.buildDirectory.get().asFile.path}/classes/testWithOutputs/kotlin")
131-
classpath = files("${layout.buildDirectory.get().asFile.path}/classes/testWithOutputs/kotlin") + configurations["samplesRuntimeClasspath"] + sourceSets["main"].runtimeClasspath
131+
classpath =
132+
files("${layout.buildDirectory.get().asFile.path}/classes/testWithOutputs/kotlin") +
133+
configurations["samplesRuntimeClasspath"] +
134+
sourceSets["main"].runtimeClasspath
132135
}
133136

134137
val clearSamplesOutputs by tasks.creating {
@@ -177,10 +180,12 @@ val installGitPreCommitHook by tasks.creating(Copy::class) {
177180
fileMode = 755
178181

179182
// Workaround for https://github.com/Kotlin/dataframe/issues/612
180-
if (OSType.identify() in listOf(OSType.Mac, OSType.Linux)) doLast {
181-
exec {
182-
workingDir(gitHooksDir)
183-
commandLine("chmod", "755", "pre-commit")
183+
if (OSType.identify() in listOf(OSType.Mac, OSType.Linux)) {
184+
doLast {
185+
exec {
186+
workingDir(gitHooksDir)
187+
commandLine("chmod", "755", "pre-commit")
188+
}
184189
}
185190
}
186191
} else {
@@ -207,14 +212,17 @@ val kotlinTestSources: FileCollection = kotlin.sourceSets.test.get().kotlin.sour
207212

208213
fun pathOf(vararg parts: String) = parts.joinToString(File.separator)
209214

215+
// Include both test and main sources for cross-referencing, Exclude generated sources
216+
val processKDocsMainSources = (kotlinMainSources + kotlinTestSources)
217+
.filterNot { pathOf("build", "generated") in it.path }
218+
210219
// Task to generate the processed documentation
211-
val processKDocsMain by creatingProcessDocTask(
212-
sources = (kotlinMainSources + kotlinTestSources) // Include both test and main sources for cross-referencing
213-
.filterNot { pathOf("build", "generated") in it.path }, // Exclude generated sources
214-
) {
220+
val processKDocsMain by creatingProcessDocTask(processKDocsMainSources) {
215221
target = file(generatedSourcesFolderName)
216222
arguments += ARG_DOC_PROCESSOR_LOG_NOT_FOUND to false
217-
223+
exportAsHtml {
224+
dir = file("../docs/StardustDocs/snippets")
225+
}
218226
task {
219227
group = "KDocs"
220228
doLast {
@@ -246,9 +254,11 @@ tasks.withType<Jar> {
246254
pathOf("src", "test", "kotlin") in it.path ||
247255
pathOf("src", "test", "java") in it.path
248256
} // filter out test sources again
249-
.plus(kotlinMainSources.filter {
250-
pathOf("build", "generated") in it.path
251-
}) // Include generated sources (which were excluded above)
257+
.plus(
258+
kotlinMainSources.filter {
259+
pathOf("build", "generated") in it.path
260+
},
261+
), // Include generated sources (which were excluded above)
252262
)
253263
}
254264
}
@@ -361,8 +371,8 @@ tasks.test {
361371
excludes.set(
362372
listOf(
363373
"org.jetbrains.kotlinx.dataframe.jupyter.*",
364-
"org.jetbrains.kotlinx.dataframe.jupyter.SampleNotebooksTests"
365-
)
374+
"org.jetbrains.kotlinx.dataframe.jupyter.SampleNotebooksTests",
375+
),
366376
)
367377
}
368378
}

0 commit comments

Comments
 (0)