aboutsummaryrefslogtreecommitdiff
path: root/subprojects/analysis-kotlin-api/src
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/analysis-kotlin-api/src')
-rw-r--r--subprojects/analysis-kotlin-api/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/internal/InternalKotlinAnalysisPlugin.kt2
-rw-r--r--subprojects/analysis-kotlin-api/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/internal/SampleProvider.kt30
2 files changed, 32 insertions, 0 deletions
diff --git a/subprojects/analysis-kotlin-api/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/internal/InternalKotlinAnalysisPlugin.kt b/subprojects/analysis-kotlin-api/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/internal/InternalKotlinAnalysisPlugin.kt
index 330522f3..30c2c2f8 100644
--- a/subprojects/analysis-kotlin-api/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/internal/InternalKotlinAnalysisPlugin.kt
+++ b/subprojects/analysis-kotlin-api/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/internal/InternalKotlinAnalysisPlugin.kt
@@ -26,6 +26,8 @@ class InternalKotlinAnalysisPlugin : DokkaPlugin() {
val documentableSourceLanguageParser by extensionPoint<DocumentableSourceLanguageParser>()
+ val sampleProviderFactory by extensionPoint<SampleProviderFactory>()
+
@OptIn(DokkaPluginApiPreview::class)
override fun pluginApiPreviewAcknowledgement(): PluginApiPreviewAcknowledgement = PluginApiPreviewAcknowledgement
}
diff --git a/subprojects/analysis-kotlin-api/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/internal/SampleProvider.kt b/subprojects/analysis-kotlin-api/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/internal/SampleProvider.kt
new file mode 100644
index 00000000..195f3c35
--- /dev/null
+++ b/subprojects/analysis-kotlin-api/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/internal/SampleProvider.kt
@@ -0,0 +1,30 @@
+package org.jetbrains.dokka.analysis.kotlin.internal
+
+import org.jetbrains.dokka.DokkaConfiguration
+import org.jetbrains.dokka.InternalDokkaApi
+
+@InternalDokkaApi
+interface SampleProviderFactory {
+ /**
+ * [SampleProvider] is a short-lived closeable instance.
+ * It assumes that [SampleProvider] scope of use is not big.
+ * Otherwise, it can lead to high memory consumption / leaks during Dokka running.
+ */
+ fun build(): SampleProvider
+}
+
+/**
+ * It is closeable.
+ * Otherwise, there is a chance of high memory consumption / leak.
+ * In general case, it creates a separate project to analysis samples directories.
+ */
+@InternalDokkaApi
+interface SampleProvider: AutoCloseable {
+ class SampleSnippet(val imports: String, val body:String)
+
+
+ /**
+ * @return [SampleSnippet] or null if it has not found by [fqLink]
+ */
+ fun getSample(sourceSet: DokkaConfiguration.DokkaSourceSet, fqLink: String): SampleSnippet?
+} \ No newline at end of file