diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-12-03 16:22:11 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-12-03 16:22:49 +0100 |
commit | 39631054c58df5841ea268b7002b820ec55f6e0a (patch) | |
tree | cefedd8411c859243bd181568e16fcdd372a38c8 /src/Generation/FileGenerator.kt | |
parent | 797cb4732c53bf1e3b2091add8cf731fc436607f (diff) | |
download | dokka-39631054c58df5841ea268b7002b820ec55f6e0a.tar.gz dokka-39631054c58df5841ea268b7002b820ec55f6e0a.tar.bz2 dokka-39631054c58df5841ea268b7002b820ec55f6e0a.zip |
restructure Dokka build to use Gradle for everything except for the Maven plugin
Diffstat (limited to 'src/Generation/FileGenerator.kt')
-rw-r--r-- | src/Generation/FileGenerator.kt | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/src/Generation/FileGenerator.kt b/src/Generation/FileGenerator.kt deleted file mode 100644 index a762bae3..00000000 --- a/src/Generation/FileGenerator.kt +++ /dev/null @@ -1,57 +0,0 @@ -package org.jetbrains.dokka - -import com.google.inject.Inject -import java.io.File -import java.io.FileOutputStream -import java.io.IOException -import java.io.OutputStreamWriter - -public class FileGenerator @Inject constructor(val locationService: FileLocationService) : Generator { - - @set:Inject(optional = true) var outlineService: OutlineFormatService? = null - @set:Inject(optional = true) lateinit var formatService: FormatService - - override fun buildPages(nodes: Iterable<DocumentationNode>) { - val specificLocationService = locationService.withExtension(formatService.extension) - - for ((location, items) in nodes.groupBy { specificLocationService.location(it) }) { - val file = location.file - file.parentFile?.mkdirsOrFail() - try { - FileOutputStream(file).use { - OutputStreamWriter(it, Charsets.UTF_8).use { - it.write(formatService.format(location, items)) - } - } - } catch (e: Throwable) { - println(e) - } - buildPages(items.flatMap { it.members }) - } - } - - override fun buildOutlines(nodes: Iterable<DocumentationNode>) { - val outlineService = this.outlineService ?: return - for ((location, items) in nodes.groupBy { locationService.location(it) }) { - val file = outlineService.getOutlineFileName(location) - file.parentFile?.mkdirsOrFail() - FileOutputStream(file).use { - OutputStreamWriter(it, Charsets.UTF_8).use { - it.write(outlineService.formatOutline(location, items)) - } - } - } - } - - override fun buildSupportFiles() { - FileOutputStream(locationService.location(listOf("style.css"), false).file).use { - javaClass.getResourceAsStream("/dokka/styles/style.css").copyTo(it) - } - } -} - -private fun File.mkdirsOrFail() { - if (!mkdirs() && !exists()) { - throw IOException("Failed to create directory $this") - } -}
\ No newline at end of file |