kodiak
A collection of wrappers around various code documentation tools which produces a common JSON output readable by Orchid.
Overview
Most code documentation tools work by generating an HTML site. They have to do a lot of work to format navigate the code's internal structure, and then create a website that very often, looks quite awful. It would be better for everyone if the language designers only needed to produce a code model, and then let someone else do the hard work of turning that model into a website.
Orchid is that tool that creates a beautiful website for your code docs. This project is the other side of that coin which produces a model that Orchid can use to generate those sites.
Installation
repositories {
mavenCentral()
}
// for plain JVM projects
dependencies {
implementation("com.eden.kodiak:javadoc-runner:1.0.0")
implementation("com.eden.kodiak:dokka-runner:1.0.0")
implementation("com.eden.kodiak:groovydoc-runner:1.0.0")
implementation("com.eden.kodiak:swiftdoc-runner:1.0.0")
}
Targets
Java (Javadoc)
repositories {
mavenCentral()
}
dependencies {
implementation("com.eden.kodiak:javadoc-runner:1.0.0")
}
var cacheDir: Path = Files.createTempDirectory("javadocCache")
val runner: JavadocInvoker = JavadocInvokerImpl(cacheDir)
val outputDir = File("build/javadoc").canonicalFile.toPath()
outputDir.toFile().deleteRecursively()
outputDir.toFile().mkdirs()
val rootDoc = runner.getRootDoc(
listOf(
File("src/main/java").canonicalFile.toPath()
),
outputDir
) { inputStream -> IOStreamUtils.InputStreamPrinter(inputStream, null) }
rootDoc.packages.forEach { processPackage(it) }
rootDoc.classes.forEach { processClass(it) }
-
skip by including
@suppress
in its comments- classes
- constructors
- fields
- methods
Kotlin (Dokka)
repositories {
mavenCentral()
}
dependencies {
implementation("com.eden.kodiak:dokka-runner:1.0.0")
}
var cacheDir: Path = Files.createTempDirectory("dokkaCache")
val runner: KotlindocInvoker = KotlindocInvokerImpl(cacheDir)
val outputDir = File("build/dokka").canonicalFile.toPath()
outputDir.toFile().deleteRecursively()
outputDir.toFile().mkdirs()
val rootDoc = runner.getRootDoc(
listOf(
File("src/main/java").canonicalFile.toPath(),
File("src/main/kotlin").canonicalFile.toPath()
),
outputDir
) { inputStream -> IOStreamUtils.InputStreamPrinter(inputStream, null) }
rootDoc.packages.forEach { processPackage(it) }
rootDoc.classes.forEach { processClass(it) }
-
skip by including
@suppress
in its comments- classes
- constructors
- fields
- methods
Groovy (Groovydoc)
repositories {
mavenCentral()
}
dependencies {
implementation("com.eden.kodiak:groovydoc-runner:1.0.0")
}
var cacheDir: Path = Files.createTempDirectory("groovydocCache")
val runner: GroovydocInvoker = GroovydocInvokerImpl(cacheDir)
val outputDir = File("build/groovydoc").canonicalFile.toPath()
outputDir.toFile().deleteRecursively()
outputDir.toFile().mkdirs()
val rootDoc = runner.getRootDoc(
listOf(
File("src/main/java").canonicalFile.toPath(),
File("src/main/groovy").canonicalFile.toPath()
),
outputDir
) { inputStream -> IOStreamUtils.InputStreamPrinter(inputStream, null) }
rootDoc.packages.forEach { processPackage(it) }
rootDoc.classes.forEach { processClass(it) }
-
skip by including
@suppress
in its comments- classes
- constructors
- fields
- methods
Swift (Sourcekitten)
repositories {
mavenCentral()
}
dependencies {
implementation("com.eden.kodiak:swiftdoc-runner:1.0.0")
}
var cacheDir: Path = Files.createTempDirectory("swiftdocCache")
val runner: SwiftdocInvoker = SwiftdocInvokerImpl(cacheDir)
val outputDir = File("build/swiftdoc").canonicalFile.toPath()
outputDir.toFile().deleteRecursively()
outputDir.toFile().mkdirs()
val rootDoc = runner.getRootDoc(
listOf(
File("src/main/swift").canonicalFile.toPath()
),
outputDir
) { inputStream -> IOStreamUtils.InputStreamPrinter(inputStream, null) }
rootDoc.sourceFiles.forEach { processSourceFile(it) }
rootDoc.classes.forEach { processClass(it) }
-
skip by including
- suppress
in its comments- classes
- initializers
- fields
- methods