diff options
-rw-r--r-- | core/src/main/kotlin/CoreExtensions.kt | 22 | ||||
-rw-r--r-- | core/src/main/kotlin/generation/SingleModule.kt | 0 | ||||
-rw-r--r-- | core/src/main/kotlin/plugability/DokkaContext.kt | 1 | ||||
-rw-r--r-- | core/test-api/src/main/kotlin/testApi/testRunner/DokkaTestGenerator.kt | 51 | ||||
-rw-r--r-- | core/test-api/src/main/kotlin/testApi/testRunner/TestRunner.kt | 76 | ||||
-rw-r--r-- | plugins/all-module-page/src/main/kotlin/AllModulesPageGeneration.kt | 10 | ||||
-rw-r--r-- | plugins/all-module-page/src/main/kotlin/AllModulesPagePlugin.kt | 10 | ||||
-rw-r--r-- | plugins/base/base-test-utils/src/main/kotlin/testRunner/baseTestApi.kt | 111 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/DokkaBase.kt | 25 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/generation/SingleModuleGeneration.kt (renamed from core/src/main/kotlin/generation/SingleModuleGeneration.kt) | 7 | ||||
-rw-r--r-- | plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt | 2 | ||||
-rw-r--r-- | runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt | 3 |
12 files changed, 181 insertions, 137 deletions
diff --git a/core/src/main/kotlin/CoreExtensions.kt b/core/src/main/kotlin/CoreExtensions.kt index 0eea416a..66e717b4 100644 --- a/core/src/main/kotlin/CoreExtensions.kt +++ b/core/src/main/kotlin/CoreExtensions.kt @@ -1,51 +1,29 @@ package org.jetbrains.dokka import org.jetbrains.dokka.generation.Generation -import org.jetbrains.dokka.generation.SingleModuleGeneration import org.jetbrains.dokka.plugability.* -import org.jetbrains.dokka.plugability.LazyEvaluated import org.jetbrains.dokka.renderers.Renderer import org.jetbrains.dokka.transformers.documentation.DocumentableMerger import org.jetbrains.dokka.transformers.documentation.DocumentableToPageTranslator import org.jetbrains.dokka.transformers.documentation.DocumentableTransformer -import org.jetbrains.dokka.transformers.documentation.PreMergeDocumentableTransformer -import org.jetbrains.dokka.transformers.pages.PageCreator import org.jetbrains.dokka.transformers.pages.PageTransformer import org.jetbrains.dokka.transformers.sources.SourceToDocumentableTranslator import org.jetbrains.dokka.validity.PreGenerationChecker import kotlin.reflect.KProperty object CoreExtensions { - private val extensionDelegates = mutableListOf<Lazy<Extension<*, *, *>>>() val preGenerationCheck by coreExtensionPoint<PreGenerationChecker>() val generation by coreExtensionPoint<Generation>() val sourceToDocumentableTranslator by coreExtensionPoint<SourceToDocumentableTranslator>() - val preMergeDocumentableTransformer by coreExtensionPoint<PreMergeDocumentableTransformer>() val documentableMerger by coreExtensionPoint<DocumentableMerger>() val documentableTransformer by coreExtensionPoint<DocumentableTransformer>() val documentableToPageTranslator by coreExtensionPoint<DocumentableToPageTranslator>() - val allModulePageCreator by coreExtensionPoint<PageCreator>() val pageTransformer by coreExtensionPoint<PageTransformer>() - val allModulePageTransformer by coreExtensionPoint<PageTransformer>() val renderer by coreExtensionPoint<Renderer>() - val singleGeneration by generation extendWith LazyEvaluated.fromRecipe(::SingleModuleGeneration) - private fun <T : Any> coreExtensionPoint() = object { operator fun provideDelegate(thisRef: CoreExtensions, property: KProperty<*>): Lazy<ExtensionPoint<T>> = lazy { ExtensionPoint<T>(thisRef::class.qualifiedName!!, property.name) } } - - private infix fun <T: Any> ExtensionPoint<T>.extendWith(action: LazyEvaluated<T>) = object { - operator fun provideDelegate(thisRef: CoreExtensions, property: KProperty<*>): Lazy<Extension<T, OrderingKind.None, OverrideKind.None>> = - lazy { Extension(this@extendWith, thisRef::class.qualifiedName!!, property.name, action) } - .also { extensionDelegates += it } - } - - internal fun installTo(context: DokkaContextConfiguration) { - extensionDelegates.forEach { - context.installExtension(it.value) - } - } }
\ No newline at end of file diff --git a/core/src/main/kotlin/generation/SingleModule.kt b/core/src/main/kotlin/generation/SingleModule.kt deleted file mode 100644 index e69de29b..00000000 --- a/core/src/main/kotlin/generation/SingleModule.kt +++ /dev/null diff --git a/core/src/main/kotlin/plugability/DokkaContext.kt b/core/src/main/kotlin/plugability/DokkaContext.kt index 1f5f6018..8703af4f 100644 --- a/core/src/main/kotlin/plugability/DokkaContext.kt +++ b/core/src/main/kotlin/plugability/DokkaContext.kt @@ -30,7 +30,6 @@ interface DokkaContext { pluginOverrides: List<DokkaPlugin> ): DokkaContext = DokkaContextConfigurationImpl(logger, configuration).apply { - CoreExtensions.installTo(this) // 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() diff --git a/core/test-api/src/main/kotlin/testApi/testRunner/DokkaTestGenerator.kt b/core/test-api/src/main/kotlin/testApi/testRunner/DokkaTestGenerator.kt deleted file mode 100644 index 0f5814f6..00000000 --- a/core/test-api/src/main/kotlin/testApi/testRunner/DokkaTestGenerator.kt +++ /dev/null @@ -1,51 +0,0 @@ -package org.jetbrains.dokka.testApi.testRunner - -import org.jetbrains.dokka.CoreExtensions -import org.jetbrains.dokka.DokkaConfiguration -import org.jetbrains.dokka.DokkaGenerator -import org.jetbrains.dokka.generation.SingleModuleGeneration -import org.jetbrains.dokka.plugability.DokkaPlugin -import org.jetbrains.dokka.utilities.DokkaLogger - -internal class DokkaTestGenerator( - private val configuration: DokkaConfiguration, - private val logger: DokkaLogger, - private val testMethods: TestMethods, - private val additionalPlugins: List<DokkaPlugin> = emptyList() -) { - - fun generate() = with(testMethods) { - val dokkaGenerator = DokkaGenerator(configuration, logger) - - val context = - dokkaGenerator.initializePlugins(configuration, logger, additionalPlugins) - pluginsSetupStage(context) - - val singleModuleGeneration = context.single(CoreExtensions.generation) as SingleModuleGeneration - - val modulesFromPlatforms = singleModuleGeneration.createDocumentationModels() - documentablesCreationStage(modulesFromPlatforms) - - verificationStage { singleModuleGeneration.validityCheck(context) } - - val filteredModules = singleModuleGeneration.transformDocumentationModelBeforeMerge(modulesFromPlatforms) - documentablesFirstTransformationStep(filteredModules) - - val documentationModel = singleModuleGeneration.mergeDocumentationModels(filteredModules) - documentablesMergingStage(documentationModel) - - val transformedDocumentation = singleModuleGeneration.transformDocumentationModelAfterMerge(documentationModel) - documentablesTransformationStage(transformedDocumentation) - - val pages = singleModuleGeneration.createPages(transformedDocumentation) - pagesGenerationStage(pages) - - val transformedPages = singleModuleGeneration.transformPages(pages) - pagesTransformationStage(transformedPages) - - singleModuleGeneration.render(transformedPages) - renderingStage(transformedPages, context) - - singleModuleGeneration.reportAfterRendering() - } -} diff --git a/core/test-api/src/main/kotlin/testApi/testRunner/TestRunner.kt b/core/test-api/src/main/kotlin/testApi/testRunner/TestRunner.kt index 0b3068fc..380eb1d8 100644 --- a/core/test-api/src/main/kotlin/testApi/testRunner/TestRunner.kt +++ b/core/test-api/src/main/kotlin/testApi/testRunner/TestRunner.kt @@ -3,7 +3,6 @@ package org.jetbrains.dokka.testApi.testRunner import com.intellij.openapi.application.PathManager import org.jetbrains.dokka.* import org.jetbrains.dokka.model.DModule -import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import org.jetbrains.dokka.pages.RootPageNode import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.DokkaPlugin @@ -21,8 +20,10 @@ import java.nio.file.Path import java.nio.file.Paths // TODO: take dokka configuration from file -abstract class AbstractCoreTest( - protected val logger: TestLogger = TestLogger(DokkaConsoleLogger) +open class AbstractTest< M: TestMethods, T : TestBuilder<M>, D: DokkaTestGenerator<M> >( + protected val testBuilder: () -> T, + protected val dokkaTestGenerator: (DokkaConfiguration, DokkaLogger, M, List<DokkaPlugin>) -> D, + protected val logger: TestLogger, ) { protected fun getTestDataDir(name: String) = File("src/test/resources/$name").takeIf { it.exists() }?.toPath() @@ -32,9 +33,9 @@ abstract class AbstractCoreTest( configuration: DokkaConfigurationImpl, cleanupOutput: Boolean = true, pluginOverrides: List<DokkaPlugin> = emptyList(), - block: TestBuilder.() -> Unit + block: T.() -> Unit ) { - val testMethods = TestBuilder().apply(block).build() + val testMethods = testBuilder().apply(block).build() val tempDir = getTempDir(cleanupOutput) if (!cleanupOutput) logger.info("Output generated under: ${tempDir.root.absolutePath}") @@ -42,7 +43,7 @@ abstract class AbstractCoreTest( configuration.copy( outputDir = tempDir.root ) - DokkaTestGenerator( + dokkaTestGenerator( newConfiguration, logger, testMethods, @@ -56,9 +57,9 @@ abstract class AbstractCoreTest( cleanupOutput: Boolean = true, pluginOverrides: List<DokkaPlugin> = emptyList(), loggerForTest: DokkaLogger = logger, - block: TestBuilder.() -> Unit + block: T.() -> Unit ) { - val testMethods = TestBuilder().apply(block).build() + val testMethods = testBuilder().apply(block).build() val testDirPath = getTempDir(cleanupOutput).root.toPath() val fileMap = query.toFileMap() fileMap.materializeFiles(testDirPath.toAbsolutePath()) @@ -82,7 +83,7 @@ abstract class AbstractCoreTest( ) } ) - DokkaTestGenerator( + dokkaTestGenerator( newConfiguration, loggerForTest, testMethods, @@ -138,31 +139,6 @@ abstract class AbstractCoreTest( }.apply { create() } } - protected class TestBuilder { - var pluginsSetupStage: (DokkaContext) -> Unit = {} - var verificationStage: (() -> Unit) -> Unit = {} - var documentablesCreationStage: (List<DModule>) -> Unit = {} - var documentablesFirstTransformationStep: (List<DModule>) -> Unit = {} - var documentablesMergingStage: (DModule) -> Unit = {} - var documentablesTransformationStage: (DModule) -> Unit = {} - var pagesGenerationStage: (RootPageNode) -> Unit = {} - var pagesTransformationStage: (RootPageNode) -> Unit = {} - var renderingStage: (RootPageNode, DokkaContext) -> Unit = { a, b -> } - - @PublishedApi - internal fun build() = TestMethods( - pluginsSetupStage, - verificationStage, - documentablesCreationStage, - documentablesFirstTransformationStep, - documentablesMergingStage, - documentablesTransformationStage, - pagesGenerationStage, - pagesTransformationStage, - renderingStage - ) - } - protected fun dokkaConfiguration(block: TestDokkaConfigurationBuilder.() -> Unit): DokkaConfigurationImpl = testApi.testRunner.dokkaConfiguration(block) @@ -193,14 +169,26 @@ abstract class AbstractCoreTest( } } -data class TestMethods( - val pluginsSetupStage: (DokkaContext) -> Unit, - val verificationStage: (() -> Unit) -> Unit, - val documentablesCreationStage: (List<DModule>) -> Unit, - val documentablesFirstTransformationStep: (List<DModule>) -> Unit, - val documentablesMergingStage: (DModule) -> Unit, - val documentablesTransformationStage: (DModule) -> Unit, - val pagesGenerationStage: (RootPageNode) -> Unit, - val pagesTransformationStage: (RootPageNode) -> Unit, - val renderingStage: (RootPageNode, DokkaContext) -> Unit +open class TestMethods( + open val pluginsSetupStage: (DokkaContext) -> Unit, + open val verificationStage: (() -> Unit) -> Unit, + open val documentablesCreationStage: (List<DModule>) -> Unit, + open val documentablesMergingStage: (DModule) -> Unit, + open val documentablesTransformationStage: (DModule) -> Unit, + open val pagesGenerationStage: (RootPageNode) -> Unit, + open val pagesTransformationStage: (RootPageNode) -> Unit, + open val renderingStage: (RootPageNode, DokkaContext) -> Unit ) + +abstract class TestBuilder<M: TestMethods> { + abstract fun build(): M +} + +abstract class DokkaTestGenerator<T: TestMethods>( + protected val configuration: DokkaConfiguration, + protected val logger: DokkaLogger, + protected val testMethods: T, + protected val additionalPlugins: List<DokkaPlugin> = emptyList() +) { + abstract fun generate() +}
\ No newline at end of file diff --git a/plugins/all-module-page/src/main/kotlin/AllModulesPageGeneration.kt b/plugins/all-module-page/src/main/kotlin/AllModulesPageGeneration.kt index f654514a..1ba63627 100644 --- a/plugins/all-module-page/src/main/kotlin/AllModulesPageGeneration.kt +++ b/plugins/all-module-page/src/main/kotlin/AllModulesPageGeneration.kt @@ -6,9 +6,11 @@ import org.jetbrains.dokka.generation.Generation import org.jetbrains.dokka.pages.RootPageNode import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.plugin +import org.jetbrains.dokka.plugability.query import org.jetbrains.dokka.plugability.querySingle class AllModulesPageGeneration(private val context: DokkaContext) : Generation { + override fun Timer.generate() { report("Creating all modules page") val pages = createAllModulePage() @@ -20,17 +22,19 @@ class AllModulesPageGeneration(private val context: DokkaContext) : Generation { render(transformedPages) report("Processing submodules") - context.plugin<AllModulesPagePlugin>().querySingle { templateProcessor }.process() + allModulesPagePlugin().querySingle { templateProcessor }.process() } override val generationName = "index page for project" - fun createAllModulePage() = context.single(CoreExtensions.allModulePageCreator).invoke() + fun createAllModulePage() = allModulesPagePlugin().querySingle { allModulePageCreator }.invoke() fun transformAllModulesPage(pages: RootPageNode) = - context[CoreExtensions.allModulePageTransformer].fold(pages) { acc, t -> t(acc) } + allModulesPagePlugin().query { allModulePageTransformer }.fold(pages) { acc, t -> t(acc) } fun render(transformedPages: RootPageNode) { context.single(CoreExtensions.renderer).render(transformedPages) } + + private fun allModulesPagePlugin() = context.plugin<AllModulesPagePlugin>() }
\ No newline at end of file diff --git a/plugins/all-module-page/src/main/kotlin/AllModulesPagePlugin.kt b/plugins/all-module-page/src/main/kotlin/AllModulesPagePlugin.kt index f1ed8c1e..a65c0c58 100644 --- a/plugins/all-module-page/src/main/kotlin/AllModulesPagePlugin.kt +++ b/plugins/all-module-page/src/main/kotlin/AllModulesPagePlugin.kt @@ -4,15 +4,19 @@ import org.jetbrains.dokka.CoreExtensions import org.jetbrains.dokka.allModulesPage.templates.* import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.plugability.DokkaPlugin +import org.jetbrains.dokka.transformers.pages.PageCreator +import org.jetbrains.dokka.transformers.pages.PageTransformer class AllModulesPagePlugin : DokkaPlugin() { + val templateProcessor by extensionPoint<TemplateProcessor>() + val allModulePageCreator by extensionPoint<PageCreator>() + val allModulePageTransformer by extensionPoint<PageTransformer>() val substitutor by extensionPoint<Substitutor>() val allModulePageCreators by extending { - (CoreExtensions.allModulePageCreator - providing ::MultimodulePageCreator) + allModulePageCreator providing ::MultimodulePageCreator } val multimoduleLocationProvider by extending { @@ -25,7 +29,7 @@ class AllModulesPagePlugin : DokkaPlugin() { val allModulesPageGeneration by extending { (CoreExtensions.generation providing ::AllModulesPageGeneration - override CoreExtensions.singleGeneration) + override plugin<DokkaBase>().singleGeneration) } val defaultTemplateProcessor by extending { diff --git a/plugins/base/base-test-utils/src/main/kotlin/testRunner/baseTestApi.kt b/plugins/base/base-test-utils/src/main/kotlin/testRunner/baseTestApi.kt new file mode 100644 index 00000000..cfc5ed43 --- /dev/null +++ b/plugins/base/base-test-utils/src/main/kotlin/testRunner/baseTestApi.kt @@ -0,0 +1,111 @@ +package org.jetbrains.dokka.base.testApi.testRunner + +import org.jetbrains.dokka.CoreExtensions +import org.jetbrains.dokka.DokkaConfiguration +import org.jetbrains.dokka.DokkaGenerator +import org.jetbrains.dokka.base.generation.SingleModuleGeneration +import org.jetbrains.dokka.model.DModule +import org.jetbrains.dokka.pages.RootPageNode +import org.jetbrains.dokka.plugability.DokkaContext +import org.jetbrains.dokka.plugability.DokkaPlugin +import org.jetbrains.dokka.testApi.logger.TestLogger +import org.jetbrains.dokka.testApi.testRunner.AbstractTest +import org.jetbrains.dokka.testApi.testRunner.DokkaTestGenerator +import org.jetbrains.dokka.testApi.testRunner.TestBuilder +import org.jetbrains.dokka.testApi.testRunner.TestMethods +import org.jetbrains.dokka.utilities.DokkaConsoleLogger +import org.jetbrains.dokka.utilities.DokkaLogger + +class BaseDokkaTestGenerator( + configuration: DokkaConfiguration, + logger: DokkaLogger, + testMethods: BaseTestMethods, + additionalPlugins: List<DokkaPlugin> = emptyList() +) : DokkaTestGenerator<BaseTestMethods>(configuration, logger, testMethods, additionalPlugins) { + + override fun generate() = with(testMethods) { + val dokkaGenerator = DokkaGenerator(configuration, logger) + + val context = + dokkaGenerator.initializePlugins(configuration, logger, additionalPlugins) + pluginsSetupStage(context) + + val singleModuleGeneration = context.single(CoreExtensions.generation) as SingleModuleGeneration + + val modulesFromPlatforms = singleModuleGeneration.createDocumentationModels() + documentablesCreationStage(modulesFromPlatforms) + + verificationStage { singleModuleGeneration.validityCheck(context) } + + val filteredModules = singleModuleGeneration.transformDocumentationModelBeforeMerge(modulesFromPlatforms) + documentablesFirstTransformationStep(filteredModules) + + val documentationModel = singleModuleGeneration.mergeDocumentationModels(filteredModules) + documentablesMergingStage(documentationModel) + + val transformedDocumentation = singleModuleGeneration.transformDocumentationModelAfterMerge(documentationModel) + documentablesTransformationStage(transformedDocumentation) + + val pages = singleModuleGeneration.createPages(transformedDocumentation) + pagesGenerationStage(pages) + + val transformedPages = singleModuleGeneration.transformPages(pages) + pagesTransformationStage(transformedPages) + + singleModuleGeneration.render(transformedPages) + renderingStage(transformedPages, context) + + singleModuleGeneration.reportAfterRendering() + } +} + +data class BaseTestMethods( + override val pluginsSetupStage: (DokkaContext) -> Unit, + override val verificationStage: (() -> Unit) -> Unit, + override val documentablesCreationStage: (List<DModule>) -> Unit, + val documentablesFirstTransformationStep: (List<DModule>) -> Unit, + override val documentablesMergingStage: (DModule) -> Unit, + override val documentablesTransformationStage: (DModule) -> Unit, + override val pagesGenerationStage: (RootPageNode) -> Unit, + override val pagesTransformationStage: (RootPageNode) -> Unit, + override val renderingStage: (RootPageNode, DokkaContext) -> Unit +) : TestMethods( + pluginsSetupStage, + verificationStage, + documentablesCreationStage, + documentablesMergingStage, + documentablesTransformationStage, + pagesGenerationStage, + pagesTransformationStage, + renderingStage, +) + +class BaseTestBuilder : TestBuilder<BaseTestMethods>() { + var pluginsSetupStage: (DokkaContext) -> Unit = {} + var verificationStage: (() -> Unit) -> Unit = {} + var documentablesCreationStage: (List<DModule>) -> Unit = {} + var documentablesFirstTransformationStep: (List<DModule>) -> Unit = {} + var documentablesMergingStage: (DModule) -> Unit = {} + var documentablesTransformationStage: (DModule) -> Unit = {} + var pagesGenerationStage: (RootPageNode) -> Unit = {} + var pagesTransformationStage: (RootPageNode) -> Unit = {} + var renderingStage: (RootPageNode, DokkaContext) -> Unit = { a, b -> } + + override fun build() = BaseTestMethods( + pluginsSetupStage, + verificationStage, + documentablesCreationStage, + documentablesFirstTransformationStep, + documentablesMergingStage, + documentablesTransformationStage, + pagesGenerationStage, + pagesTransformationStage, + renderingStage + ) +} + +open class BaseAbstractTest(logger: TestLogger = TestLogger(DokkaConsoleLogger)) : AbstractTest<BaseTestMethods, BaseTestBuilder, BaseDokkaTestGenerator>( + ::BaseTestBuilder, + ::BaseDokkaTestGenerator, + logger, +)
\ No newline at end of file diff --git a/plugins/base/src/main/kotlin/DokkaBase.kt b/plugins/base/src/main/kotlin/DokkaBase.kt index fce5c399..ac070ab4 100644 --- a/plugins/base/src/main/kotlin/DokkaBase.kt +++ b/plugins/base/src/main/kotlin/DokkaBase.kt @@ -16,7 +16,6 @@ import org.jetbrains.dokka.base.resolvers.local.LocationProviderFactory import org.jetbrains.dokka.base.resolvers.shared.RecognizedLinkFormat import org.jetbrains.dokka.base.signatures.KotlinSignatureProvider import org.jetbrains.dokka.base.signatures.SignatureProvider -import org.jetbrains.dokka.base.templating.Command import org.jetbrains.dokka.base.templating.ImmediateHtmlCommandConsumer import org.jetbrains.dokka.base.transformers.documentables.* import org.jetbrains.dokka.base.transformers.pages.annotations.SinceKotlinTransformer @@ -28,10 +27,14 @@ import org.jetbrains.dokka.base.transformers.pages.sourcelinks.SourceLinksTransf import org.jetbrains.dokka.base.translators.descriptors.DefaultDescriptorToDocumentableTranslator import org.jetbrains.dokka.base.translators.documentables.DefaultDocumentableToPageTranslator import org.jetbrains.dokka.base.translators.psi.DefaultPsiToDocumentableTranslator +import org.jetbrains.dokka.base.generation.SingleModuleGeneration import org.jetbrains.dokka.plugability.DokkaPlugin +import org.jetbrains.dokka.transformers.documentation.PreMergeDocumentableTransformer import org.jetbrains.dokka.transformers.pages.PageTransformer class DokkaBase : DokkaPlugin() { + + val preMergeDocumentableTransformer by extensionPoint<PreMergeDocumentableTransformer>() val pageMergerStrategy by extensionPoint<PageMergerStrategy>() val commentsToContentConverter by extensionPoint<CommentsToContentConverter>() val signatureProvider by extensionPoint<SignatureProvider>() @@ -43,6 +46,10 @@ class DokkaBase : DokkaPlugin() { val tabSortingStrategy by extensionPoint<TabSortingStrategy>() val immediateHtmlCommandConsumer by extensionPoint<ImmediateHtmlCommandConsumer>() + val singleGeneration by extending { + CoreExtensions.generation providing ::SingleModuleGeneration + } + val descriptorToDocumentableTranslator by extending { CoreExtensions.sourceToDocumentableTranslator providing ::DefaultDescriptorToDocumentableTranslator } @@ -56,29 +63,29 @@ class DokkaBase : DokkaPlugin() { } val deprecatedDocumentableFilter by extending { - CoreExtensions.preMergeDocumentableTransformer providing ::DeprecatedDocumentableFilterTransformer + preMergeDocumentableTransformer providing ::DeprecatedDocumentableFilterTransformer } val suppressedDocumentableFilter by extending { - CoreExtensions.preMergeDocumentableTransformer providing ::SuppressedDocumentableFilterTransformer + preMergeDocumentableTransformer providing ::SuppressedDocumentableFilterTransformer } val documentableVisbilityFilter by extending { - CoreExtensions.preMergeDocumentableTransformer providing ::DocumentableVisibilityFilterTransformer + preMergeDocumentableTransformer providing ::DocumentableVisibilityFilterTransformer } val emptyPackagesFilter by extending { - CoreExtensions.preMergeDocumentableTransformer providing ::EmptyPackagesFilterTransformer order { + preMergeDocumentableTransformer providing ::EmptyPackagesFilterTransformer order { after(deprecatedDocumentableFilter, suppressedDocumentableFilter, documentableVisbilityFilter) } } - val actualTypealiasAdder by extending { - CoreExtensions.documentableTransformer with ActualTypealiasAdder() + val modulesAndPackagesDocumentation by extending { + preMergeDocumentableTransformer providing ::ModuleAndPackageDocumentationTransformer } - val modulesAndPackagesDocumentation by extending { - CoreExtensions.preMergeDocumentableTransformer providing ::ModuleAndPackageDocumentationTransformer + val actualTypealiasAdder by extending { + CoreExtensions.documentableTransformer with ActualTypealiasAdder() } val kotlinSignatureProvider by extending { diff --git a/core/src/main/kotlin/generation/SingleModuleGeneration.kt b/plugins/base/src/main/kotlin/generation/SingleModuleGeneration.kt index 2eedc561..eb405a3d 100644 --- a/core/src/main/kotlin/generation/SingleModuleGeneration.kt +++ b/plugins/base/src/main/kotlin/generation/SingleModuleGeneration.kt @@ -1,5 +1,5 @@ -package org.jetbrains.dokka.generation +package org.jetbrains.dokka.base.generation import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runBlocking @@ -7,9 +7,12 @@ import org.jetbrains.dokka.CoreExtensions import org.jetbrains.dokka.DokkaConfiguration import org.jetbrains.dokka.DokkaException import org.jetbrains.dokka.Timer +import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.model.DModule import org.jetbrains.dokka.pages.RootPageNode import org.jetbrains.dokka.plugability.DokkaContext +import org.jetbrains.dokka.plugability.plugin +import org.jetbrains.dokka.plugability.query import org.jetbrains.dokka.transformers.sources.AsyncSourceToDocumentableTranslator import org.jetbrains.dokka.utilities.parallelMap import org.jetbrains.dokka.utilities.report @@ -51,7 +54,7 @@ class SingleModuleGeneration(private val context: DokkaContext) : Generation { } fun transformDocumentationModelBeforeMerge(modulesFromPlatforms: List<DModule>) = - context[CoreExtensions.preMergeDocumentableTransformer].fold(modulesFromPlatforms) { acc, t -> t(acc) } + context.plugin<DokkaBase>().query { preMergeDocumentableTransformer }.fold(modulesFromPlatforms) { acc, t -> t(acc) } fun mergeDocumentationModels(modulesFromPlatforms: List<DModule>) = context.single(CoreExtensions.documentableMerger).invoke(modulesFromPlatforms) diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt index d23aaa4e..0bbbbf86 100644 --- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt +++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt @@ -36,7 +36,7 @@ class JavadocPlugin : DokkaPlugin() { } val documentableSourceSetFilter by extending { - CoreExtensions.preMergeDocumentableTransformer providing ::JavadocDocumentableJVMSourceSetFilter + dokkaBasePlugin.preMergeDocumentableTransformer providing ::JavadocDocumentableJVMSourceSetFilter } val javadocLocationProviderFactory by extending { diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt index fd449346..1744f265 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt @@ -85,7 +85,8 @@ class DokkaMultiModuleTaskTest { DokkaModuleDescriptionImpl( name = "child", relativePathToOutputDirectory = File("child"), - includes = setOf(include1, include2) + includes = setOf(include1, include2), + sourceOutputDirectory = multiModuleTask.outputDirectory.getSafe() ) ) ), |