mirror of
https://github.com/apple/pkl.git
synced 2026-05-25 16:19:20 +02:00
pkl-doc: Support single-package docsite mode (#1592)
When a docsite has only one package name and no DocsiteInfo.overview, treat it like Javadoc's single-module output: redirect the top-level index to the package page and omit the site-title breadcrumb segment from generated pages. Add src/test/files/SinglePackageTest fixtures to cover multiple package versions, redirect behavior, breadcrumb behavior, and unchanged site structure. Also: - Shut down Executor used in test. - Declare expected output fixtures of DocGenerator as test inputs, not outputs. - Fix IntelliJ warning by using a Set for the right-hand side of collection subtraction.
This commit is contained in:
@@ -69,6 +69,15 @@ publishing {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
inputs.dir("src/test/files/DocGeneratorTest/input")
|
||||
inputs.dir("src/test/files/DocGeneratorTest/output")
|
||||
inputs.dir("src/test/files/DocMigratorTest/input")
|
||||
inputs.dir("src/test/files/DocMigratorTest/output")
|
||||
inputs.dir("src/test/files/SinglePackageTest/input")
|
||||
inputs.dir("src/test/files/SinglePackageTest/output")
|
||||
}
|
||||
|
||||
val testNativeExecutable by
|
||||
tasks.registering(Test::class) {
|
||||
dependsOn(tasks.assembleNative)
|
||||
@@ -76,7 +85,7 @@ val testNativeExecutable by
|
||||
classpath = sourceSets.test.get().runtimeClasspath
|
||||
|
||||
inputs.dir("src/test/files/DocGeneratorTest/input")
|
||||
outputs.dir("src/test/files/DocGeneratorTest/output")
|
||||
inputs.dir("src/test/files/DocGeneratorTest/output")
|
||||
systemProperty("org.pkl.doc.NativeExecutableTest", "true")
|
||||
|
||||
filter { includeTestsMatching("org.pkl.doc.NativeExecutableTest") }
|
||||
@@ -89,7 +98,7 @@ val testJavaExecutable by
|
||||
|
||||
dependsOn(tasks.javaExecutable)
|
||||
inputs.dir("src/test/files/DocGeneratorTest/input")
|
||||
outputs.dir("src/test/files/DocGeneratorTest/output")
|
||||
inputs.dir("src/test/files/DocGeneratorTest/output")
|
||||
systemProperty("org.pkl.doc.JavaExecutableTest", "true")
|
||||
|
||||
filter { includeTestsMatching("org.pkl.doc.JavaExecutableTest") }
|
||||
@@ -105,4 +114,6 @@ tasks.jar { manifest { attributes += mapOf("Main-Class" to "org.pkl.doc.Main") }
|
||||
|
||||
htmlValidator { sources = files("src/test/files/DocGeneratorTest/output") }
|
||||
|
||||
tasks.validateHtml { mustRunAfter(testJavaExecutable) }
|
||||
// Tests usually read expected output files, but may write missing ones before failing.
|
||||
// If that happens, delay validation until after any test tasks in the graph.
|
||||
tasks.validateHtml { mustRunAfter(tasks.test, testJavaExecutable, testNativeExecutable) }
|
||||
|
||||
Reference in New Issue
Block a user