From bee52be815bebd7012193728521636b5fbed2829 Mon Sep 17 00:00:00 2001 From: Kamil Doległo Date: Tue, 18 Feb 2020 17:47:14 +0100 Subject: Rename extensions to make them more uniform --- core/src/main/kotlin/CoreExtensions.kt | 20 ++++++++++---------- core/src/main/kotlin/DokkaGenerator.kt | 8 ++++---- .../DescriptorToDocumentableTranslator.kt | 13 +++++++++++++ .../DescriptorToDocumentationTranslator.kt | 14 -------------- .../documentation/DocumentableToPageTranslator.kt | 8 ++++++++ .../documentation/DocumentableTransformer.kt | 8 ++++++++ .../documentation/DocumentablesToPageTranslator.kt | 9 --------- .../documentation/DocumentationNodeTransformer.kt | 8 -------- .../kotlin/transformers/pages/PageNodeTransformer.kt | 9 --------- .../kotlin/transformers/pages/PageTransformer.kt | 7 +++++++ .../transformers/psi/PsiToDocumentableTranslator.kt | 15 +++++++++++++++ .../transformers/psi/PsiToDocumentationTranslator.kt | 15 --------------- 12 files changed, 65 insertions(+), 69 deletions(-) create mode 100644 core/src/main/kotlin/transformers/descriptors/DescriptorToDocumentableTranslator.kt delete mode 100644 core/src/main/kotlin/transformers/descriptors/DescriptorToDocumentationTranslator.kt create mode 100644 core/src/main/kotlin/transformers/documentation/DocumentableToPageTranslator.kt create mode 100644 core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt delete mode 100644 core/src/main/kotlin/transformers/documentation/DocumentablesToPageTranslator.kt delete mode 100644 core/src/main/kotlin/transformers/documentation/DocumentationNodeTransformer.kt delete mode 100644 core/src/main/kotlin/transformers/pages/PageNodeTransformer.kt create mode 100644 core/src/main/kotlin/transformers/pages/PageTransformer.kt create mode 100644 core/src/main/kotlin/transformers/psi/PsiToDocumentableTranslator.kt delete mode 100644 core/src/main/kotlin/transformers/psi/PsiToDocumentationTranslator.kt (limited to 'core') diff --git a/core/src/main/kotlin/CoreExtensions.kt b/core/src/main/kotlin/CoreExtensions.kt index 82a1c367..dd6eab1b 100644 --- a/core/src/main/kotlin/CoreExtensions.kt +++ b/core/src/main/kotlin/CoreExtensions.kt @@ -2,21 +2,21 @@ package org.jetbrains.dokka import org.jetbrains.dokka.plugability.ExtensionPoint import org.jetbrains.dokka.renderers.Renderer -import org.jetbrains.dokka.transformers.descriptors.DescriptorToDocumentationTranslator +import org.jetbrains.dokka.transformers.descriptors.DescriptorToDocumentableTranslator import org.jetbrains.dokka.transformers.documentation.DocumentableMerger -import org.jetbrains.dokka.transformers.documentation.DocumentationNodeTransformer -import org.jetbrains.dokka.transformers.documentation.DocumentablesToPageTranslator -import org.jetbrains.dokka.transformers.pages.PageNodeTransformer -import org.jetbrains.dokka.transformers.psi.PsiToDocumentationTranslator +import org.jetbrains.dokka.transformers.documentation.DocumentableToPageTranslator +import org.jetbrains.dokka.transformers.documentation.DocumentableTransformer +import org.jetbrains.dokka.transformers.pages.PageTransformer +import org.jetbrains.dokka.transformers.psi.PsiToDocumentableTranslator import kotlin.reflect.KProperty object CoreExtensions { - val descriptorToDocumentationTranslator by coreExtension() - val psiToDocumentationTranslator by coreExtension() + val descriptorToDocumentableTranslator by coreExtension() + val psiToDocumentableTranslator by coreExtension() val documentableMerger by coreExtension() - val documentationTransformer by coreExtension() - val documentablesToPageTranslator by coreExtension() - val pageTransformer by coreExtension() + val documentableTransformer by coreExtension() + val documentableToPageTranslator by coreExtension() + val pageTransformer by coreExtension() val renderer by coreExtension() private fun coreExtension() = object { diff --git a/core/src/main/kotlin/DokkaGenerator.kt b/core/src/main/kotlin/DokkaGenerator.kt index 8897e68d..e318e969 100644 --- a/core/src/main/kotlin/DokkaGenerator.kt +++ b/core/src/main/kotlin/DokkaGenerator.kt @@ -83,12 +83,12 @@ class DokkaGenerator( fun transformDocumentationModel( documentationModel: Module, context: DokkaContext - ) = context[CoreExtensions.documentationTransformer].fold(documentationModel) { acc, t -> t(acc, context) } + ) = context[CoreExtensions.documentableTransformer].fold(documentationModel) { acc, t -> t(acc, context) } fun createPages( transformedDocumentation: Module, context: DokkaContext - ) = context.single(CoreExtensions.documentablesToPageTranslator).invoke(transformedDocumentation) + ) = context.single(CoreExtensions.documentableToPageTranslator).invoke(transformedDocumentation) fun transformPages( pages: RootPageNode, @@ -128,7 +128,7 @@ class DokkaGenerator( .mapNotNull { facade.resolveSession.getPackageFragment(it) } .toList() - return context.single(CoreExtensions.descriptorToDocumentationTranslator) + return context.single(CoreExtensions.descriptorToDocumentableTranslator) .invoke(platformData.name, packageFragments, platformData) } @@ -149,7 +149,7 @@ class DokkaGenerator( }.toList() }.flatten() - return context.single(CoreExtensions.psiToDocumentationTranslator) + return context.single(CoreExtensions.psiToDocumentableTranslator) .invoke(platformData.name, psiFiles, platformData, context) } diff --git a/core/src/main/kotlin/transformers/descriptors/DescriptorToDocumentableTranslator.kt b/core/src/main/kotlin/transformers/descriptors/DescriptorToDocumentableTranslator.kt new file mode 100644 index 00000000..d72eeafd --- /dev/null +++ b/core/src/main/kotlin/transformers/descriptors/DescriptorToDocumentableTranslator.kt @@ -0,0 +1,13 @@ +package org.jetbrains.dokka.transformers.descriptors + +import org.jetbrains.dokka.model.Module +import org.jetbrains.dokka.pages.PlatformData +import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor + +interface DescriptorToDocumentableTranslator { + fun invoke( + moduleName: String, + packageFragments: Iterable, + platformData: PlatformData + ): Module +} \ No newline at end of file diff --git a/core/src/main/kotlin/transformers/descriptors/DescriptorToDocumentationTranslator.kt b/core/src/main/kotlin/transformers/descriptors/DescriptorToDocumentationTranslator.kt deleted file mode 100644 index 5074833e..00000000 --- a/core/src/main/kotlin/transformers/descriptors/DescriptorToDocumentationTranslator.kt +++ /dev/null @@ -1,14 +0,0 @@ -package org.jetbrains.dokka.transformers.descriptors - -import org.jetbrains.dokka.model.Module -import org.jetbrains.dokka.pages.PlatformData -import org.jetbrains.dokka.plugability.DokkaContext -import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor - -interface DescriptorToDocumentationTranslator { - fun invoke( - moduleName: String, - packageFragments: Iterable, - platformData: PlatformData - ): Module -} \ No newline at end of file diff --git a/core/src/main/kotlin/transformers/documentation/DocumentableToPageTranslator.kt b/core/src/main/kotlin/transformers/documentation/DocumentableToPageTranslator.kt new file mode 100644 index 00000000..e41e0c84 --- /dev/null +++ b/core/src/main/kotlin/transformers/documentation/DocumentableToPageTranslator.kt @@ -0,0 +1,8 @@ +package org.jetbrains.dokka.transformers.documentation + +import org.jetbrains.dokka.model.Module +import org.jetbrains.dokka.pages.ModulePageNode + +interface DocumentableToPageTranslator { + operator fun invoke(module: Module): ModulePageNode +} \ No newline at end of file diff --git a/core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt b/core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt new file mode 100644 index 00000000..88a1514d --- /dev/null +++ b/core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt @@ -0,0 +1,8 @@ +package org.jetbrains.dokka.transformers.documentation + +import org.jetbrains.dokka.model.Module +import org.jetbrains.dokka.plugability.DokkaContext + +interface DocumentableTransformer { + operator fun invoke(original: Module, context: DokkaContext): Module +} \ No newline at end of file diff --git a/core/src/main/kotlin/transformers/documentation/DocumentablesToPageTranslator.kt b/core/src/main/kotlin/transformers/documentation/DocumentablesToPageTranslator.kt deleted file mode 100644 index 19698fa0..00000000 --- a/core/src/main/kotlin/transformers/documentation/DocumentablesToPageTranslator.kt +++ /dev/null @@ -1,9 +0,0 @@ -package org.jetbrains.dokka.transformers.documentation - -import org.jetbrains.dokka.model.Module -import org.jetbrains.dokka.pages.ModulePageNode -import org.jetbrains.dokka.plugability.DokkaContext - -interface DocumentablesToPageTranslator { - operator fun invoke(module: Module): ModulePageNode -} \ No newline at end of file diff --git a/core/src/main/kotlin/transformers/documentation/DocumentationNodeTransformer.kt b/core/src/main/kotlin/transformers/documentation/DocumentationNodeTransformer.kt deleted file mode 100644 index d6358f07..00000000 --- a/core/src/main/kotlin/transformers/documentation/DocumentationNodeTransformer.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.jetbrains.dokka.transformers.documentation - -import org.jetbrains.dokka.model.Module -import org.jetbrains.dokka.plugability.DokkaContext - -interface DocumentationNodeTransformer { - operator fun invoke(original: Module, context: DokkaContext): Module -} \ No newline at end of file diff --git a/core/src/main/kotlin/transformers/pages/PageNodeTransformer.kt b/core/src/main/kotlin/transformers/pages/PageNodeTransformer.kt deleted file mode 100644 index 45357060..00000000 --- a/core/src/main/kotlin/transformers/pages/PageNodeTransformer.kt +++ /dev/null @@ -1,9 +0,0 @@ -package org.jetbrains.dokka.transformers.pages - -import org.jetbrains.dokka.pages.ModulePageNode -import org.jetbrains.dokka.pages.RootPageNode -import org.jetbrains.dokka.plugability.DokkaContext - -interface PageNodeTransformer { - operator fun invoke(input: RootPageNode): RootPageNode -} \ No newline at end of file diff --git a/core/src/main/kotlin/transformers/pages/PageTransformer.kt b/core/src/main/kotlin/transformers/pages/PageTransformer.kt new file mode 100644 index 00000000..218d9821 --- /dev/null +++ b/core/src/main/kotlin/transformers/pages/PageTransformer.kt @@ -0,0 +1,7 @@ +package org.jetbrains.dokka.transformers.pages + +import org.jetbrains.dokka.pages.RootPageNode + +interface PageTransformer { + operator fun invoke(input: RootPageNode): RootPageNode +} \ No newline at end of file diff --git a/core/src/main/kotlin/transformers/psi/PsiToDocumentableTranslator.kt b/core/src/main/kotlin/transformers/psi/PsiToDocumentableTranslator.kt new file mode 100644 index 00000000..1ea07ff3 --- /dev/null +++ b/core/src/main/kotlin/transformers/psi/PsiToDocumentableTranslator.kt @@ -0,0 +1,15 @@ +package org.jetbrains.dokka.transformers.psi + +import com.intellij.psi.PsiJavaFile +import org.jetbrains.dokka.model.Module +import org.jetbrains.dokka.pages.PlatformData +import org.jetbrains.dokka.plugability.DokkaContext + +interface PsiToDocumentableTranslator { + fun invoke( + moduleName: String, + psiFiles: List, + platformData: PlatformData, + context: DokkaContext + ): Module +} diff --git a/core/src/main/kotlin/transformers/psi/PsiToDocumentationTranslator.kt b/core/src/main/kotlin/transformers/psi/PsiToDocumentationTranslator.kt deleted file mode 100644 index 41290ef8..00000000 --- a/core/src/main/kotlin/transformers/psi/PsiToDocumentationTranslator.kt +++ /dev/null @@ -1,15 +0,0 @@ -package org.jetbrains.dokka.transformers.psi - -import com.intellij.psi.PsiJavaFile -import org.jetbrains.dokka.model.Module -import org.jetbrains.dokka.pages.PlatformData -import org.jetbrains.dokka.plugability.DokkaContext - -interface PsiToDocumentationTranslator { - fun invoke( - moduleName: String, - psiFiles: List, - platformData: PlatformData, - context: DokkaContext - ): Module -} -- cgit