aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/Generation
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2017-02-23 15:21:03 +0100
committerDmitry Jemerov <yole@jetbrains.com>2017-02-23 15:21:03 +0100
commita39c7a161282d132d08bcf89eed0213374a574e9 (patch)
tree973c36ded09cfd3a92b1fbfef947503b5ee71afe /core/src/main/kotlin/Generation
parent287c8207f6c7534ac9c5dfbc6e2ce10fae9a696b (diff)
downloaddokka-a39c7a161282d132d08bcf89eed0213374a574e9.tar.gz
dokka-a39c7a161282d132d08bcf89eed0213374a574e9.tar.bz2
dokka-a39c7a161282d132d08bcf89eed0213374a574e9.zip
Allow specifying implicit platforms for each source root
Diffstat (limited to 'core/src/main/kotlin/Generation')
-rw-r--r--core/src/main/kotlin/Generation/DokkaGenerator.kt21
1 files changed, 13 insertions, 8 deletions
diff --git a/core/src/main/kotlin/Generation/DokkaGenerator.kt b/core/src/main/kotlin/Generation/DokkaGenerator.kt
index aaf0deff..95066eec 100644
--- a/core/src/main/kotlin/Generation/DokkaGenerator.kt
+++ b/core/src/main/kotlin/Generation/DokkaGenerator.kt
@@ -22,9 +22,11 @@ import org.jetbrains.kotlin.utils.PathUtil
import java.io.File
import kotlin.system.measureTimeMillis
+class SourceRoot(val path: String, val implicitPlatforms: List<String> = emptyList())
+
class DokkaGenerator(val logger: DokkaLogger,
val classpath: List<String>,
- val sources: List<String>,
+ val sources: List<SourceRoot>,
val samples: List<String>,
val includes: List<String>,
val moduleName: String,
@@ -33,7 +35,10 @@ class DokkaGenerator(val logger: DokkaLogger,
private val documentationModule = DocumentationModule(moduleName)
fun generate() {
- appendSourceModule()
+ val sourcesGroupedByPlatform = sources.groupBy { it.implicitPlatforms }
+ for ((platforms, roots) in sourcesGroupedByPlatform) {
+ appendSourceModule(platforms, roots.map { it.path })
+ }
val timeBuild = measureTimeMillis {
logger.info("Generating pages... ")
@@ -43,18 +48,18 @@ class DokkaGenerator(val logger: DokkaLogger,
logger.info("done in ${timeBuild / 1000} secs")
}
- private fun appendSourceModule() {
- val environment = createAnalysisEnvironment()
+ private fun appendSourceModule(implicitPlatforms: List<String>, sourcePaths: List<String>) {
+ val environment = createAnalysisEnvironment(sourcePaths)
logger.info("Module: $moduleName")
logger.info("Output: ${File(options.outputDir)}")
- logger.info("Sources: ${environment.sources.joinToString()}")
+ logger.info("Sources: ${sourcePaths.joinToString()}")
logger.info("Classpath: ${environment.classpath.joinToString()}")
logger.info("Analysing sources and libraries... ")
val startAnalyse = System.currentTimeMillis()
- val injector = Guice.createInjector(DokkaAnalysisModule(environment, options, logger))
+ val injector = Guice.createInjector(DokkaAnalysisModule(environment, options, implicitPlatforms, logger))
buildDocumentationModule(injector, documentationModule, { isSample(it) }, includes)
@@ -64,7 +69,7 @@ class DokkaGenerator(val logger: DokkaLogger,
Disposer.dispose(environment)
}
- fun createAnalysisEnvironment(): AnalysisEnvironment {
+ fun createAnalysisEnvironment(sourcePaths: List<String>): AnalysisEnvironment {
val environment = AnalysisEnvironment(DokkaMessageCollector(logger))
environment.apply {
@@ -74,7 +79,7 @@ class DokkaGenerator(val logger: DokkaLogger,
addClasspath(File(element))
}
- addSources(this@DokkaGenerator.sources)
+ addSources(sourcePaths)
addSources(this@DokkaGenerator.samples)
}