aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/Utilities
diff options
context:
space:
mode:
authoraleksZubakov <aleks.zubakov@gmail.com>2018-08-02 18:59:20 +0300
committeraleksZubakov <aleks.zubakov@gmail.com>2018-08-06 12:01:31 +0300
commitba09711a1ecbdaede86cab9e76d13ff1047f89b2 (patch)
tree643168461eee8d574e6cdb28a57a7a4f9e526839 /core/src/main/kotlin/Utilities
parent052a218dcf8bc565d5e78dc900a9647f0da5350a (diff)
downloaddokka-ba09711a1ecbdaede86cab9e76d13ff1047f89b2.tar.gz
dokka-ba09711a1ecbdaede86cab9e76d13ff1047f89b2.tar.bz2
dokka-ba09711a1ecbdaede86cab9e76d13ff1047f89b2.zip
ExternalDocumentationLinkResolver refactoring, extract common dependencies from guice modules
Diffstat (limited to 'core/src/main/kotlin/Utilities')
-rw-r--r--core/src/main/kotlin/Utilities/DokkaModules.kt19
1 files changed, 11 insertions, 8 deletions
diff --git a/core/src/main/kotlin/Utilities/DokkaModules.kt b/core/src/main/kotlin/Utilities/DokkaModules.kt
index 251d5c23..c2e652b6 100644
--- a/core/src/main/kotlin/Utilities/DokkaModules.kt
+++ b/core/src/main/kotlin/Utilities/DokkaModules.kt
@@ -1,8 +1,6 @@
package org.jetbrains.dokka.Utilities
-import com.google.inject.Binder
-import com.google.inject.Module
-import com.google.inject.TypeLiteral
+import com.google.inject.*
import com.google.inject.binder.AnnotatedBindingBuilder
import com.google.inject.name.Names
import org.jetbrains.dokka.*
@@ -13,6 +11,16 @@ import kotlin.reflect.KClass
const val impliedPlatformsName = "impliedPlatforms"
+class DokkaRunModule(val configuration: DokkaConfiguration) : Module {
+ override fun configure(binder: Binder) {
+ binder.bind<DokkaConfiguration>().toInstance(configuration)
+ binder.bind(StringListType).annotatedWith(Names.named(impliedPlatformsName)).toInstance(configuration.impliedPlatforms)
+
+ binder.bind(File::class.java).annotatedWith(Names.named("outputDir")).toInstance(File(configuration.outputDir))
+ }
+
+}
+
class DokkaAnalysisModule(val environment: AnalysisEnvironment,
val configuration: DokkaConfiguration,
val defaultPlatformsProvider: DefaultPlatformsProvider,
@@ -29,7 +37,6 @@ class DokkaAnalysisModule(val environment: AnalysisEnvironment,
binder.bind<DokkaResolutionFacade>().toInstance(dokkaResolutionFacade)
binder.bind<DokkaResolutionFacade>().annotatedWith(Names.named("libraryResolutionFacade")).toInstance(libraryResolutionFacade)
- binder.bind<DokkaConfiguration>().toInstance(configuration)
binder.bind<DokkaConfiguration.PassConfiguration>().toInstance(passConfiguration)
binder.bind<DefaultPlatformsProvider>().toInstance(defaultPlatformsProvider)
@@ -46,11 +53,7 @@ object StringListType : TypeLiteral<@JvmSuppressWildcards List<String>>()
class DokkaOutputModule(val configuration: DokkaConfiguration,
val logger: DokkaLogger) : Module {
override fun configure(binder: Binder) {
- binder.bind(File::class.java).annotatedWith(Names.named("outputDir")).toInstance(File(configuration.outputDir))
-
- binder.bind<DokkaConfiguration>().toInstance(configuration)
binder.bind<DokkaLogger>().toInstance(logger)
- binder.bind(StringListType).annotatedWith(Names.named(impliedPlatformsName)).toInstance(configuration.impliedPlatforms)
val descriptor = ServiceLocator.lookup<FormatDescriptor>("format", configuration.format)