xref: /aosp_15_r20/external/dokka/core/src/main/kotlin/Formats/FormatDescriptor.kt (revision 1b2d298c530bf0473cc943e8414a5ff577a994bc)
1 package org.jetbrains.dokka.Formats
2 
3 import com.google.inject.Binder
4 import org.jetbrains.dokka.*
5 import org.jetbrains.dokka.Utilities.bind
6 import org.jetbrains.dokka.Utilities.lazyBind
7 import org.jetbrains.dokka.Utilities.toOptional
8 import org.jetbrains.dokka.Utilities.toType
9 import kotlin.reflect.KClass
10 
11 
12 interface FormatDescriptorAnalysisComponent {
configureAnalysisnull13     fun configureAnalysis(binder: Binder)
14 }
15 
16 interface FormatDescriptorOutputComponent {
17     fun configureOutput(binder: Binder)
18 }
19 
20 interface FormatDescriptor : FormatDescriptorAnalysisComponent, FormatDescriptorOutputComponent
21 
22 
23 abstract class FileGeneratorBasedFormatDescriptor : FormatDescriptor {
24 
<lambda>null25     override fun configureOutput(binder: Binder): Unit = with(binder) {
26         bind<Generator>() toType NodeLocationAwareGenerator::class
27         bind<NodeLocationAwareGenerator>() toType generatorServiceClass
28 
29         bind<LanguageService>() toType languageServiceClass
30 
31         lazyBind<OutlineFormatService>() toOptional (outlineServiceClass)
32         lazyBind<FormatService>() toOptional formatServiceClass
33         lazyBind<PackageListService>() toOptional packageListServiceClass
34     }
35 
36     abstract val formatServiceClass: KClass<out FormatService>?
37     abstract val outlineServiceClass: KClass<out OutlineFormatService>?
38     abstract val generatorServiceClass: KClass<out FileGenerator>
39     abstract val packageListServiceClass: KClass<out PackageListService>?
40 
41     open val languageServiceClass: KClass<out LanguageService> = KotlinLanguageService::class
42 }