Fix overriding of default analysis services
diff --git a/core/src/main/kotlin/Formats/AnalysisComponents.kt b/core/src/main/kotlin/Formats/AnalysisComponents.kt
index 97e1311..c4d97db 100644
--- a/core/src/main/kotlin/Formats/AnalysisComponents.kt
+++ b/core/src/main/kotlin/Formats/AnalysisComponents.kt
@@ -12,14 +12,14 @@
import kotlin.reflect.KClass
-interface FormatDescriptorAnalysisComponentProvider : FormatDescriptorAnalysisComponent {
-
+interface DefaultAnalysisComponentServices {
val packageDocumentationBuilderClass: KClass<out PackageDocumentationBuilder>
val javaDocumentationBuilderClass: KClass<out JavaDocumentationBuilder>
val sampleProcessingService: KClass<out SampleProcessingService>
val descriptorSignatureProvider: KClass<out DescriptorSignatureProvider>
+}
-
+interface DefaultAnalysisComponent : FormatDescriptorAnalysisComponent, DefaultAnalysisComponentServices {
override fun configureAnalysis(binder: Binder): Unit = with(binder) {
bind<DescriptorSignatureProvider>() toType descriptorSignatureProvider
bind<PackageDocumentationBuilder>() toType packageDocumentationBuilderClass
@@ -29,7 +29,7 @@
}
-object KotlinAsJava: FormatDescriptorAnalysisComponentProvider {
+object KotlinAsJava : DefaultAnalysisComponentServices {
override val packageDocumentationBuilderClass = KotlinAsJavaDocumentationBuilder::class
override val javaDocumentationBuilderClass = JavaPsiDocumentationBuilder::class
override val sampleProcessingService = DefaultSampleProcessingService::class
@@ -37,7 +37,7 @@
}
-object KotlinAsKotlin: FormatDescriptorAnalysisComponentProvider {
+object KotlinAsKotlin : DefaultAnalysisComponentServices {
override val packageDocumentationBuilderClass = KotlinPackageDocumentationBuilder::class
override val javaDocumentationBuilderClass = KotlinJavaDocumentationBuilder::class
override val sampleProcessingService = DefaultSampleProcessingService::class
diff --git a/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt b/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt
index 9fb72e3..f73cd23 100644
--- a/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt
+++ b/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt
@@ -13,7 +13,7 @@
import java.io.File
-class JavaLayoutHtmlFormatDescriptor : FormatDescriptor, FormatDescriptorAnalysisComponentProvider {
+class JavaLayoutHtmlFormatDescriptor : FormatDescriptor, DefaultAnalysisComponent {
override val packageDocumentationBuilderClass = KotlinPackageDocumentationBuilder::class
override val javaDocumentationBuilderClass = KotlinJavaDocumentationBuilder::class
override val sampleProcessingService = DefaultSampleProcessingService::class
diff --git a/core/src/main/kotlin/Formats/StandardFormats.kt b/core/src/main/kotlin/Formats/StandardFormats.kt
index 9de667a..71af199 100644
--- a/core/src/main/kotlin/Formats/StandardFormats.kt
+++ b/core/src/main/kotlin/Formats/StandardFormats.kt
@@ -1,19 +1,21 @@
package org.jetbrains.dokka.Formats
import com.google.inject.Binder
-import com.google.inject.Provider
import org.jetbrains.dokka.*
import org.jetbrains.dokka.Samples.KotlinWebsiteSampleProcessingService
import org.jetbrains.dokka.Utilities.bind
import kotlin.reflect.KClass
-abstract class KotlinFormatDescriptorBase : FileGeneratorBasedFormatDescriptor(), FormatDescriptorAnalysisComponentProvider by KotlinAsKotlin {
+abstract class KotlinFormatDescriptorBase
+ : FileGeneratorBasedFormatDescriptor(),
+ DefaultAnalysisComponent,
+ DefaultAnalysisComponentServices by KotlinAsKotlin {
override val generatorServiceClass = FileGenerator::class
override val outlineServiceClass: KClass<out OutlineFormatService>? = null
override val packageListServiceClass: KClass<out PackageListService>? = DefaultPackageListService::class
}
-abstract class HtmlFormatDescriptorBase : FileGeneratorBasedFormatDescriptor() {
+abstract class HtmlFormatDescriptorBase : FileGeneratorBasedFormatDescriptor(), DefaultAnalysisComponent {
override val formatServiceClass = HtmlFormatService::class
override val outlineServiceClass = HtmlFormatService::class
override val generatorServiceClass = FileGenerator::class
@@ -21,13 +23,13 @@
override fun configureOutput(binder: Binder): Unit = with(binder) {
super.configureOutput(binder)
- bind<HtmlTemplateService>().toProvider(Provider { HtmlTemplateService.default("style.css") })
+ bind<HtmlTemplateService>().toProvider { HtmlTemplateService.default("style.css") }
}
}
-class HtmlFormatDescriptor : HtmlFormatDescriptorBase(), FormatDescriptorAnalysisComponent by KotlinAsKotlin
+class HtmlFormatDescriptor : HtmlFormatDescriptorBase(), DefaultAnalysisComponentServices by KotlinAsKotlin
-class HtmlAsJavaFormatDescriptor : HtmlFormatDescriptorBase(), FormatDescriptorAnalysisComponent by KotlinAsJava
+class HtmlAsJavaFormatDescriptor : HtmlFormatDescriptorBase(), DefaultAnalysisComponentServices by KotlinAsJava
class KotlinWebsiteFormatDescriptor : KotlinFormatDescriptorBase() {
override val formatServiceClass = KotlinWebsiteFormatService::class
@@ -45,6 +47,10 @@
override val sampleProcessingService = KotlinWebsiteSampleProcessingService::class
override val outlineServiceClass = YamlOutlineService::class
+ override fun configureAnalysis(binder: Binder) {
+ super.configureAnalysis(binder)
+ }
+
override fun configureOutput(binder: Binder) = with(binder) {
super.configureOutput(binder)
bind<HtmlTemplateService>().toInstance(EmptyHtmlTemplateService)
diff --git a/core/src/main/kotlin/javadoc/dokka-adapters.kt b/core/src/main/kotlin/javadoc/dokka-adapters.kt
index bed211f..4676db1 100644
--- a/core/src/main/kotlin/javadoc/dokka-adapters.kt
+++ b/core/src/main/kotlin/javadoc/dokka-adapters.kt
@@ -4,9 +4,7 @@
import com.google.inject.Inject
import com.sun.tools.doclets.formats.html.HtmlDoclet
import org.jetbrains.dokka.*
-import org.jetbrains.dokka.Formats.FormatDescriptor
-import org.jetbrains.dokka.Formats.FormatDescriptorAnalysisComponent
-import org.jetbrains.dokka.Formats.KotlinAsJava
+import org.jetbrains.dokka.Formats.*
import org.jetbrains.dokka.Utilities.bind
import org.jetbrains.dokka.Utilities.toType
@@ -31,7 +29,10 @@
}
}
-class JavadocFormatDescriptor : FormatDescriptor, FormatDescriptorAnalysisComponent by KotlinAsJava {
+class JavadocFormatDescriptor :
+ FormatDescriptor,
+ DefaultAnalysisComponent,
+ DefaultAnalysisComponentServices by KotlinAsJava {
override fun configureOutput(binder: Binder): Unit = with(binder) {
bind<Generator>() toType JavadocGenerator::class