Skip to content

Commit 5e1e4ec

Browse files
committed
Render kotlin-reflect library documentation in a separate module
(cherry picked from commit ba6732a)
1 parent 442f3f8 commit 5e1e4ec

File tree

3 files changed

+69
-5
lines changed

3 files changed

+69
-5
lines changed

libraries/reflect/Module.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Module kotlin-reflect
2+
3+
## Kotlin JVM reflection extensions
4+
5+
The library provides the runtime component that enables full support of the reflection features in `kotlin.reflect` package
6+
and extensions for the reflection types.
7+
8+
It's provided as an optional artifact separate from the standard library to reduce the required size of the runtime dependencies
9+
for applications that do not use reflection features.
10+
11+
# Package kotlin.reflect.full
12+
13+
Extensions for [Kotlin reflection](https://kotlinlang.org/docs/reference/reflection.html) types like [kotlin.reflect.KClass], [kotlin.reflect.KType], and others.
14+
15+
# Package kotlin.reflect.jvm
16+
17+
Extensions for conversion between [Kotlin reflection](https://kotlinlang.org/docs/reference/reflection.html) and
18+
Java reflection types and other JVM-specific extensions.

libraries/tools/kotlin-stdlib-docs/build.gradle.kts

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ fun createStdLibVersionedDocTask(version: String, isLatest: Boolean) =
6464
"kotlin.native.internal",
6565
"kotlin.jvm.functions",
6666
"kotlin.coroutines.jvm.internal",
67-
"kotlin.reflect.jvm.internal"
6867
)
6968

7069
var kotlinLanguageVersion = version
@@ -114,7 +113,6 @@ fun createStdLibVersionedDocTask(version: String, isLatest: Boolean) =
114113

115114
sourceRoots.from("$kotlin_stdlib_dir/jvm/src")
116115

117-
sourceRoots.from("$kotlin_root/core/reflection.jvm/src")
118116
sourceRoots.from("$kotlin_stdlib_dir/jvm/runtime/kotlin/jvm/annotations")
119117
sourceRoots.from("$kotlin_stdlib_dir/jvm/runtime/kotlin/jvm/JvmClassMapping.kt")
120118
sourceRoots.from("$kotlin_stdlib_dir/jvm/runtime/kotlin/jvm/PurelyImplements.kt")
@@ -220,6 +218,51 @@ fun createStdLibVersionedDocTask(version: String, isLatest: Boolean) =
220218
}
221219
}
222220

221+
fun createKotlinReflectVersionedDocTask(version: String, isLatest: Boolean) =
222+
tasks.register<DokkaTaskPartial>("kotlin-reflect_" + version + (if (isLatest) "_latest" else "")) {
223+
dependsOn(prepare)
224+
225+
val kotlinReflectIncludeMd = file("$kotlin_root/libraries/reflect/Module.md")
226+
227+
val kotlinReflectClasspath = fileTree("$kotlin_libs/kotlin-reflect")
228+
229+
val kotlinLanguageVersion = version
230+
231+
moduleName.set("kotlin-reflect")
232+
233+
val moduleDirName = "kotlin-reflect"
234+
with(pluginsMapConfiguration) {
235+
put("org.jetbrains.dokka.base.DokkaBase", """{ "templatesDir": "$templatesDir" }""")
236+
put("org.jetbrains.dokka.versioning.VersioningPlugin", """{ "version": "$version" }""")
237+
}
238+
if (isLatest) {
239+
outputDirectory.set(file("$outputDirPartial/latest").resolve(moduleDirName))
240+
} else {
241+
outputDirectory.set(file("$outputDirPartial/previous").resolve(moduleDirName).resolve(version))
242+
pluginsMapConfiguration.put("org.jetbrains.dokka.kotlinlang.VersionFilterPlugin", """{ "targetVersion": "$version" }""")
243+
}
244+
245+
dokkaSourceSets {
246+
register("jvm") {
247+
jdkVersion.set(8)
248+
platform.set(Platform.jvm)
249+
classpath.setFrom(kotlinReflectClasspath)
250+
251+
displayName.set("JVM")
252+
sourceRoots.from("$kotlin_root/core/reflection.jvm/src")
253+
254+
skipDeprecated.set(false)
255+
includes.from(kotlinReflectIncludeMd)
256+
languageVersion.set(kotlinLanguageVersion)
257+
noStdlibLink.set(true)
258+
perPackageOption("kotlin.reflect.jvm.internal") {
259+
suppress.set(true)
260+
}
261+
sourceLinksFromRoot()
262+
}
263+
}
264+
}
265+
223266
fun createKotlinTestVersionedDocTask(version: String, isLatest: Boolean) =
224267
tasks.register<DokkaTaskPartial>("kotlin-test_" + version + (if (isLatest) "_latest" else "")) {
225268
dependsOn(prepare)
@@ -413,15 +456,17 @@ gradle.projectsEvaluated {
413456
val buildLatestVersion by tasks.registering
414457

415458
val latestStdlib = createStdLibVersionedDocTask(latestVersion, true)
459+
val latestReflect = createKotlinReflectVersionedDocTask(latestVersion, true)
416460
val latestTest = createKotlinTestVersionedDocTask(latestVersion, true)
417-
val latestAll = createAllLibsVersionedDocTask(latestVersion, true, latestStdlib, latestTest)
461+
val latestAll = createAllLibsVersionedDocTask(latestVersion, true, latestStdlib, latestReflect, latestTest)
418462

419-
buildLatestVersion.configure { dependsOn(latestStdlib, latestTest, latestAll) }
463+
buildLatestVersion.configure { dependsOn(latestStdlib, latestTest, latestReflect, latestAll) }
420464

421465
versions.forEach { version ->
422466
val versionStdlib = createStdLibVersionedDocTask(version, false)
467+
val versionReflect = createKotlinReflectVersionedDocTask(version, false)
423468
val versionTest = createKotlinTestVersionedDocTask(version, false)
424-
val versionAll = createAllLibsVersionedDocTask(version, isLatest = false, versionStdlib, versionTest)
469+
val versionAll = createAllLibsVersionedDocTask(version, isLatest = false, versionStdlib, versionReflect, versionTest)
425470
if (version != latestVersion) {
426471
latestAll.configure { dependsOn(versionAll) }
427472
}

libraries/tools/kotlin-stdlib-docs/kotlin_big/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ val modules = listOf(
3434
"kotlin-stdlib-jdk7",
3535
"kotlin-stdlib-jdk8",
3636
"kotlin-stdlib-js",
37+
"kotlin-reflect",
3738
"kotlin-test",
3839
"kotlin-test-js",
3940
"kotlin-test-junit5",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy