diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-06-19 14:08:49 +0200 |
---|---|---|
committer | Paweł Marks <pmarks@virtuslab.com> | 2020-06-25 20:23:58 +0200 |
commit | 8cb6efc97f8fa321381c95cc5f85a3ce7bc13c3f (patch) | |
tree | fe4e24d9f352199e551bd34ba330c0d2c0acf7af /core/src | |
parent | 08f40e2a13006882e8f8425f111b8527e7bbcb0f (diff) | |
download | dokka-8cb6efc97f8fa321381c95cc5f85a3ce7bc13c3f.tar.gz dokka-8cb6efc97f8fa321381c95cc5f85a3ce7bc13c3f.tar.bz2 dokka-8cb6efc97f8fa321381c95cc5f85a3ce7bc13c3f.zip |
Remove SourceSetDataCache, rename PassConfiguration to DokkaSourceSet and use it instead of SourceSetData
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/kotlin/DokkaBootstrapImpl.kt | 6 | ||||
-rw-r--r-- | core/src/main/kotlin/DokkaGenerator.kt | 25 | ||||
-rw-r--r-- | core/src/main/kotlin/configuration.kt | 4 | ||||
-rw-r--r-- | core/src/main/kotlin/defaultConfiguration.kt | 6 | ||||
-rw-r--r-- | core/src/main/kotlin/model/Documentable.kt | 59 | ||||
-rw-r--r-- | core/src/main/kotlin/model/SourceSetData.kt | 38 | ||||
-rw-r--r-- | core/src/main/kotlin/model/documentableProperties.kt | 12 | ||||
-rw-r--r-- | core/src/main/kotlin/model/documentableUtils.kt | 12 | ||||
-rw-r--r-- | core/src/main/kotlin/pages/ContentNodes.kt | 35 | ||||
-rw-r--r-- | core/src/main/kotlin/plugability/DokkaContext.kt | 8 | ||||
-rw-r--r-- | core/src/main/kotlin/transformers/sources/SourceToDocumentableTranslator.kt | 4 |
11 files changed, 82 insertions, 127 deletions
diff --git a/core/src/main/kotlin/DokkaBootstrapImpl.kt b/core/src/main/kotlin/DokkaBootstrapImpl.kt index 94792303..bd632546 100644 --- a/core/src/main/kotlin/DokkaBootstrapImpl.kt +++ b/core/src/main/kotlin/DokkaBootstrapImpl.kt @@ -84,7 +84,7 @@ class DokkaBootstrapImpl : DokkaBootstrap { fun configure(logger: DokkaLogger, configuration: DokkaConfigurationImpl) = with(configuration) { - fun defaultLinks(config: PassConfigurationImpl): List<ExternalDocumentationLinkImpl> { + fun defaultLinks(config: DokkaSourceSetImpl): List<ExternalDocumentationLinkImpl> { val links = mutableListOf<ExternalDocumentationLinkImpl>() if (!config.noJdkLink) links += DokkaConfiguration.ExternalDocumentationLink @@ -100,8 +100,8 @@ class DokkaBootstrapImpl : DokkaBootstrap { val configurationWithLinks = configuration.copy( - passesConfigurations = - passesConfigurations.map { + sourceSets = + sourceSets.map { val links: List<ExternalDocumentationLinkImpl> = it.externalDocumentationLinks + defaultLinks(it) it.copy(externalDocumentationLinks = links) diff --git a/core/src/main/kotlin/DokkaGenerator.kt b/core/src/main/kotlin/DokkaGenerator.kt index b88c6223..ce8d229a 100644 --- a/core/src/main/kotlin/DokkaGenerator.kt +++ b/core/src/main/kotlin/DokkaGenerator.kt @@ -1,8 +1,7 @@ package org.jetbrains.dokka import org.jetbrains.dokka.model.DModule -import org.jetbrains.dokka.model.SourceSetCache -import org.jetbrains.dokka.model.SourceSetData +import org.jetbrains.dokka.DokkaConfiguration.* import org.jetbrains.dokka.pages.RootPageNode import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.DokkaPlugin @@ -18,13 +17,11 @@ class DokkaGenerator( private val logger: DokkaLogger ) { fun generate() = timed { - val sourceSetsCache = SourceSetCache() - report("Initializing plugins") - val context = initializePlugins(configuration, logger, sourceSetsCache) + val context = initializePlugins(configuration, logger) report("Creating documentation models") - val modulesFromPlatforms = createDocumentationModels(context, sourceSetsCache) + val modulesFromPlatforms = createDocumentationModels(context) report("Transforming documentation model before merging") val transformedDocumentationBeforeMerge = transformDocumentationModelBeforeMerge(modulesFromPlatforms, context) @@ -48,9 +45,8 @@ class DokkaGenerator( }.dump("\n\n === TIME MEASUREMENT ===\n") fun generateAllModulesPage() = timed { - val sourceSetsCache = SourceSetCache() report("Initializing plugins") - val context = initializePlugins(configuration, logger, sourceSetsCache) + val context = initializePlugins(configuration, logger) report("Creating all modules page") val pages = createAllModulePage(context) @@ -66,15 +62,12 @@ class DokkaGenerator( fun initializePlugins( configuration: DokkaConfiguration, logger: DokkaLogger, - sourceSetsCache: SourceSetCache, pluginOverrides: List<DokkaPlugin> = emptyList() - ) = DokkaContext.create(configuration, logger, sourceSetsCache, pluginOverrides) + ) = DokkaContext.create(configuration, logger, pluginOverrides) fun createDocumentationModels( - context: DokkaContext, - sourceSetsCache: SourceSetCache - ) = context.configuration.passesConfigurations - .map { passConfiguration -> sourceSetsCache.getSourceSet(passConfiguration) } + context: DokkaContext + ) = context.configuration.sourceSets .flatMap { passConfiguration -> translateSources(passConfiguration, context) } fun transformDocumentationModelBeforeMerge( @@ -133,9 +126,9 @@ class DokkaGenerator( } } - private fun translateSources(platformData: SourceSetData, context: DokkaContext) = + private fun translateSources(sourceSet: DokkaSourceSet, context: DokkaContext) = context[CoreExtensions.sourceToDocumentableTranslator].map { - it.invoke(platformData, context) + it.invoke(sourceSet, context) } } diff --git a/core/src/main/kotlin/configuration.kt b/core/src/main/kotlin/configuration.kt index b016f83d..463d2342 100644 --- a/core/src/main/kotlin/configuration.kt +++ b/core/src/main/kotlin/configuration.kt @@ -49,12 +49,12 @@ interface DokkaConfiguration { val cacheRoot: String? val offlineMode: Boolean val failOnWarning: Boolean - val passesConfigurations: List<PassConfiguration> + val sourceSets: List<DokkaSourceSet> val modules: List<DokkaModuleDescription> val pluginsClasspath: List<File> val pluginsConfiguration: Map<String, String> - interface PassConfiguration { + interface DokkaSourceSet { val moduleName: String val displayName: String val sourceSetID: String diff --git a/core/src/main/kotlin/defaultConfiguration.kt b/core/src/main/kotlin/defaultConfiguration.kt index 4e83d3c3..d3ac9df2 100644 --- a/core/src/main/kotlin/defaultConfiguration.kt +++ b/core/src/main/kotlin/defaultConfiguration.kt @@ -8,14 +8,14 @@ data class DokkaConfigurationImpl( override val format: String, override val cacheRoot: String?, override val offlineMode: Boolean, - override val passesConfigurations: List<PassConfigurationImpl>, + override val sourceSets: List<DokkaSourceSetImpl>, override val pluginsClasspath: List<File>, override val pluginsConfiguration: Map<String, String>, override val modules: List<DokkaModuleDescriptionImpl>, override val failOnWarning: Boolean ) : DokkaConfiguration -data class PassConfigurationImpl( +data class DokkaSourceSetImpl( override val moduleName: String, override val displayName: String, override val sourceSetID: String, @@ -39,7 +39,7 @@ data class PassConfigurationImpl( override val noJdkLink: Boolean, override val suppressedFiles: List<String>, override val analysisPlatform: Platform -) : DokkaConfiguration.PassConfiguration +) : DokkaConfiguration.DokkaSourceSet data class DokkaModuleDescriptionImpl( override val name: String, diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt index 768bddc5..35278302 100644 --- a/core/src/main/kotlin/model/Documentable.kt +++ b/core/src/main/kotlin/model/Documentable.kt @@ -1,5 +1,6 @@ package org.jetbrains.dokka.model +import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.doc.DocumentationNode import org.jetbrains.dokka.model.properties.PropertyContainer @@ -11,8 +12,8 @@ abstract class Documentable { abstract val dri: DRI abstract val children: List<Documentable> abstract val documentation: SourceSetDependent<DocumentationNode> - abstract val sourceSets: Set<SourceSetData> - abstract val expectPresentInSet: SourceSetData? + abstract val sourceSets: Set<DokkaSourceSet> + abstract val expectPresentInSet: DokkaSourceSet? override fun toString(): String = "${javaClass.simpleName}($dri)" @@ -23,7 +24,7 @@ abstract class Documentable { override fun hashCode() = dri.hashCode() } -typealias SourceSetDependent<T> = Map<SourceSetData, T> +typealias SourceSetDependent<T> = Map<DokkaSourceSet, T> interface WithExpectActual { val sources: SourceSetDependent<DocumentableSource> @@ -88,8 +89,8 @@ data class DModule( override val name: String, val packages: List<DPackage>, override val documentation: SourceSetDependent<DocumentationNode>, - override val expectPresentInSet: SourceSetData? = null, - override val sourceSets: Set<SourceSetData>, + override val expectPresentInSet: DokkaSourceSet? = null, + override val sourceSets: Set<DokkaSourceSet>, override val extra: PropertyContainer<DModule> = PropertyContainer.empty() ) : Documentable(), WithExtraProperties<DModule> { override val dri: DRI = DRI.topLevel @@ -106,8 +107,8 @@ data class DPackage( override val classlikes: List<DClasslike>, val typealiases: List<DTypeAlias>, override val documentation: SourceSetDependent<DocumentationNode>, - override val expectPresentInSet: SourceSetData? = null, - override val sourceSets: Set<SourceSetData>, + override val expectPresentInSet: DokkaSourceSet? = null, + override val sourceSets: Set<DokkaSourceSet>, override val extra: PropertyContainer<DPackage> = PropertyContainer.empty() ) : Documentable(), WithScope, WithExtraProperties<DPackage> { override val name = dri.packageName.orEmpty() @@ -130,9 +131,9 @@ data class DClass( override val generics: List<DTypeParameter>, override val supertypes: SourceSetDependent<List<DRI>>, override val documentation: SourceSetDependent<DocumentationNode>, - override val expectPresentInSet: SourceSetData?, + override val expectPresentInSet: DokkaSourceSet?, override val modifier: SourceSetDependent<Modifier>, - override val sourceSets: Set<SourceSetData>, + override val sourceSets: Set<DokkaSourceSet>, override val extra: PropertyContainer<DClass> = PropertyContainer.empty() ) : DClasslike(), WithAbstraction, WithCompanion, WithConstructors, WithGenerics, WithSupertypes, WithExtraProperties<DClass> { @@ -148,7 +149,7 @@ data class DEnum( override val name: String, val entries: List<DEnumEntry>, override val documentation: SourceSetDependent<DocumentationNode>, - override val expectPresentInSet: SourceSetData?, + override val expectPresentInSet: DokkaSourceSet?, override val sources: SourceSetDependent<DocumentableSource>, override val functions: List<DFunction>, override val properties: List<DProperty>, @@ -157,7 +158,7 @@ data class DEnum( override val companion: DObject?, override val constructors: List<DFunction>, override val supertypes: SourceSetDependent<List<DRI>>, - override val sourceSets: Set<SourceSetData>, + override val sourceSets: Set<DokkaSourceSet>, override val extra: PropertyContainer<DEnum> = PropertyContainer.empty() ) : DClasslike(), WithCompanion, WithConstructors, WithSupertypes, WithExtraProperties<DEnum> { override val children: List<Documentable> @@ -170,11 +171,11 @@ data class DEnumEntry( override val dri: DRI, override val name: String, override val documentation: SourceSetDependent<DocumentationNode>, - override val expectPresentInSet: SourceSetData?, + override val expectPresentInSet: DokkaSourceSet?, override val functions: List<DFunction>, override val properties: List<DProperty>, override val classlikes: List<DClasslike>, - override val sourceSets: Set<SourceSetData>, + override val sourceSets: Set<DokkaSourceSet>, override val extra: PropertyContainer<DEnumEntry> = PropertyContainer.empty() ) : Documentable(), WithScope, WithExtraProperties<DEnumEntry> { override val children: List<Documentable> @@ -189,14 +190,14 @@ data class DFunction( val isConstructor: Boolean, val parameters: List<DParameter>, override val documentation: SourceSetDependent<DocumentationNode>, - override val expectPresentInSet: SourceSetData?, + override val expectPresentInSet: DokkaSourceSet?, override val sources: SourceSetDependent<DocumentableSource>, override val visibility: SourceSetDependent<Visibility>, override val type: Bound, override val generics: List<DTypeParameter>, override val receiver: DParameter?, override val modifier: SourceSetDependent<Modifier>, - override val sourceSets: Set<SourceSetData>, + override val sourceSets: Set<DokkaSourceSet>, override val extra: PropertyContainer<DFunction> = PropertyContainer.empty() ) : Documentable(), Callable, WithGenerics, WithExtraProperties<DFunction> { override val children: List<Documentable> @@ -209,7 +210,7 @@ data class DInterface( override val dri: DRI, override val name: String, override val documentation: SourceSetDependent<DocumentationNode>, - override val expectPresentInSet: SourceSetData?, + override val expectPresentInSet: DokkaSourceSet?, override val sources: SourceSetDependent<DocumentableSource>, override val functions: List<DFunction>, override val properties: List<DProperty>, @@ -218,7 +219,7 @@ data class DInterface( override val companion: DObject?, override val generics: List<DTypeParameter>, override val supertypes: SourceSetDependent<List<DRI>>, - override val sourceSets: Set<SourceSetData>, + override val sourceSets: Set<DokkaSourceSet>, override val extra: PropertyContainer<DInterface> = PropertyContainer.empty() ) : DClasslike(), WithCompanion, WithGenerics, WithSupertypes, WithExtraProperties<DInterface> { override val children: List<Documentable> @@ -231,14 +232,14 @@ data class DObject( override val name: String?, override val dri: DRI, override val documentation: SourceSetDependent<DocumentationNode>, - override val expectPresentInSet: SourceSetData?, + override val expectPresentInSet: DokkaSourceSet?, override val sources: SourceSetDependent<DocumentableSource>, override val functions: List<DFunction>, override val properties: List<DProperty>, override val classlikes: List<DClasslike>, override val visibility: SourceSetDependent<Visibility>, override val supertypes: SourceSetDependent<List<DRI>>, - override val sourceSets: Set<SourceSetData>, + override val sourceSets: Set<DokkaSourceSet>, override val extra: PropertyContainer<DObject> = PropertyContainer.empty() ) : DClasslike(), WithSupertypes, WithExtraProperties<DObject> { override val children: List<Documentable> @@ -251,7 +252,7 @@ data class DAnnotation( override val name: String, override val dri: DRI, override val documentation: SourceSetDependent<DocumentationNode>, - override val expectPresentInSet: SourceSetData?, + override val expectPresentInSet: DokkaSourceSet?, override val sources: SourceSetDependent<DocumentableSource>, override val functions: List<DFunction>, override val properties: List<DProperty>, @@ -260,7 +261,7 @@ data class DAnnotation( override val companion: DObject?, override val constructors: List<DFunction>, override val generics: List<DTypeParameter>, - override val sourceSets: Set<SourceSetData>, + override val sourceSets: Set<DokkaSourceSet>, override val extra: PropertyContainer<DAnnotation> = PropertyContainer.empty() ) : DClasslike(), WithCompanion, WithConstructors, WithExtraProperties<DAnnotation>, WithGenerics { override val children: List<Documentable> @@ -273,7 +274,7 @@ data class DProperty( override val dri: DRI, override val name: String, override val documentation: SourceSetDependent<DocumentationNode>, - override val expectPresentInSet: SourceSetData?, + override val expectPresentInSet: DokkaSourceSet?, override val sources: SourceSetDependent<DocumentableSource>, override val visibility: SourceSetDependent<Visibility>, override val type: Bound, @@ -281,7 +282,7 @@ data class DProperty( val setter: DFunction?, val getter: DFunction?, override val modifier: SourceSetDependent<Modifier>, - override val sourceSets: Set<SourceSetData>, + override val sourceSets: Set<DokkaSourceSet>, override val generics: List<DTypeParameter>, override val extra: PropertyContainer<DProperty> = PropertyContainer.empty() ) : Documentable(), Callable, WithExtraProperties<DProperty>, WithGenerics { @@ -296,9 +297,9 @@ data class DParameter( override val dri: DRI, override val name: String?, override val documentation: SourceSetDependent<DocumentationNode>, - override val expectPresentInSet: SourceSetData?, + override val expectPresentInSet: DokkaSourceSet?, val type: Bound, - override val sourceSets: Set<SourceSetData>, + override val sourceSets: Set<DokkaSourceSet>, override val extra: PropertyContainer<DParameter> = PropertyContainer.empty() ) : Documentable(), WithExtraProperties<DParameter> { override val children: List<Nothing> @@ -311,9 +312,9 @@ data class DTypeParameter( override val dri: DRI, override val name: String, override val documentation: SourceSetDependent<DocumentationNode>, - override val expectPresentInSet: SourceSetData?, + override val expectPresentInSet: DokkaSourceSet?, val bounds: List<Bound>, - override val sourceSets: Set<SourceSetData>, + override val sourceSets: Set<DokkaSourceSet>, override val extra: PropertyContainer<DTypeParameter> = PropertyContainer.empty() ) : Documentable(), WithExtraProperties<DTypeParameter> { override val children: List<Nothing> @@ -329,8 +330,8 @@ data class DTypeAlias( val underlyingType: SourceSetDependent<Bound>, override val visibility: SourceSetDependent<Visibility>, override val documentation: SourceSetDependent<DocumentationNode>, - override val expectPresentInSet: SourceSetData?, - override val sourceSets: Set<SourceSetData>, + override val expectPresentInSet: DokkaSourceSet?, + override val sourceSets: Set<DokkaSourceSet>, override val extra: PropertyContainer<DTypeAlias> = PropertyContainer.empty() ) : Documentable(), WithType, WithVisibility, WithExtraProperties<DTypeAlias> { override val children: List<Nothing> diff --git a/core/src/main/kotlin/model/SourceSetData.kt b/core/src/main/kotlin/model/SourceSetData.kt deleted file mode 100644 index 3e38cc7b..00000000 --- a/core/src/main/kotlin/model/SourceSetData.kt +++ /dev/null @@ -1,38 +0,0 @@ -package org.jetbrains.dokka.model - -import org.jetbrains.dokka.DokkaConfiguration -import org.jetbrains.dokka.Platform -import org.jetbrains.dokka.plugability.DokkaContext - -data class SourceSetData( - val moduleName: String, - val sourceSetID: String, - val displayName: String, - val platform: Platform, - val sourceRoots: List<DokkaConfiguration.SourceRoot> = emptyList(), - val dependentSourceSets: List<String> = emptyList() -) - -class SourceSetCache { - private val sourceSets = HashMap<String, SourceSetData>() - - val allSourceSets: List<SourceSetData> - get() = sourceSets.values.toList() - - fun getSourceSet(pass: DokkaConfiguration.PassConfiguration) = - sourceSets.getOrPut(pass.sourceSetID, - { - SourceSetData( - pass.moduleName, - pass.sourceSetID, - pass.displayName, - pass.analysisPlatform, - pass.sourceRoots, - pass.dependentSourceSets - ) - } - ) -} - -fun DokkaContext.sourceSet(pass: DokkaConfiguration.PassConfiguration): SourceSetData = - sourceSetCache.getSourceSet(pass)
\ No newline at end of file diff --git a/core/src/main/kotlin/model/documentableProperties.kt b/core/src/main/kotlin/model/documentableProperties.kt index 2aec199c..cd6a9335 100644 --- a/core/src/main/kotlin/model/documentableProperties.kt +++ b/core/src/main/kotlin/model/documentableProperties.kt @@ -1,26 +1,26 @@ package org.jetbrains.dokka.model +import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.properties.ExtraProperty import org.jetbrains.dokka.model.properties.MergeStrategy -data class InheritedFunction(val inheritedFrom: SourceSetDependent<DRI?>): ExtraProperty<DFunction> { +data class InheritedFunction(val inheritedFrom: SourceSetDependent<DRI?>) : ExtraProperty<DFunction> { companion object : ExtraProperty.Key<DFunction, InheritedFunction> { override fun mergeStrategyFor(left: InheritedFunction, right: InheritedFunction) = MergeStrategy.Replace( InheritedFunction(left.inheritedFrom + right.inheritedFrom) ) } - fun isInherited(sourceSetDependent: SourceSetData): Boolean = inheritedFrom[sourceSetDependent] != null + fun isInherited(sourceSetDependent: DokkaSourceSet): Boolean = inheritedFrom[sourceSetDependent] != null override val key: ExtraProperty.Key<DFunction, *> = InheritedFunction } -data class ImplementedInterfaces(val interfaces: SourceSetDependent<List<DRI>>): ExtraProperty<Documentable> { +data class ImplementedInterfaces(val interfaces: SourceSetDependent<List<DRI>>) : ExtraProperty<Documentable> { companion object : ExtraProperty.Key<Documentable, ImplementedInterfaces> { - override fun mergeStrategyFor(left: ImplementedInterfaces, right: ImplementedInterfaces) = MergeStrategy.Replace( - ImplementedInterfaces(left.interfaces + right.interfaces) - ) + override fun mergeStrategyFor(left: ImplementedInterfaces, right: ImplementedInterfaces) = + MergeStrategy.Replace(ImplementedInterfaces(left.interfaces + right.interfaces)) } override val key: ExtraProperty.Key<Documentable, *> = ImplementedInterfaces diff --git a/core/src/main/kotlin/model/documentableUtils.kt b/core/src/main/kotlin/model/documentableUtils.kt index 2d4ade15..7057a62c 100644 --- a/core/src/main/kotlin/model/documentableUtils.kt +++ b/core/src/main/kotlin/model/documentableUtils.kt @@ -1,12 +1,14 @@ package org.jetbrains.dokka.model -fun <T> SourceSetDependent<T>.filtered(platformDataList: Set<SourceSetData>) = filter { it.key in platformDataList } -fun SourceSetData?.filtered(platformDataList: Set<SourceSetData>) = takeIf { this in platformDataList } +import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet -fun DTypeParameter.filter(filteredData: Set<SourceSetData>) = - if (filteredData.containsAll(sourceSets)) this +fun <T> SourceSetDependent<T>.filtered(sourceSets: Set<DokkaSourceSet>) = filter { it.key in sourceSets } +fun DokkaSourceSet?.filtered(sourceSets: Set<DokkaSourceSet>) = takeIf { this in sourceSets } + +fun DTypeParameter.filter(filteredSet: Set<DokkaSourceSet>) = + if (filteredSet.containsAll(sourceSets)) this else { - val intersection = filteredData.intersect(sourceSets) + val intersection = filteredSet.intersect(sourceSets) if (intersection.isEmpty()) null else DTypeParameter( dri, diff --git a/core/src/main/kotlin/pages/ContentNodes.kt b/core/src/main/kotlin/pages/ContentNodes.kt index 1b9c937d..dc23a082 100644 --- a/core/src/main/kotlin/pages/ContentNodes.kt +++ b/core/src/main/kotlin/pages/ContentNodes.kt @@ -1,7 +1,7 @@ package org.jetbrains.dokka.pages +import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import org.jetbrains.dokka.links.DRI -import org.jetbrains.dokka.model.SourceSetData import org.jetbrains.dokka.model.properties.PropertyContainer import org.jetbrains.dokka.model.properties.WithExtraProperties @@ -11,7 +11,7 @@ data class DCI(val dri: Set<DRI>, val kind: Kind) { interface ContentNode : WithExtraProperties<ContentNode> { val dci: DCI - val sourceSets: Set<SourceSetData> + val sourceSets: Set<DokkaSourceSet> val style: Set<Style> fun hasAnyContent(): Boolean @@ -21,7 +21,7 @@ interface ContentNode : WithExtraProperties<ContentNode> { data class ContentText( val text: String, override val dci: DCI, - override val sourceSets: Set<SourceSetData>, + override val sourceSets: Set<DokkaSourceSet>, override val style: Set<Style> = emptySet(), override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentNode { @@ -32,7 +32,7 @@ data class ContentText( // TODO: Remove data class ContentBreakLine( - override val sourceSets: Set<SourceSetData>, + override val sourceSets: Set<DokkaSourceSet>, override val dci: DCI = DCI(emptySet(), ContentKind.Empty), override val style: Set<Style> = emptySet(), override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() @@ -47,11 +47,12 @@ data class ContentHeader( override val children: List<ContentNode>, val level: Int, override val dci: DCI, - override val sourceSets: Set<SourceSetData>, + override val sourceSets: Set<DokkaSourceSet>, override val style: Set<Style>, override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentComposite { constructor(level: Int, c: ContentComposite) : this(c.children, level, c.dci, c.sourceSets, c.style, c.extra) + override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentHeader = copy(extra = newExtras) } @@ -60,7 +61,7 @@ data class ContentCode( override val children: List<ContentNode>, val language: String, override val dci: DCI, - override val sourceSets: Set<SourceSetData>, + override val sourceSets: Set<DokkaSourceSet>, override val style: Set<Style>, override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentComposite { @@ -75,7 +76,7 @@ data class ContentDRILink( override val children: List<ContentNode>, val address: DRI, override val dci: DCI, - override val sourceSets: Set<SourceSetData>, + override val sourceSets: Set<DokkaSourceSet>, override val style: Set<Style> = emptySet(), override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentLink { @@ -87,7 +88,7 @@ data class ContentResolvedLink( override val children: List<ContentNode>, val address: String, override val dci: DCI, - override val sourceSets: Set<SourceSetData>, + override val sourceSets: Set<DokkaSourceSet>, override val style: Set<Style> = emptySet(), override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentLink { @@ -101,7 +102,7 @@ data class ContentEmbeddedResource( val address: String, val altText: String?, override val dci: DCI, - override val sourceSets: Set<SourceSetData>, + override val sourceSets: Set<DokkaSourceSet>, override val style: Set<Style> = emptySet(), override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentLink { @@ -121,7 +122,7 @@ data class ContentTable( val header: List<ContentGroup>, override val children: List<ContentGroup>, override val dci: DCI, - override val sourceSets: Set<SourceSetData>, + override val sourceSets: Set<DokkaSourceSet>, override val style: Set<Style>, override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentComposite { @@ -133,7 +134,7 @@ data class ContentList( override val children: List<ContentNode>, val ordered: Boolean, override val dci: DCI, - override val sourceSets: Set<SourceSetData>, + override val sourceSets: Set<DokkaSourceSet>, override val style: Set<Style>, override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentComposite { @@ -144,7 +145,7 @@ data class ContentList( data class ContentGroup( override val children: List<ContentNode>, override val dci: DCI, - override val sourceSets: Set<SourceSetData>, + override val sourceSets: Set<DokkaSourceSet>, override val style: Set<Style>, override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentComposite { @@ -164,7 +165,7 @@ data class ContentDivergentGroup( ) : ContentComposite { data class GroupID(val name: String) - override val sourceSets: Set<SourceSetData> + override val sourceSets: Set<DokkaSourceSet> get() = children.flatMap { it.sourceSets }.distinct().toSet() override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentDivergentGroup = @@ -177,7 +178,7 @@ data class ContentDivergentInstance( val divergent: ContentNode, val after: ContentNode?, override val dci: DCI, - override val sourceSets: Set<SourceSetData>, + override val sourceSets: Set<DokkaSourceSet>, override val style: Set<Style>, override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentComposite { @@ -190,7 +191,7 @@ data class ContentDivergentInstance( data class PlatformHintedContent( val inner: ContentNode, - override val sourceSets: Set<SourceSetData> + override val sourceSets: Set<DokkaSourceSet> ) : ContentComposite { override val children = listOf(inner) @@ -231,9 +232,9 @@ enum class ContentStyle : Style { RowTitle, TabbedContent, WithExtraAttributes } -object CommentTable: Style +object CommentTable : Style -object MultimoduleTable: Style +object MultimoduleTable : Style fun ContentNode.dfs(predicate: (ContentNode) -> Boolean): ContentNode? = if (predicate(this)) { this diff --git a/core/src/main/kotlin/plugability/DokkaContext.kt b/core/src/main/kotlin/plugability/DokkaContext.kt index a2ff26c7..15349ff0 100644 --- a/core/src/main/kotlin/plugability/DokkaContext.kt +++ b/core/src/main/kotlin/plugability/DokkaContext.kt @@ -1,7 +1,6 @@ package org.jetbrains.dokka.plugability import org.jetbrains.dokka.DokkaConfiguration -import org.jetbrains.dokka.model.SourceSetCache import org.jetbrains.dokka.utilities.DokkaLogger import java.io.File import java.net.URLClassLoader @@ -18,7 +17,6 @@ interface DokkaContext { fun <T, E> single(point: E): T where T : Any, E : ExtensionPoint<T> - val sourceSetCache: SourceSetCache val logger: DokkaLogger val configuration: DokkaConfiguration val unusedPoints: Collection<ExtensionPoint<*>> @@ -28,10 +26,9 @@ interface DokkaContext { fun create( configuration: DokkaConfiguration, logger: DokkaLogger, - sourceSetsCache: SourceSetCache, pluginOverrides: List<DokkaPlugin> ): DokkaContext = - DokkaContextConfigurationImpl(logger, configuration, sourceSetsCache).apply { + DokkaContextConfigurationImpl(logger, configuration).apply { // File(it.path) is a workaround for an incorrect filesystem in a File instance returned by Gradle. configuration.pluginsClasspath.map { File(it.path).toURI().toURL() } .toTypedArray() @@ -54,8 +51,7 @@ interface DokkaContextConfiguration { private class DokkaContextConfigurationImpl( override val logger: DokkaLogger, - override val configuration: DokkaConfiguration, - override val sourceSetCache: SourceSetCache + override val configuration: DokkaConfiguration ) : DokkaContext, DokkaContextConfiguration { private val plugins = mutableMapOf<KClass<*>, DokkaPlugin>() private val pluginStubs = mutableMapOf<KClass<*>, DokkaPlugin>() diff --git a/core/src/main/kotlin/transformers/sources/SourceToDocumentableTranslator.kt b/core/src/main/kotlin/transformers/sources/SourceToDocumentableTranslator.kt index f9c0a3d0..6bc8fb14 100644 --- a/core/src/main/kotlin/transformers/sources/SourceToDocumentableTranslator.kt +++ b/core/src/main/kotlin/transformers/sources/SourceToDocumentableTranslator.kt @@ -1,9 +1,9 @@ package org.jetbrains.dokka.transformers.sources +import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import org.jetbrains.dokka.model.DModule -import org.jetbrains.dokka.model.SourceSetData import org.jetbrains.dokka.plugability.DokkaContext interface SourceToDocumentableTranslator { - fun invoke(sourceSet: SourceSetData, context: DokkaContext): DModule + fun invoke(sourceSet: DokkaSourceSet, context: DokkaContext): DModule }
\ No newline at end of file |