Skip to content

Commit c7e7f74

Browse files
authored
Merge pull request #31 from appdevforall/fix/ADFA-5296
ADFA-5296: Javadoc mode for kdoc-to-json, JDK API docs as JSON, and a Pebble HTML renderer
2 parents 286a368 + 7e43f93 commit c7e7f74

74 files changed

Lines changed: 10593 additions & 41 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/build-java-docs-local.yaml‎

Lines changed: 477 additions & 0 deletions
Large diffs are not rendered by default.

‎.github/workflows/build-java-docs.yaml‎

Lines changed: 592 additions & 0 deletions
Large diffs are not rendered by default.

‎Dokka-plugin-kdoc2json/README.md‎

Lines changed: 360 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import org.jetbrains.dokka.gradle.engine.parameters.VisibilityModifier
2+
import org.jetbrains.dokka.InternalDokkaApi
3+
import org.jetbrains.dokka.gradle.engine.plugins.DokkaPluginParametersBaseSpec
4+
import javax.inject.Inject
5+
6+
// A Java-only sibling of examples/example-data-processor, used by tests/test_javadoc_mode.sh.
7+
// Javadoc mode mirrors the output of the `javadoc` tool, so it needs Java sources exercising the
8+
// constructs a javadoc page actually has sections for: generic interfaces and their implementors,
9+
// an abstract base class, an enum, an annotation type, a checked exception, nested types,
10+
// compile-time constants, deprecation, and the full set of javadoc block tags.
11+
plugins {
12+
java
13+
// Must match the dokka-core/dokka-base version kdoc-to-json was compiled against.
14+
id("org.jetbrains.dokka") version "2.2.0-Beta"
15+
}
16+
17+
repositories {
18+
// Lets Gradle find the locally published kdoc-to-json plugin.
19+
mavenLocal()
20+
mavenCentral()
21+
}
22+
23+
dependencies {
24+
dokkaPlugin("org.appdevforall.dokka:kdoc-to-json:1.0.0-SNAPSHOT")
25+
}
26+
27+
@OptIn(InternalDokkaApi::class)
28+
abstract class JsonOutputPluginParameters @Inject constructor(
29+
name: String
30+
) : DokkaPluginParametersBaseSpec(name, "org.appdevforall.dokka.kdoc2json.JsonOutputPlugin") {
31+
// As in example-data-processor: point KDOC2JSON_TEST_CONFIG at a JSON file to drive this
32+
// project through an arbitrary plugin config without editing this build script.
33+
override fun jsonEncode(): String {
34+
val overridePath = System.getenv("KDOC2JSON_TEST_CONFIG")
35+
if (overridePath != null) {
36+
return File(overridePath).readText()
37+
}
38+
return """{
39+
"logLevel": "debug",
40+
"javadoc-mode": true,
41+
"prettyPrint": true
42+
}"""
43+
}
44+
}
45+
46+
dokka {
47+
dokkaSourceSets.configureEach {
48+
// javadoc documents public *and* protected members by default; Dokka documents only
49+
// public. Without this, Javadoc mode would silently omit every protected member that a
50+
// real javadoc build would have shown.
51+
documentedVisibilities.set(setOf(VisibilityModifier.Public, VisibilityModifier.Protected))
52+
}
53+
54+
pluginsConfiguration {
55+
registerBinding(JsonOutputPluginParameters::class, JsonOutputPluginParameters::class)
56+
register<JsonOutputPluginParameters>("org.appdevforall.dokka.kdoc2json.JsonOutputPlugin") { }
57+
}
58+
}
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
4+
networkTimeout=10000
5+
retries=0
6+
retryBackOffMs=500
7+
validateDistributionUrl=true
8+
zipStoreBase=GRADLE_USER_HOME
9+
zipStorePath=wrapper/dists

‎Dokka-plugin-kdoc2json/examples/example-java-library/gradlew‎

Lines changed: 248 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)