diff options
author | Marcin Aman <marcin.aman@gmail.com> | 2021-03-10 02:30:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-10 02:30:27 +0100 |
commit | 4899f65d789e47e2a9c9359d0e150a4e1f1a41f7 (patch) | |
tree | 9c7b27386f35a76a0ef05df3de04b7031d7fce62 /plugins/base/src | |
parent | 9bcc94196ec388a7f8351f4190506efcd746a6fd (diff) | |
download | dokka-4899f65d789e47e2a9c9359d0e150a4e1f1a41f7.tar.gz dokka-4899f65d789e47e2a9c9359d0e150a4e1f1a41f7.tar.bz2 dokka-4899f65d789e47e2a9c9359d0e150a4e1f1a41f7.zip |
Fix multimodule sourcesets dependencies (#1766)
Diffstat (limited to 'plugins/base/src')
3 files changed, 14 insertions, 9 deletions
diff --git a/plugins/base/src/main/kotlin/DokkaBase.kt b/plugins/base/src/main/kotlin/DokkaBase.kt index 5a7164d1..d84207a5 100644 --- a/plugins/base/src/main/kotlin/DokkaBase.kt +++ b/plugins/base/src/main/kotlin/DokkaBase.kt @@ -233,7 +233,7 @@ class DokkaBase : DokkaPlugin() { } val sourcesetDependencyAppender by extending { - htmlPreprocessors providing ::SourcesetDependencyAppender order { after(rootCreator) } applyIf { !delayTemplateSubstitution } + htmlPreprocessors providing ::SourcesetDependencyAppender order { after(rootCreator) } } val resolveLinkConsumer by extending { diff --git a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt index c5a92009..92f7324c 100644 --- a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt +++ b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt @@ -5,6 +5,8 @@ import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.DokkaBaseConfiguration import org.jetbrains.dokka.base.renderers.sourceSets import org.jetbrains.dokka.base.templating.AddToSearch +import org.jetbrains.dokka.base.templating.AddToSourcesetDependencies +import org.jetbrains.dokka.base.templating.toJsonString import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.* import org.jetbrains.dokka.pages.* @@ -169,15 +171,15 @@ class SourcesetDependencyAppender(val context: DokkaContext) : PageTransformer { it.sourceSetID to it.dependentSourceSets }.toMap() - fun createDependenciesJson(): String = "sourceset_dependencies = '{${ - dependenciesMap.entries.joinToString(", ") { - "\"${it.key}\": [${ - it.value.joinToString(",") { - "\"$it\"" + fun createDependenciesJson(): String = + dependenciesMap.map { (key, values) -> key.toString() to values.map { it.toString() } }.toMap() + .let { content -> + if (context.configuration.delayTemplateSubstitution) { + toJsonString(AddToSourcesetDependencies(context.configuration.moduleName, content)) + } else { + "sourceset_dependencies='${toJsonString(content)}'" } - }]" - } - }}'" + } val deps = RendererSpecificResourcePage( name = name, diff --git a/plugins/base/src/main/kotlin/templating/AddToSourcesetDependencies.kt b/plugins/base/src/main/kotlin/templating/AddToSourcesetDependencies.kt new file mode 100644 index 00000000..3f1680b7 --- /dev/null +++ b/plugins/base/src/main/kotlin/templating/AddToSourcesetDependencies.kt @@ -0,0 +1,3 @@ +package org.jetbrains.dokka.base.templating + +data class AddToSourcesetDependencies(val moduleName: String, val content: Map<String, List<String>>) : Command
\ No newline at end of file |