blob: 36da34dc07d1feef5454760810f400a59ec8542a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/*
* Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
package org.jetbrains.dokka.kotlinAsJava
import org.jetbrains.dokka.CoreExtensions
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.signatures.SignatureProvider
import org.jetbrains.dokka.kotlinAsJava.signatures.JavaSignatureProvider
import org.jetbrains.dokka.kotlinAsJava.transformers.JvmNameDocumentableTransformer
import org.jetbrains.dokka.kotlinAsJava.transformers.KotlinAsJavaDocumentableTransformer
import org.jetbrains.dokka.kotlinAsJava.translators.KotlinAsJavaDocumentableToPageTranslator
import org.jetbrains.dokka.plugability.DokkaPlugin
import org.jetbrains.dokka.plugability.DokkaPluginApiPreview
import org.jetbrains.dokka.plugability.Extension
import org.jetbrains.dokka.plugability.PluginApiPreviewAcknowledgement
import org.jetbrains.dokka.renderers.PostAction
import org.jetbrains.dokka.transformers.documentation.DocumentableToPageTranslator
import org.jetbrains.dokka.transformers.documentation.DocumentableTransformer
public class KotlinAsJavaPlugin : DokkaPlugin() {
public val kotlinAsJavaDocumentableTransformer: Extension<DocumentableTransformer, *, *> by extending {
CoreExtensions.documentableTransformer with KotlinAsJavaDocumentableTransformer()
}
public val jvmNameTransformer: Extension<DocumentableTransformer, *, *> by extending {
CoreExtensions.documentableTransformer with JvmNameDocumentableTransformer() order {
after(kotlinAsJavaDocumentableTransformer)
}
}
public val javaSignatureProvider: Extension<SignatureProvider, *, *> by extending {
with(plugin<DokkaBase>()) {
signatureProvider providing ::JavaSignatureProvider override kotlinSignatureProvider
}
}
public val kotlinAsJavaDocumentableToPageTranslator: Extension<DocumentableToPageTranslator, *, *> by extending {
CoreExtensions.documentableToPageTranslator providing ::KotlinAsJavaDocumentableToPageTranslator override
plugin<DokkaBase>().documentableToPageTranslator
}
internal val alphaVersionNotifier by extending {
CoreExtensions.postActions providing { ctx ->
PostAction {
ctx.logger.info("KotlinAsJava plugin is in Alpha version, use at your own risk, expect bugs and migration issues")
}
}
}
@OptIn(DokkaPluginApiPreview::class)
override fun pluginApiPreviewAcknowledgement(): PluginApiPreviewAcknowledgement =
PluginApiPreviewAcknowledgement
}
|