-
Notifications
You must be signed in to change notification settings - Fork 30
Dokka #357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Dokka #357
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
api/** |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<#import "source_set_selector.ftl" as source_set_selector> | ||
<#macro display> | ||
<header class="navigation theme-dark" id="navigation-wrapper" role="banner"> | ||
<@template_cmd name="pathToRoot"> | ||
<a class="library-name--link" href="${pathToRoot}index.html" tabindex="1"> | ||
<@template_cmd name="projectName"> | ||
${projectName} | ||
</@template_cmd> | ||
</a> | ||
</@template_cmd> | ||
<button class="navigation-controls--btn navigation-controls--btn_toc ui-kit_mobile-only" id="toc-toggle" | ||
type="button">Toggle table of contents | ||
</button> | ||
<div class="navigation-controls--break ui-kit_mobile-only"></div> | ||
<div class="library-version" id="library-version"> | ||
<#-- This can be handled by the versioning plugin --> | ||
<@version/> | ||
</div> | ||
<div class="navigation-controls"> | ||
<@source_set_selector.display/> | ||
<#if homepageLink?has_content> | ||
<a class="navigation-controls--btn" id="homepage-link" href="${homepageLink}" | ||
style="width: fit-content; padding-left: 10px;"> | ||
<p style="color: var(--color-text-dt); font: var(--font-text-m); ">Back to docs</p> | ||
<div class="navigation-controls--btn_homepage" | ||
style=" | ||
height: 40px; | ||
width: 40px; | ||
background-color: transparent; | ||
background-repeat: no-repeat; | ||
background-position: 50% 50%; | ||
background-size: 24px 24px; | ||
"> | ||
</div> | ||
</a> | ||
</#if> | ||
<button class="navigation-controls--btn navigation-controls--btn_theme" id="theme-toggle-button" | ||
type="button">Switch theme | ||
</button> | ||
<div class="navigation-controls--btn navigation-controls--btn_search" id="searchBar" role="button">Search in | ||
API | ||
</div> | ||
</div> | ||
</header> | ||
</#macro> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
plugins { | ||
alias(libs.plugins.conventions.gradle.doctor) | ||
id("build-util") | ||
alias(libs.plugins.kotlin.jvm) | ||
} | ||
|
||
val rpcVersion: String = libs.versions.kotlinx.rpc.get() | ||
val kotlinLangVersion = libs.versions.kotlin.lang.get() | ||
|
||
group = "org.jetbrains.kotlinx" | ||
version = rpcVersion | ||
|
||
println("[Dokka Plugin] kotlinx.rpc project version: $version, Kotlin version: $kotlinLangVersion") | ||
|
||
kotlin { | ||
jvmToolchain(8) | ||
} | ||
|
||
dependencies { | ||
compileOnly(libs.dokka.core) | ||
compileOnly(libs.dokka.base) | ||
|
||
testImplementation(kotlin("test")) | ||
testImplementation(libs.dokka.base) | ||
testImplementation("org.jetbrains.dokka:dokka-test-api:${libs.versions.dokka.get()}") | ||
testImplementation("org.jetbrains.dokka:dokka-base-test-utils:${libs.versions.dokka.get()}") | ||
testImplementation("org.jetbrains.dokka:analysis-kotlin-symbols:${libs.versions.dokka.get()}") | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
rootProject.name = "dokka-rpc-plugin" | ||
|
||
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") | ||
|
||
pluginManagement { | ||
includeBuild("../gradle-conventions") | ||
includeBuild("../gradle-conventions-settings") | ||
} | ||
|
||
plugins { | ||
id("conventions-repositories") | ||
id("conventions-version-resolution") | ||
id("conventions-develocity") | ||
} |
13 changes: 13 additions & 0 deletions
13
dokka-plugin/src/main/kotlin/kotlinx/rpc/dokka/AddDocsLinkPageTransformer.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package kotlinx.rpc.dokka | ||
|
||
import org.jetbrains.dokka.pages.RootPageNode | ||
import org.jetbrains.dokka.plugability.DokkaContext | ||
import org.jetbrains.dokka.transformers.pages.PageTransformer | ||
|
||
class AddDocsLinkPageTransformer(private val context: DokkaContext) : PageTransformer { | ||
override fun invoke(input: RootPageNode): RootPageNode = input | ||
} |
31 changes: 31 additions & 0 deletions
31
dokka-plugin/src/main/kotlin/kotlinx/rpc/dokka/HideInternalRpcApiTransformer.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package kotlinx.rpc.dokka | ||
|
||
import org.jetbrains.dokka.base.DokkaBaseConfiguration | ||
import org.jetbrains.dokka.base.transformers.documentables.SuppressedByConditionDocumentableFilterTransformer | ||
import org.jetbrains.dokka.model.Annotations | ||
import org.jetbrains.dokka.model.Documentable | ||
import org.jetbrains.dokka.model.properties.WithExtraProperties | ||
import org.jetbrains.dokka.plugability.DokkaContext | ||
|
||
class HideInternalRpcApiTransformer(context: DokkaContext) : SuppressedByConditionDocumentableFilterTransformer(context) { | ||
override fun shouldBeSuppressed(d: Documentable): Boolean { | ||
DokkaBaseConfiguration | ||
val annotations: List<Annotations.Annotation> = | ||
(d as? WithExtraProperties<*>) | ||
?.extra | ||
?.allOfType<Annotations>() | ||
?.flatMap { it.directAnnotations.values.flatten() } | ||
?: emptyList() | ||
|
||
return annotations.any { isInternalRpcAnnotation(it) } | ||
} | ||
|
||
private fun isInternalRpcAnnotation(annotation: Annotations.Annotation): Boolean { | ||
return annotation.dri.packageName == "kotlinx.rpc.internal.utils" | ||
&& annotation.dri.classNames == "InternalRpcApi" | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
dokka-plugin/src/main/kotlin/kotlinx/rpc/dokka/RpcDokkaPlugin.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package kotlinx.rpc.dokka | ||
|
||
import org.jetbrains.dokka.CoreExtensions | ||
import org.jetbrains.dokka.base.DokkaBase | ||
import org.jetbrains.dokka.plugability.DokkaPlugin | ||
import org.jetbrains.dokka.plugability.DokkaPluginApiPreview | ||
import org.jetbrains.dokka.plugability.PluginApiPreviewAcknowledgement | ||
|
||
@Suppress("unused") | ||
class RpcDokkaPlugin : DokkaPlugin() { | ||
@OptIn(DokkaPluginApiPreview::class) | ||
override fun pluginApiPreviewAcknowledgement() = PluginApiPreviewAcknowledgement | ||
|
||
val rpcInternalApiTransformer by extending { | ||
plugin<DokkaBase>().preMergeDocumentableTransformer providing ::HideInternalRpcApiTransformer | ||
} | ||
|
||
val pageTransformer by extending { | ||
CoreExtensions.pageTransformer providing ::AddDocsLinkPageTransformer | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
...a-plugin/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# | ||
# Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. | ||
# | ||
|
||
kotlinx.rpc.dokka.RpcDokkaPlugin |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please drop comments