Skip to content

Commit

Permalink
Add KDoc and a condition for disposing of AA
Browse files Browse the repository at this point in the history
  • Loading branch information
vmishenev committed Nov 19, 2024
1 parent 70a4bcc commit 83e35b1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ public class JavaAnalysisPlugin : DokkaPlugin() {
DocCommentFinder(logger, docCommentFactory)
}

/**
* Disposes global resources which would persist after unloading Analysis API (Symbols analysis) and IJ platform classes.
*
* **Important:** Once this function has been called, Analysis API *and* IntelliJ platform classes should not be used anymore. The classes
* should either be unloaded or the whole program should be shut down.
*
* Note: Disposing of resources, including threads, allows unloading Dokka's class loader.
*/
@InternalDokkaApi
public fun disposeGlobalStandaloneApplicationServices() {
@Suppress("UnstableApiUsage")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ import org.jetbrains.dokka.analysis.kotlin.symbols.services.*
import org.jetbrains.dokka.analysis.kotlin.symbols.services.KotlinDocumentableSourceLanguageParser
import org.jetbrains.dokka.analysis.kotlin.symbols.services.SymbolExternalDocumentablesProvider
import org.jetbrains.dokka.analysis.kotlin.symbols.translators.DefaultSymbolToDocumentableTranslator
import org.jetbrains.dokka.plugability.DokkaPlugin
import org.jetbrains.dokka.plugability.DokkaPluginApiPreview
import org.jetbrains.dokka.plugability.PluginApiPreviewAcknowledgement
import org.jetbrains.dokka.plugability.querySingle
import org.jetbrains.dokka.plugability.*
import org.jetbrains.dokka.renderers.PostAction
import org.jetbrains.kotlin.asJava.elements.KtLightAbstractAnnotation

Expand All @@ -42,9 +39,12 @@ public class SymbolsAnalysisPlugin : DokkaPlugin() {
}

internal val disposeKotlinAnalysisPostAction by extending {
CoreExtensions.postActions with PostAction {
querySingle { kotlinAnalysis }.close()
javaAnalysisPlugin.disposeGlobalStandaloneApplicationServices()
CoreExtensions.postActions providing { context ->
PostAction {
querySingle { kotlinAnalysis }.close()
if (context.configuration.finalizeCoroutines)
javaAnalysisPlugin.disposeGlobalStandaloneApplicationServices()
}
}
}

Expand Down

0 comments on commit 83e35b1

Please sign in to comment.