aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-12-05 15:42:20 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-12-05 15:42:20 +0300
commit14ba5834fa3fff98672166dd24c05bd7aa13dc2a (patch)
tree3cb7aad210f1e2b0608c509839f588696f657636
parent3098b8e7665bcda25f8ead2496c161e10512d7b3 (diff)
downloaddokka-14ba5834fa3fff98672166dd24c05bd7aa13dc2a.tar.gz
dokka-14ba5834fa3fff98672166dd24c05bd7aa13dc2a.tar.bz2
dokka-14ba5834fa3fff98672166dd24c05bd7aa13dc2a.zip
Fix overriding of default analysis services
-rw-r--r--core/src/main/kotlin/Formats/AnalysisComponents.kt10
-rw-r--r--core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt2
-rw-r--r--core/src/main/kotlin/Formats/StandardFormats.kt18
-rw-r--r--core/src/main/kotlin/javadoc/dokka-adapters.kt9
4 files changed, 23 insertions, 16 deletions
diff --git a/core/src/main/kotlin/Formats/AnalysisComponents.kt b/core/src/main/kotlin/Formats/AnalysisComponents.kt
index 97e1311e..c4d97dbb 100644
--- a/core/src/main/kotlin/Formats/AnalysisComponents.kt
+++ b/core/src/main/kotlin/Formats/AnalysisComponents.kt
@@ -12,14 +12,14 @@ import org.jetbrains.dokka.Utilities.toType
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 @@ interface FormatDescriptorAnalysisComponentProvider : FormatDescriptorAnalysisCo
}
-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 KotlinAsJava: FormatDescriptorAnalysisComponentProvider {
}
-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 9fb72e37..f73cd23e 100644
--- a/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt
+++ b/core/src/main/kotlin/Formats/JavaLayoutHtmlFormat.kt
@@ -13,7 +13,7 @@ import org.jetbrains.dokka.Utilities.toType
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 9de667ab..71af1991 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 @@ abstract class HtmlFormatDescriptorBase : FileGeneratorBasedFormatDescriptor() {
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 @@ class KotlinWebsiteHtmlFormatDescriptor : KotlinFormatDescriptorBase() {
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 bed211f6..4676db18 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.Binder
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 JavadocGenerator @Inject constructor(val options: DocumentationOptions, va
}
}
-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