diff options
author | Vadim Mishenev <vad-mishenev@yandex.ru> | 2023-08-28 19:42:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-28 19:42:21 +0300 |
commit | 0e00edc6fcd406fcf38673ef6a2f8f59e8374de2 (patch) | |
tree | 697b0de0d44b421c922f1f5e6a7c1352f17c68a6 /plugins/base/src/test/kotlin/utils | |
parent | bec2cac91726e52884329e7997207e9777abaab7 (diff) | |
download | dokka-0e00edc6fcd406fcf38673ef6a2f8f59e8374de2.tar.gz dokka-0e00edc6fcd406fcf38673ef6a2f8f59e8374de2.tar.bz2 dokka-0e00edc6fcd406fcf38673ef6a2f8f59e8374de2.zip |
Support Dokka K2 analysis (#3094)
Dokka has its own documentable model to represent analyzed code. The analysis is performed by a compiler frontend.
In K1 the compiler frontend has descriptors that use the underlying Binding Context (global shared stateful structure). Dokka just maps descriptors to Documentable by DefaultDescriptorToDocumentableTranslator.
K2 compiler has FIR tree, which means “Frontend Intermediate Representation”, instead of Binding Context. But we do not use FIR in Dokka directly, since it is too low-level for analysis. The Kotlin compiler provides high-level Analysis API for this case. The API is used by KSP too. Analysis API represent elements of FIR (declarations, parameters and so on) as Symbols. For more details see KtSymbolByFirBuilder, KtSymbol.
For Dokka symbol is the replacement of descriptor in K2.
Also, to set up the environment of project analysis in K1 we use idea dependencies (or copy-past from there). In K2 for these aims, there is a Standalone mode for Analysis API.
Diffstat (limited to 'plugins/base/src/test/kotlin/utils')
-rw-r--r-- | plugins/base/src/test/kotlin/utils/TagsAnnotations.kt | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/plugins/base/src/test/kotlin/utils/TagsAnnotations.kt b/plugins/base/src/test/kotlin/utils/TagsAnnotations.kt new file mode 100644 index 00000000..181d1f1d --- /dev/null +++ b/plugins/base/src/test/kotlin/utils/TagsAnnotations.kt @@ -0,0 +1,71 @@ +package utils + +import org.junit.jupiter.api.Tag + + +/** + * Run a test only for descriptors, not symbols. + * + * In theory, these tests can be fixed + */ +@Target( + AnnotationTarget.CLASS, + AnnotationTarget.FUNCTION, + AnnotationTarget.PROPERTY_GETTER, + AnnotationTarget.PROPERTY_SETTER +) +@Retention( + AnnotationRetention.RUNTIME +) +@Tag("onlyDescriptors") +annotation class OnlyDescriptors(val reason: String = "") + +/** + * Run a test only for descriptors, not symbols. + * + * These tests cannot be fixed until Analysis API does not support MPP + */ +@Target( + AnnotationTarget.CLASS, + AnnotationTarget.FUNCTION, + AnnotationTarget.PROPERTY_GETTER, + AnnotationTarget.PROPERTY_SETTER +) +@Retention( + AnnotationRetention.RUNTIME +) +@Tag("onlyDescriptorsMPP") +annotation class OnlyDescriptorsMPP(val reason: String = "") + + +/** + * For test containing .java code + * These tests are disabled in K2 due to Standlone prototype. https://github.com/Kotlin/dokka/issues/3114 + */ +@Target( + AnnotationTarget.CLASS, + AnnotationTarget.FUNCTION, + AnnotationTarget.PROPERTY_GETTER, + AnnotationTarget.PROPERTY_SETTER +) +@Retention( + AnnotationRetention.RUNTIME +) +@Tag("javaCode") +annotation class JavaCode + +/** + * For Kotlin test using JDK + * These tests are disabled in K2 due to Standlone prototype. https://github.com/Kotlin/dokka/issues/3114 + */ +@Target( + AnnotationTarget.CLASS, + AnnotationTarget.FUNCTION, + AnnotationTarget.PROPERTY_GETTER, + AnnotationTarget.PROPERTY_SETTER +) +@Retention( + AnnotationRetention.RUNTIME +) +@Tag("usingJDK") +annotation class UsingJDK
\ No newline at end of file |