Inject optionals in JavaLayoutHtmlFormat correctly
diff --git a/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt b/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt
index 58a5b99..d074b56 100644
--- a/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt
+++ b/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt
@@ -12,6 +12,7 @@
import org.jetbrains.dokka.NodeKind.Companion.classLike
import org.jetbrains.dokka.NodeKind.Companion.memberLike
import org.jetbrains.dokka.Utilities.bind
+import org.jetbrains.dokka.Utilities.lazyBind
import org.jetbrains.dokka.Utilities.toOptional
import org.jetbrains.dokka.Utilities.toType
import org.jetbrains.kotlin.preprocessor.mkdirsOrFail
@@ -29,7 +30,7 @@
bind<LanguageService>() toType languageServiceClass
bind<JavaLayoutHtmlTemplateService>() toType templateServiceClass
bind<JavaLayoutHtmlUriProvider>() toType generatorServiceClass
- bind<JavaLayoutHtmlFormatOutlineFactoryService>() toOptional outlineFactoryClass
+ lazyBind<JavaLayoutHtmlFormatOutlineFactoryService>() toOptional outlineFactoryClass
}
val generatorServiceClass = JavaLayoutHtmlFormatGenerator::class
@@ -294,10 +295,11 @@
class JavaLayoutHtmlFormatGenerator @Inject constructor(
@Named("outputDir") val root: File,
val languageService: LanguageService,
- val templateService: JavaLayoutHtmlTemplateService,
- val outlineFactoryService: JavaLayoutHtmlFormatOutlineFactoryService
+ val templateService: JavaLayoutHtmlTemplateService
) : Generator, JavaLayoutHtmlUriProvider {
+ @set:Inject(optional = true) var outlineFactoryService: JavaLayoutHtmlFormatOutlineFactoryService? = null
+
fun createOutputBuilderForNode(node: DocumentationNode, output: Appendable)
= JavaLayoutHtmlFormatOutputBuilder(output, languageService, this, templateService, mainUri(node))
@@ -362,7 +364,7 @@
return writer
}
- outlineFactoryService.generateOutlines(::provideOutput, nodes)
+ outlineFactoryService?.generateOutlines(::provideOutput, nodes)
uriToWriter.values.forEach { it.close() }
}