aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/transformers
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-08-31 20:16:01 +0200
committerGitHub <noreply@github.com>2023-08-31 20:16:01 +0200
commit02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33 (patch)
tree66f6d6f089a93b863bf1144666491eca6729ad05 /core/src/main/kotlin/transformers
parent6a181a7a2b03ec263788d137610e86937a57d434 (diff)
downloaddokka-02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33.tar.gz
dokka-02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33.tar.bz2
dokka-02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33.zip
Enable explicit API mode (#3139)
Diffstat (limited to 'core/src/main/kotlin/transformers')
-rw-r--r--core/src/main/kotlin/transformers/documentation/DocumentableMerger.kt5
-rw-r--r--core/src/main/kotlin/transformers/documentation/DocumentableToPageTranslator.kt5
-rw-r--r--core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt4
-rw-r--r--core/src/main/kotlin/transformers/documentation/PreMergeDocumentableTransformer.kt15
-rw-r--r--core/src/main/kotlin/transformers/pages/PageCreator.kt8
-rw-r--r--core/src/main/kotlin/transformers/pages/PageTransformer.kt4
-rw-r--r--core/src/main/kotlin/transformers/pages/PageTransformerBuilders.kt17
-rw-r--r--core/src/main/kotlin/transformers/sources/AsyncSourceToDocumentableTranslator.kt4
-rw-r--r--core/src/main/kotlin/transformers/sources/SourceToDocumentableTranslator.kt4
9 files changed, 37 insertions, 29 deletions
diff --git a/core/src/main/kotlin/transformers/documentation/DocumentableMerger.kt b/core/src/main/kotlin/transformers/documentation/DocumentableMerger.kt
index 9673f2ff..aff1f763 100644
--- a/core/src/main/kotlin/transformers/documentation/DocumentableMerger.kt
+++ b/core/src/main/kotlin/transformers/documentation/DocumentableMerger.kt
@@ -6,6 +6,7 @@ package org.jetbrains.dokka.transformers.documentation
import org.jetbrains.dokka.model.DModule
-fun interface DocumentableMerger {
- operator fun invoke(modules: Collection<DModule>): DModule?
+public fun interface DocumentableMerger {
+ public operator fun invoke(modules: Collection<DModule>): DModule?
}
+
diff --git a/core/src/main/kotlin/transformers/documentation/DocumentableToPageTranslator.kt b/core/src/main/kotlin/transformers/documentation/DocumentableToPageTranslator.kt
index fe83be18..ad35ab1d 100644
--- a/core/src/main/kotlin/transformers/documentation/DocumentableToPageTranslator.kt
+++ b/core/src/main/kotlin/transformers/documentation/DocumentableToPageTranslator.kt
@@ -7,6 +7,7 @@ package org.jetbrains.dokka.transformers.documentation
import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.pages.RootPageNode
-fun interface DocumentableToPageTranslator {
- operator fun invoke(module: DModule): RootPageNode
+public fun interface DocumentableToPageTranslator {
+ public operator fun invoke(module: DModule): RootPageNode
}
+
diff --git a/core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt b/core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt
index 9fdf38ba..f680b9f3 100644
--- a/core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt
+++ b/core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt
@@ -7,6 +7,6 @@ package org.jetbrains.dokka.transformers.documentation
import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.plugability.DokkaContext
-fun interface DocumentableTransformer {
- operator fun invoke(original: DModule, context: DokkaContext): DModule
+public fun interface DocumentableTransformer {
+ public operator fun invoke(original: DModule, context: DokkaContext): DModule
}
diff --git a/core/src/main/kotlin/transformers/documentation/PreMergeDocumentableTransformer.kt b/core/src/main/kotlin/transformers/documentation/PreMergeDocumentableTransformer.kt
index 06d5ef04..8ae28605 100644
--- a/core/src/main/kotlin/transformers/documentation/PreMergeDocumentableTransformer.kt
+++ b/core/src/main/kotlin/transformers/documentation/PreMergeDocumentableTransformer.kt
@@ -8,33 +8,32 @@ import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.DokkaConfiguration.PackageOptions
import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.model.Documentable
+import org.jetbrains.dokka.model.DocumentableSource
import org.jetbrains.dokka.model.WithSources
-interface PreMergeDocumentableTransformer {
- operator fun invoke(modules: List<DModule>): List<DModule>
+public interface PreMergeDocumentableTransformer {
+ public operator fun invoke(modules: List<DModule>): List<DModule>
}
-/* Utils */
-
/**
* It is fair to assume that a given [Documentable] is not merged when seen by the [PreMergeDocumentableTransformer].
* Therefore, it can also be assumed, that there is just a single source set connected to the given [documentable]
* @return the single source set associated with this [documentable].
*/
-@Suppress("unused") // Receiver is used for scoping this function
-fun PreMergeDocumentableTransformer.sourceSet(documentable: Documentable): DokkaSourceSet {
+@Suppress("UnusedReceiverParameter") // Receiver is used for scoping this function
+public fun PreMergeDocumentableTransformer.sourceSet(documentable: Documentable): DokkaSourceSet {
return documentable.sourceSets.single()
}
/**
* @return The [PackageOptions] associated with this documentable, or null
*/
-fun PreMergeDocumentableTransformer.perPackageOptions(documentable: Documentable): PackageOptions? {
+public fun PreMergeDocumentableTransformer.perPackageOptions(documentable: Documentable): PackageOptions? {
val packageName = documentable.dri.packageName ?: return null
return sourceSet(documentable).perPackageOptions
.sortedByDescending { packageOptions -> packageOptions.matchingRegex.length }
.firstOrNull { packageOptions -> Regex(packageOptions.matchingRegex).matches(packageName) }
}
-fun <T> PreMergeDocumentableTransformer.source(documentable: T) where T : Documentable, T : WithSources =
+public fun <T> PreMergeDocumentableTransformer.source(documentable: T): DocumentableSource where T : Documentable, T : WithSources =
checkNotNull(documentable.sources[sourceSet(documentable)])
diff --git a/core/src/main/kotlin/transformers/pages/PageCreator.kt b/core/src/main/kotlin/transformers/pages/PageCreator.kt
index 1dc179f7..8c008f04 100644
--- a/core/src/main/kotlin/transformers/pages/PageCreator.kt
+++ b/core/src/main/kotlin/transformers/pages/PageCreator.kt
@@ -6,10 +6,10 @@ package org.jetbrains.dokka.transformers.pages
import org.jetbrains.dokka.pages.RootPageNode
-interface CreationContext
+public interface CreationContext
-object NoCreationContext : CreationContext
+public object NoCreationContext : CreationContext
-interface PageCreator<T: CreationContext> {
- operator fun invoke(creationContext: T): RootPageNode
+public interface PageCreator<T: CreationContext> {
+ public operator fun invoke(creationContext: T): RootPageNode
}
diff --git a/core/src/main/kotlin/transformers/pages/PageTransformer.kt b/core/src/main/kotlin/transformers/pages/PageTransformer.kt
index cd72818c..b2bbc1d1 100644
--- a/core/src/main/kotlin/transformers/pages/PageTransformer.kt
+++ b/core/src/main/kotlin/transformers/pages/PageTransformer.kt
@@ -6,6 +6,6 @@ package org.jetbrains.dokka.transformers.pages
import org.jetbrains.dokka.pages.RootPageNode
-fun interface PageTransformer {
- operator fun invoke(input: RootPageNode): RootPageNode
+public fun interface PageTransformer {
+ public operator fun invoke(input: RootPageNode): RootPageNode
}
diff --git a/core/src/main/kotlin/transformers/pages/PageTransformerBuilders.kt b/core/src/main/kotlin/transformers/pages/PageTransformerBuilders.kt
index 2e3732f6..a00c1578 100644
--- a/core/src/main/kotlin/transformers/pages/PageTransformerBuilders.kt
+++ b/core/src/main/kotlin/transformers/pages/PageTransformerBuilders.kt
@@ -7,14 +7,21 @@ package org.jetbrains.dokka.transformers.pages
import org.jetbrains.dokka.pages.PageNode
import org.jetbrains.dokka.pages.RootPageNode
-fun pageScanner(block: PageNode.() -> Unit) = PageTransformer { input -> input.invokeOnAll(block) as RootPageNode }
+public fun pageScanner(block: PageNode.() -> Unit): PageTransformer {
+ return PageTransformer { input -> input.invokeOnAll(block) as RootPageNode }
+}
-fun pageMapper(block: PageNode.() -> PageNode) = PageTransformer { input -> input.alterChildren(block) as RootPageNode }
+public fun pageMapper(block: PageNode.() -> PageNode): PageTransformer {
+ return PageTransformer { input -> input.alterChildren(block) as RootPageNode }
+}
-fun pageStructureTransformer(block: RootPageNode.() -> RootPageNode) = PageTransformer { input -> block(input) }
+public fun pageStructureTransformer(block: RootPageNode.() -> RootPageNode): PageTransformer {
+ return PageTransformer { input -> block(input) }
+}
-fun PageNode.invokeOnAll(block: PageNode.() -> Unit): PageNode =
+public fun PageNode.invokeOnAll(block: PageNode.() -> Unit): PageNode =
this.also(block).also { it.children.forEach { it.invokeOnAll(block) } }
-fun PageNode.alterChildren(block: PageNode.() -> PageNode): PageNode =
+public fun PageNode.alterChildren(block: PageNode.() -> PageNode): PageNode =
block(this).modified(children = this.children.map { it.alterChildren(block) })
+
diff --git a/core/src/main/kotlin/transformers/sources/AsyncSourceToDocumentableTranslator.kt b/core/src/main/kotlin/transformers/sources/AsyncSourceToDocumentableTranslator.kt
index a153759f..f7f45d25 100644
--- a/core/src/main/kotlin/transformers/sources/AsyncSourceToDocumentableTranslator.kt
+++ b/core/src/main/kotlin/transformers/sources/AsyncSourceToDocumentableTranslator.kt
@@ -10,8 +10,8 @@ import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.plugability.DokkaContext
-interface AsyncSourceToDocumentableTranslator : SourceToDocumentableTranslator {
- suspend fun invokeSuspending(sourceSet: DokkaConfiguration.DokkaSourceSet, context: DokkaContext): DModule
+public interface AsyncSourceToDocumentableTranslator : SourceToDocumentableTranslator {
+ public suspend fun invokeSuspending(sourceSet: DokkaConfiguration.DokkaSourceSet, context: DokkaContext): DModule
override fun invoke(sourceSet: DokkaConfiguration.DokkaSourceSet, context: DokkaContext): DModule =
runBlocking(Dispatchers.Default) {
diff --git a/core/src/main/kotlin/transformers/sources/SourceToDocumentableTranslator.kt b/core/src/main/kotlin/transformers/sources/SourceToDocumentableTranslator.kt
index 0ba37d40..04f11830 100644
--- a/core/src/main/kotlin/transformers/sources/SourceToDocumentableTranslator.kt
+++ b/core/src/main/kotlin/transformers/sources/SourceToDocumentableTranslator.kt
@@ -8,6 +8,6 @@ import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.plugability.DokkaContext
-fun interface SourceToDocumentableTranslator {
- fun invoke(sourceSet: DokkaSourceSet, context: DokkaContext): DModule
+public fun interface SourceToDocumentableTranslator {
+ public fun invoke(sourceSet: DokkaSourceSet, context: DokkaContext): DModule
}