diff options
Diffstat (limited to 'core')
7 files changed, 11 insertions, 9 deletions
diff --git a/core/src/main/kotlin/DokkaGenerator.kt b/core/src/main/kotlin/DokkaGenerator.kt index 99041e1b..cabe43b6 100644 --- a/core/src/main/kotlin/DokkaGenerator.kt +++ b/core/src/main/kotlin/DokkaGenerator.kt @@ -31,7 +31,7 @@ class DokkaGenerator( val context = DokkaContext.create(configuration.pluginsClasspath, logger, platforms) logger.debug("Creating documentation models") - val modulesFromPlatforms = platforms.map { (pdata, _) -> translateDescriptors(pdata, context) } + val modulesFromPlatforms = platforms.map { (pdata, _) -> translateDescriptors(configuration.passesConfigurations.first().moduleName, pdata, context) } logger.debug("Merging documentation models") val documentationModel = context.single(CoreExtensions.documentationMerger) @@ -75,7 +75,7 @@ class DokkaGenerator( EnvironmentAndFacade(environment, facade) } - private fun translateDescriptors(platformData: PlatformData, context: DokkaContext): Module { + private fun translateDescriptors(moduleName: String, platformData: PlatformData, context: DokkaContext): Module { val (environment, facade) = context.platforms.getValue(platformData) val packageFragments = environment.getSourceFiles().asSequence() @@ -85,7 +85,7 @@ class DokkaGenerator( .toList() return context.single(CoreExtensions.descriptorToDocumentationTranslator) - .invoke(packageFragments, platformData, context) + .invoke(moduleName, packageFragments, platformData, context) } private class DokkaMessageCollector(private val logger: DokkaLogger) : MessageCollector { diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt index 4bdd41ae..bd3dafda 100644 --- a/core/src/main/kotlin/model/Documentable.kt +++ b/core/src/main/kotlin/model/Documentable.kt @@ -5,7 +5,7 @@ import org.jetbrains.dokka.transformers.descriptors.KotlinTypeWrapper import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.pages.PlatformData -class Module(val packages: List<Package>) : Documentable() { +class Module(override val name: String?, val packages: List<Package>) : Documentable() { override val dri: DRI = DRI.topLevel override val children: List<Package> = packages override val extra: MutableSet<Extra> = mutableSetOf() diff --git a/core/src/main/kotlin/pages/PageBuilder.kt b/core/src/main/kotlin/pages/PageBuilder.kt index b1009a33..9c40f73e 100644 --- a/core/src/main/kotlin/pages/PageBuilder.kt +++ b/core/src/main/kotlin/pages/PageBuilder.kt @@ -9,13 +9,12 @@ class DefaultPageBuilder( ) : PageBuilder { override fun pageForModule(m: Module): ModulePageNode = - ModulePageNode("root", contentForModule(m), m, m.packages.map { pageForPackage(it) }) + ModulePageNode(m.name ?: "root", contentForModule(m), m, m.packages.map { pageForPackage(it) }) override fun pageForPackage(p: Package) = PackagePageNode(p.name, contentForPackage(p), p.dri, p, p.classes.map { pageForClass(it) } + - p.functions.map { pageForMember(it) } + - p.properties.map { pageForMember(it) }) + p.functions.map { pageForMember(it) }) override fun pageForClass(c: Class): ClassPageNode = ClassPageNode(c.name, contentForClass(c), c.dri, c, diff --git a/core/src/main/kotlin/renderers/DefaultRenderer.kt b/core/src/main/kotlin/renderers/DefaultRenderer.kt index 72fc222a..ae065305 100644 --- a/core/src/main/kotlin/renderers/DefaultRenderer.kt +++ b/core/src/main/kotlin/renderers/DefaultRenderer.kt @@ -72,7 +72,7 @@ abstract class DefaultRenderer( getPackageNamesAndPlatforms(root) .keys .joinToString("\n") - .also { fileWriter.write("package-list", it, "") } + .also { fileWriter.write("${root.name}/package-list", it, "") } protected open fun getPackageNamesAndPlatforms(root: PageNode): Map<String, List<PlatformData>> = root.children diff --git a/core/src/main/kotlin/transformers/descriptors/DefaultDescriptorToDocumentationTranslator.kt b/core/src/main/kotlin/transformers/descriptors/DefaultDescriptorToDocumentationTranslator.kt index 389a265f..3b44fc0d 100644 --- a/core/src/main/kotlin/transformers/descriptors/DefaultDescriptorToDocumentationTranslator.kt +++ b/core/src/main/kotlin/transformers/descriptors/DefaultDescriptorToDocumentationTranslator.kt @@ -22,12 +22,13 @@ import org.jetbrains.dokka.parsers.MarkdownParser object DefaultDescriptorToDocumentationTranslator: DescriptorToDocumentationTranslator { override fun invoke( + moduleName: String, packageFragments: Iterable<PackageFragmentDescriptor>, platformData: PlatformData, context: DokkaContext ) = DokkaDescriptorVisitor(platformData, context.platforms[platformData]?.facade!!).run { packageFragments.map { visitPackageFragmentDescriptor(it, DRI.topLevel) } - }.let { Module(it) } + }.let { Module(moduleName, it) } } diff --git a/core/src/main/kotlin/transformers/descriptors/DescriptorToDocumentationTranslator.kt b/core/src/main/kotlin/transformers/descriptors/DescriptorToDocumentationTranslator.kt index bd9359ee..61d636d6 100644 --- a/core/src/main/kotlin/transformers/descriptors/DescriptorToDocumentationTranslator.kt +++ b/core/src/main/kotlin/transformers/descriptors/DescriptorToDocumentationTranslator.kt @@ -7,6 +7,7 @@ import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor interface DescriptorToDocumentationTranslator { fun invoke( + moduleName: String, packageFragments: Iterable<PackageFragmentDescriptor>, platformData: PlatformData, context: DokkaContext diff --git a/core/src/main/kotlin/transformers/documentation/DefaultDocumentationNodeMerger.kt b/core/src/main/kotlin/transformers/documentation/DefaultDocumentationNodeMerger.kt index ef0f48d6..fe689c01 100644 --- a/core/src/main/kotlin/transformers/documentation/DefaultDocumentationNodeMerger.kt +++ b/core/src/main/kotlin/transformers/documentation/DefaultDocumentationNodeMerger.kt @@ -7,6 +7,7 @@ import org.jetbrains.dokka.plugability.DokkaContext internal object DefaultDocumentationNodeMerger : DocumentationNodeMerger { override fun invoke(modules: Collection<Module>, context: DokkaContext): Module = Module( + modules.first().name, merge( modules.flatMap { it.packages }, Package::mergeWith |