Provide a way to manually create SampleAnalysisEnvironment #3573
Labels
feedback: Google
An issue/PR submitted by colleagues at Google, most likely related to the Android API reference docs
language: Kotlin
Issue/PR related to the Kotlin language feature/analysis/docs
Context
The API introduced for analyzing samples in #3195 does not fit Dackka (Google's plugin) well: Dokka works through processing batches of documentables in a pipeline, but Dackka has more of a service-like architecture, where it can invoke sample resolution from later stages.
Problem
Invoking
SampleAnalysisEnvironmentCreator#use
for every resolution request in Dackka leads to stalling and other problems. Refactoring the architecture to batch sample resolution is also tricky.Solution
The following API was discussed with Google, and tested on Dackka, which seems to work and solve the problem stated above.
SampleAnalysisEnvironment
closeable (java.io.Closeable
).public fun create(): SampleAnalysisEnvironment
toSampleAnalysisEnvironmentCreator
The commit that has these changes: 2b6eb92 (sample-analysis-manual branch)
In order to merge these changes in, the following needs to be done:
SampleAnalysisEnvironmentCreator#create
, stating that:#use
, because it can lead to memory leaks, concurrency issues or other unexpected problems, whereasuse
has a controlled environment.SampleAnalysisEnvironment
that is created should be closed by the user manually, otherwise it may lead to leaks@DelicateDokkaApi
should be added, similar to DelicateCoroutinesApi.Other
The branch sample-analysis-manual may be revived, although it's not a requirement - a new branch can be created.
The text was updated successfully, but these errors were encountered: