From edffe8f29e8dbbf435e0f324e5df57b383343bf1 Mon Sep 17 00:00:00 2001 From: James Strachan Date: Thu, 23 Feb 2012 13:58:12 +0000 Subject: [PATCH] moved the kdoc generation to a separate doc goal, use fork to avoid running out of permgen space and minor refactor --- build.xml | 12 +++++++----- .../kotlin/org/jetbrains/kotlin/doc/KDoc.kt | 17 ++++++++++++++--- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/build.xml b/build.xml index 3eb8db32a41..a73d158bbee 100644 --- a/build.xml +++ b/build.xml @@ -49,7 +49,7 @@ - + @@ -63,7 +63,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -111,7 +111,7 @@ - + @@ -212,7 +212,9 @@ - + + + diff --git a/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/KDoc.kt b/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/KDoc.kt index ba216723821..fab359da67c 100644 --- a/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/KDoc.kt +++ b/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/KDoc.kt @@ -32,17 +32,28 @@ import org.jetbrains.jet.util.slicedmap.WritableSlice import org.jetbrains.jet.lang.resolve.BindingContextUtils -class KDoc(val outputDir: File) : CompilerPlugin { +/** Base class for any compiler plugin which needs to process a KModel */ +abstract class KModelCompilerPlugin : CompilerPlugin { override fun processFiles(context: BindingContext?, sources: List?) { if (context != null && sources != null) { val model = KModel(context) model.load(sources) - val generator = KDocGenerator(model, outputDir) - generator.execute() + processModel(model) } } + + abstract fun processModel(model: KModel): Unit +} + +/** Generates the Kotlin Documentation for the model */ +class KDoc(val outputDir: File) : KModelCompilerPlugin() { + + override fun processModel(model: KModel) { + val generator = KDocGenerator(model, outputDir) + generator.execute() + } } class KDocGenerator(val model: KModel, val outputDir: File) {