Setup project for docs build with new Dokka
- Update Dokka to 1.6.20-M1 - Update Dokka to 1.6.20 - Update Dokka to 1.7.0-dev - Update Dokka to 1.7.20-dev-187 Co-authored-by: ilya.gorbunov@jetbrains.com
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
kotlin-stdlib-docs
|
||||
===================
|
||||
|
||||
API documentation build for kotlin-stdlib, kotlin-reflect, and kotlin-test libraries for
|
||||
kotlinlang.org web-site.
|
||||
|
||||
|
||||
@@ -0,0 +1,593 @@
|
||||
import org.jetbrains.dokka.Platform
|
||||
import org.jetbrains.dokka.DokkaConfiguration
|
||||
|
||||
plugins {
|
||||
id "de.undercouch.download" version "4.1.1"
|
||||
id "base"
|
||||
id "java"
|
||||
id "org.jetbrains.dokka"
|
||||
}
|
||||
|
||||
evaluationDependsOnChildren()
|
||||
|
||||
def pKotlinBig() { return project('kotlin_big').extensions }
|
||||
def pKotlinNative() { return project('kotlin_native').extensions }
|
||||
|
||||
task extractAll()
|
||||
|
||||
extractAll.dependsOn ':kotlin_big:extractLibs'
|
||||
|
||||
def outputDir = "$buildDir/doc"
|
||||
|
||||
|
||||
task callDokka() {
|
||||
delete(outputDir)
|
||||
dependsOn extractAll
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url 'https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev'
|
||||
}
|
||||
}
|
||||
final String dokka_version = findProperty("dokka_version")
|
||||
|
||||
dependencies {
|
||||
dokkaPlugin project(":plugins:dokka-samples-transformer-plugin")
|
||||
dokkaPlugin project(":plugins:dokka-stdlib-configuration-plugin")
|
||||
dokkaPlugin project(":plugins:dokka-version-filter-plugin")
|
||||
dokkaPlugin "org.jetbrains.dokka:versioning-plugin:$dokka_version"
|
||||
}
|
||||
|
||||
void createStdLibVersionedDocTask(String version, Boolean isLatest) {
|
||||
tasks.register("stdlib_" + version, org.jetbrains.dokka.gradle.DokkaTask) {
|
||||
def outputDir = "$buildDir/doc"
|
||||
|
||||
def github_revision = pKotlinBig().github_revision
|
||||
|
||||
def kotlin_root = pKotlinBig().kotlin_root
|
||||
def kotlin_libs = pKotlinBig().kotlin_libs
|
||||
def kotlin_native_root = pKotlinNative().kotlin_native_root
|
||||
def kotlin_native_libs = pKotlinNative().kotlin_native_libs
|
||||
|
||||
def kotlin_stdlib_dir = "$kotlin_root/libraries/stdlib"
|
||||
|
||||
def stdlibIncludeMd = "$kotlin_root/libraries/stdlib/src/Module.md"
|
||||
def stdlibSamples = "$kotlin_root/libraries/stdlib/samples/test"
|
||||
|
||||
def stdlibCommonClasspath = ["$kotlin_libs/kotlin-stdlib-common/".toString()]
|
||||
def stdlibJvmClasspath = ["$kotlin_libs/kotlin-stdlib/".toString(), "$kotlin_stdlib_dir/jdk7/src".toString(), "$kotlin_libs/kotlin-stdlib-jdk8/".toString(), "$kotlin_root/core/reflection.jvm/src".toString()]
|
||||
def stdlibNativeClasspath = ["$kotlin_native_libs/klib/common/stdlib".toString()]
|
||||
def stdlibJsClasspath = ["$kotlin_libs/kotlin-stdlib-js/".toString()]
|
||||
|
||||
def kotlinLanguageVersion = version
|
||||
if (version == "1.0")
|
||||
kotlinLanguageVersion = "1.1"
|
||||
|
||||
|
||||
moduleName.set("stdlib")
|
||||
if (isLatest) {
|
||||
outputDirectory.set(new File(outputDir, "/kotlin-stdlib/latest"))
|
||||
pluginsMapConfiguration.set(["org.jetbrains.dokka.base.DokkaBase" : """{ "mergeImplicitExpectActualDeclarations": "true", "templatesDir": "${projectDir.toString().replace('\\', '/')}/templates" }""",
|
||||
"org.jetbrains.dokka.versioning.VersioningPlugin": """{ "version": "$version", "olderVersionsDir": "${outputDir.toString().replace('\\', '/')}//kotlin-stdlib/old" }"""])
|
||||
} else {
|
||||
outputDirectory.set(new File(outputDir, "/kotlin-stdlib/old/" + version))
|
||||
pluginsMapConfiguration.set(["org.jetbrains.dokka.base.DokkaBase" : """{ "mergeImplicitExpectActualDeclarations": "true", "templatesDir": "${projectDir.toString().replace('\\', '/')}/templates" }""",
|
||||
"org.jetbrains.dokka.kotlinlang.VersionFilterPlugin": """{ "targetVersion": "$version" }""",
|
||||
"org.jetbrains.dokka.versioning.VersioningPlugin" : """{ "version": "$version" }"""])
|
||||
}
|
||||
dokkaSourceSets {
|
||||
if (version != "1.0" && version != "1.1") { // Common platform since Kotlin 1.2
|
||||
register("kotlin-stdlib-common") {
|
||||
documentedVisibilities.set([DokkaConfiguration.Visibility.PUBLIC, DokkaConfiguration.Visibility.PROTECTED])
|
||||
skipDeprecated.set(false)
|
||||
jdkVersion.set(8)
|
||||
platform.set(Platform.common)
|
||||
includes.from(stdlibIncludeMd.toString())
|
||||
noStdlibLink.set(true)
|
||||
noJdkLink.set(true)
|
||||
classpath.setFrom(stdlibCommonClasspath)
|
||||
languageVersion.set(kotlinLanguageVersion)
|
||||
|
||||
samples.from(stdlibSamples.toString())
|
||||
displayName.set("Common")
|
||||
sourceRoots.from("$kotlin_root/core/builtins/native")
|
||||
sourceRoots.from("$kotlin_root/core/builtins/src/")
|
||||
|
||||
sourceRoots.from("$kotlin_stdlib_dir/common/src")
|
||||
sourceRoots.from("$kotlin_stdlib_dir/src")
|
||||
sourceRoots.from("$kotlin_stdlib_dir/unsigned/src")
|
||||
sourceLink {
|
||||
localDirectory.set(file(kotlin_root))
|
||||
remoteUrl.set(new URL("https://github.com/JetBrains/kotlin/tree/$github_revision"))
|
||||
remoteLineSuffix.set("#L")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
register("kotlin-stdlib-java-common") {
|
||||
documentedVisibilities.set([DokkaConfiguration.Visibility.PUBLIC, DokkaConfiguration.Visibility.PROTECTED])
|
||||
skipDeprecated.set(false)
|
||||
jdkVersion.set(8)
|
||||
platform.set(Platform.jvm)
|
||||
includes.from(stdlibIncludeMd.toString())
|
||||
noStdlibLink.set(true)
|
||||
classpath.setFrom(stdlibJvmClasspath)
|
||||
languageVersion.set(kotlinLanguageVersion)
|
||||
|
||||
samples.from(stdlibSamples.toString())
|
||||
displayName.set("JVM")
|
||||
if (version != "1.0" && version != "1.1") {
|
||||
dependsOn("kotlin-stdlib-common")
|
||||
}
|
||||
//sourceRoots.from("$kotlin_root/core/builtins/native")
|
||||
//sourceRoots.from("$kotlin_root/core/builtins/src")
|
||||
|
||||
sourceRoots.from("$kotlin_stdlib_dir/jvm/src")
|
||||
|
||||
sourceRoots.from("$kotlin_root/core/reflection.jvm/src")
|
||||
sourceRoots.from("$kotlin_stdlib_dir/jvm/runtime/kotlin/jvm/annotations")
|
||||
sourceRoots.from("$kotlin_stdlib_dir/jvm/runtime/kotlin/jvm/JvmClassMapping.kt")
|
||||
sourceRoots.from("$kotlin_stdlib_dir/jvm/runtime/kotlin/jvm/PurelyImplements.kt")
|
||||
sourceRoots.from("$kotlin_stdlib_dir/jvm/runtime/kotlin/TypeAliases.kt")
|
||||
sourceRoots.from("$kotlin_stdlib_dir/jvm/runtime/kotlin/text/TypeAliases.kt")
|
||||
|
||||
// for Kotlin 1.0 and 1.1 hack: Common platform becomes JVM
|
||||
if (version == "1.0" || version == "1.1") {
|
||||
sourceRoots.from("$kotlin_root/core/builtins/native")
|
||||
sourceRoots.from("$kotlin_root/core/builtins/src/")
|
||||
|
||||
sourceRoots.from("$kotlin_stdlib_dir/common/src")
|
||||
sourceRoots.from("$kotlin_stdlib_dir/src")
|
||||
sourceRoots.from("$kotlin_stdlib_dir/unsigned/src")
|
||||
}
|
||||
perPackageOption {
|
||||
matchingRegex.set("kotlin.reflect.jvm.internal(\$|\\.).*")
|
||||
suppress.set(true)
|
||||
}
|
||||
perPackageOption {
|
||||
matchingRegex.set("kotlin.jvm.functions(\$|\\.).*")
|
||||
suppress.set(true)
|
||||
}
|
||||
perPackageOption {
|
||||
matchingRegex.set("kotlin.jvm.internal(\$|\\.).*")
|
||||
suppress.set(true)
|
||||
}
|
||||
perPackageOption {
|
||||
matchingRegex.set("kotlin.coroutines.jvm.internal(\$|\\.).*")
|
||||
suppress.set(true)
|
||||
}
|
||||
perPackageOption {
|
||||
matchingRegex.set("kotlin.coroutines.experimental.migration(\$|\\.).*")
|
||||
suppress.set(true)
|
||||
}
|
||||
sourceLink {
|
||||
localDirectory.set(file(kotlin_root))
|
||||
remoteUrl.set(new URL("https://github.com/JetBrains/kotlin/tree/$github_revision"))
|
||||
remoteLineSuffix.set("#L")
|
||||
}
|
||||
}
|
||||
register("kotlin-stdlib-jdk8") {
|
||||
documentedVisibilities.set([DokkaConfiguration.Visibility.PUBLIC, DokkaConfiguration.Visibility.PROTECTED])
|
||||
skipDeprecated.set(false)
|
||||
jdkVersion.set(8)
|
||||
platform.set(Platform.jvm)
|
||||
includes.from(stdlibIncludeMd.toString())
|
||||
noStdlibLink.set(true)
|
||||
classpath.setFrom(stdlibJvmClasspath)
|
||||
languageVersion.set(kotlinLanguageVersion)
|
||||
|
||||
samples.from(stdlibSamples.toString())
|
||||
displayName.set("JRE8")
|
||||
dependsOn("kotlin-stdlib-java-common")
|
||||
if (version != "1.0" && version != "1.1") {
|
||||
dependsOn("kotlin-stdlib-common")
|
||||
}
|
||||
sourceRoots.from("$kotlin_stdlib_dir/jdk8/src")
|
||||
perPackageOption {
|
||||
matchingRegex.set("kotlin.reflect.jvm.internal")
|
||||
suppress.set(true)
|
||||
}
|
||||
perPackageOption {
|
||||
matchingRegex.set("kotlin.jvm.functions(\$|\\.).*")
|
||||
suppress.set(true)
|
||||
}
|
||||
perPackageOption {
|
||||
matchingRegex.set("kotlin.jvm.internal(\$|\\.).*")
|
||||
suppress.set(true)
|
||||
}
|
||||
perPackageOption {
|
||||
matchingRegex.set("kotlin.coroutines.jvm.internal(\$|\\.).*")
|
||||
suppress.set(true)
|
||||
}
|
||||
perPackageOption {
|
||||
matchingRegex.set("kotlin.coroutines.experimental.migration(\$|\\.).*")
|
||||
suppress.set(true)
|
||||
}
|
||||
sourceLink {
|
||||
localDirectory.set(file(kotlin_root))
|
||||
remoteUrl.set(new URL("https://github.com/JetBrains/kotlin/tree/$github_revision"))
|
||||
remoteLineSuffix.set("#L")
|
||||
}
|
||||
}
|
||||
register("kotlin-stdlib-jdk7") {
|
||||
documentedVisibilities.set([DokkaConfiguration.Visibility.PUBLIC, DokkaConfiguration.Visibility.PROTECTED])
|
||||
skipDeprecated.set(false)
|
||||
jdkVersion.set(8)
|
||||
platform.set(Platform.jvm)
|
||||
includes.from(stdlibIncludeMd.toString())
|
||||
noStdlibLink.set(true)
|
||||
classpath.setFrom(stdlibJvmClasspath)
|
||||
languageVersion.set(kotlinLanguageVersion)
|
||||
|
||||
|
||||
samples.from(stdlibSamples.toString())
|
||||
displayName.set("JRE7")
|
||||
dependsOn("kotlin-stdlib-java-common")
|
||||
if (version != "1.0" && version != "1.1") {
|
||||
dependsOn("kotlin-stdlib-common")
|
||||
}
|
||||
sourceRoots.from("$kotlin_stdlib_dir/jdk7/src")
|
||||
perPackageOption {
|
||||
matchingRegex.set("kotlin.reflect.jvm.internal(\$|\\.).*")
|
||||
suppress.set(true)
|
||||
}
|
||||
perPackageOption {
|
||||
matchingRegex.set("kotlin.jvm.functions(\$|\\.).*")
|
||||
suppress.set(true)
|
||||
}
|
||||
perPackageOption {
|
||||
matchingRegex.set("kotlin.jvm.internal(\$|\\.).*")
|
||||
suppress.set(true)
|
||||
}
|
||||
perPackageOption {
|
||||
matchingRegex.set("kotlin.coroutines.jvm.internal(\$|\\.).*")
|
||||
suppress.set(true)
|
||||
}
|
||||
perPackageOption {
|
||||
matchingRegex.set("kotlin.coroutines.experimental.migration(\$|\\.).*")
|
||||
suppress.set(true)
|
||||
}
|
||||
sourceLink {
|
||||
localDirectory.set(file(kotlin_root))
|
||||
remoteUrl.set(new URL("https://github.com/JetBrains/kotlin/tree/$github_revision"))
|
||||
remoteLineSuffix.set("#L")
|
||||
}
|
||||
}
|
||||
if (version != "1.0") { // JS platform since Kotlin 1.1
|
||||
register("kotlin-stdlib-js") {
|
||||
documentedVisibilities.set([DokkaConfiguration.Visibility.PUBLIC, DokkaConfiguration.Visibility.PROTECTED])
|
||||
skipDeprecated.set(false)
|
||||
jdkVersion.set(8)
|
||||
platform.set(Platform.js)
|
||||
includes.from(stdlibIncludeMd.toString())
|
||||
noStdlibLink.set(true)
|
||||
noJdkLink.set(true)
|
||||
classpath.setFrom(stdlibJsClasspath)
|
||||
languageVersion.set(kotlinLanguageVersion)
|
||||
|
||||
samples.from(stdlibSamples.toString())
|
||||
displayName.set("JS")
|
||||
if (version != "1.0" && version != "1.1") {
|
||||
dependsOn("kotlin-stdlib-common")
|
||||
}
|
||||
//sourceRoots.from("$kotlin_root/core/builtins/native")
|
||||
//sourceRoots.from("$kotlin_root/core/builtins/src")
|
||||
|
||||
sourceRoots.from("$kotlin_stdlib_dir/js/src")
|
||||
sourceRoots.from("$kotlin_stdlib_dir/js-v1/src")
|
||||
|
||||
// for Kotlin 1.1 hack: Common platform becomes JVM
|
||||
if (version == "1.1") {
|
||||
sourceRoots.from("$kotlin_root/core/builtins/native")
|
||||
sourceRoots.from("$kotlin_root/core/builtins/src/")
|
||||
|
||||
//sourceRoots.from("$kotlin_stdlib_dir/common/src") // is included in /js-v1/src folder
|
||||
sourceRoots.from("$kotlin_stdlib_dir/src")
|
||||
sourceRoots.from("$kotlin_stdlib_dir/unsigned/src")
|
||||
}
|
||||
|
||||
perPackageOption {
|
||||
matchingRegex.set("org.w3c(\$|\\.).*")
|
||||
reportUndocumented.set(false)
|
||||
}
|
||||
perPackageOption {
|
||||
matchingRegex.set("org.khronos(\$|\\.).*")
|
||||
reportUndocumented.set(false)
|
||||
}
|
||||
perPackageOption {
|
||||
matchingRegex.set("jquery(\$|\\.).*")
|
||||
suppress.set(true)
|
||||
}
|
||||
perPackageOption {
|
||||
matchingRegex.set("kotlin.reflect.jvm.internal(\$|\\.).*")
|
||||
suppress.set(true)
|
||||
}
|
||||
perPackageOption {
|
||||
matchingRegex.set("kotlin.js.internal(\$|\\.).*")
|
||||
suppress.set(true)
|
||||
}
|
||||
sourceLink {
|
||||
localDirectory.set(file(kotlin_root))
|
||||
remoteUrl.set(new URL("https://github.com/JetBrains/kotlin/tree/$github_revision"))
|
||||
remoteLineSuffix.set("#L")
|
||||
}
|
||||
}
|
||||
}
|
||||
if (version != "1.0" && version != "1.1" && version != "1.2") { // Native platform since Kotlin 1.3
|
||||
register("kotlin-stdlib-native") {
|
||||
documentedVisibilities.set([DokkaConfiguration.Visibility.PUBLIC, DokkaConfiguration.Visibility.PROTECTED])
|
||||
skipDeprecated.set(false)
|
||||
jdkVersion.set(8)
|
||||
platform.set(Platform.native)
|
||||
includes.from(stdlibIncludeMd.toString())
|
||||
noStdlibLink.set(true)
|
||||
noJdkLink.set(true)
|
||||
classpath.setFrom(stdlibNativeClasspath)
|
||||
languageVersion.set(kotlinLanguageVersion)
|
||||
|
||||
samples.from(stdlibSamples.toString())
|
||||
displayName.set("Native")
|
||||
dependsOn("kotlin-stdlib-common")
|
||||
|
||||
sourceRoots.from("$kotlin_native_root/Interop/Runtime/src/main/kotlin")
|
||||
sourceRoots.from("$kotlin_native_root/Interop/Runtime/src/native/kotlin")
|
||||
sourceRoots.from("$kotlin_native_root/Interop/JsRuntime/src/main/kotlin")
|
||||
sourceRoots.from("$kotlin_native_root/runtime/src/main/kotlin")
|
||||
sourceRoots.from("$kotlin_stdlib_dir/native-wasm/src")
|
||||
perPackageOption {
|
||||
matchingRegex.set("kotlin.native.internal(\$|\\.).*")
|
||||
suppress.set(true)
|
||||
}
|
||||
perPackageOption {
|
||||
matchingRegex.set("kotlin.test(\$|\\.).*")
|
||||
suppress.set(true)
|
||||
}
|
||||
sourceLink {
|
||||
localDirectory.set(file(kotlin_root))
|
||||
remoteUrl.set(new URL("https://github.com/JetBrains/kotlin/tree/$github_revision"))
|
||||
remoteLineSuffix.set("#L")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void createKotlinTestVersionedDocTask(String version, Boolean isLatest) {
|
||||
tasks.register("kotlin.test_" + version, org.jetbrains.dokka.gradle.DokkaTask) {
|
||||
def outputDir = "$buildDir/doc"
|
||||
|
||||
def github_revision = pKotlinBig().github_revision
|
||||
|
||||
def kotlin_root = pKotlinBig().kotlin_root
|
||||
def kotlin_libs = pKotlinBig().kotlin_libs
|
||||
def kotlin_native_root = pKotlinNative().kotlin_native_root
|
||||
|
||||
def kotlinTestIncludeMd = "$kotlin_root/libraries/kotlin.test/Module.md"
|
||||
|
||||
def kotlinTestCommonClasspath = ["$kotlin_libs/kotlin-test-common".toString()]
|
||||
def kotlinTestJunitClasspath = ["$kotlin_libs/kotlin-test-junit".toString()]
|
||||
def kotlinTestJunit5Classpath = ["$kotlin_libs/kotlin-test-junit5".toString()]
|
||||
def kotlinTestTestngClasspath = ["$kotlin_libs/kotlin-test-testng".toString()]
|
||||
def kotlinTestJsClasspath = ["$kotlin_libs/kotlin-test-js".toString()]
|
||||
def kotlinTestJvmClasspath = ["$kotlin_libs/kotlin-test".toString()]
|
||||
|
||||
def stdlibPackageList = new URL("file:///$outputDir/kotlin-stdlib/package-list".toString())
|
||||
def junit5PackageList = new URL("https://junit.org/junit5/docs/current/api/element-list".toString())
|
||||
def kotlinLanguageVersion = version
|
||||
|
||||
moduleName.set("kotlin.test")
|
||||
|
||||
if (isLatest) {
|
||||
outputDirectory.set(new File(outputDir, "/kotlin.test/latest"))
|
||||
pluginsMapConfiguration.set(["org.jetbrains.dokka.base.DokkaBase" : """{ "mergeImplicitExpectActualDeclarations": "true", "templatesDir": "${projectDir.toString().replace('\\', '/')}/templates" }""",
|
||||
"org.jetbrains.dokka.versioning.VersioningPlugin": """{ "version": "$version", "olderVersionsDir": "${outputDir.toString().replace('\\', '/')}//kotlin.test/old" }"""])
|
||||
} else {
|
||||
outputDirectory.set(new File(outputDir, "/kotlin.test/old/" + version))
|
||||
pluginsMapConfiguration.set(["org.jetbrains.dokka.base.DokkaBase" : """{ "mergeImplicitExpectActualDeclarations": "true", "templatesDir": "${projectDir.toString().replace('\\', '/')}/templates" }""",
|
||||
"org.jetbrains.dokka.kotlinlang.VersionFilterPlugin": """{ "targetVersion": "$version" }""",
|
||||
"org.jetbrains.dokka.versioning.VersioningPlugin" : """{ "version": "$version" }"""])
|
||||
}
|
||||
|
||||
dokkaSourceSets {
|
||||
"kotlin-test-common" {
|
||||
skipDeprecated.set(false)
|
||||
jdkVersion.set(8)
|
||||
platform.set(Platform.common)
|
||||
includes.from(kotlinTestIncludeMd.toString())
|
||||
classpath.setFrom(kotlinTestCommonClasspath)
|
||||
languageVersion.set(kotlinLanguageVersion)
|
||||
|
||||
displayName.set("Common")
|
||||
sourceRoots.from("$kotlin_root/libraries/kotlin.test/common/src/main/kotlin")
|
||||
sourceRoots.from("$kotlin_root/libraries/kotlin.test/annotations-common/src/main/kotlin")
|
||||
|
||||
sourceLink {
|
||||
localDirectory.set(file(kotlin_root))
|
||||
remoteUrl.set(new URL("https://github.com/JetBrains/kotlin/tree/$github_revision"))
|
||||
remoteLineSuffix.set("#L")
|
||||
}
|
||||
}
|
||||
|
||||
"kotlin-test-jvm" {
|
||||
skipDeprecated.set(false)
|
||||
jdkVersion.set(8)
|
||||
platform.set(Platform.jvm)
|
||||
includes.from(kotlinTestIncludeMd.toString())
|
||||
classpath.setFrom(kotlinTestJvmClasspath)
|
||||
languageVersion.set(kotlinLanguageVersion)
|
||||
|
||||
displayName.set("JVM")
|
||||
sourceRoots.from("$kotlin_root/libraries/kotlin.test/jvm/src/main/kotlin")
|
||||
perPackageOption {
|
||||
matchingRegex.set("org.junit(\$|\\.).*")
|
||||
skipDeprecated.set(true)
|
||||
}
|
||||
sourceLink {
|
||||
localDirectory.set(file(kotlin_root))
|
||||
remoteUrl.set(new URL("https://github.com/JetBrains/kotlin/tree/$github_revision"))
|
||||
remoteLineSuffix.set("#L")
|
||||
}
|
||||
}
|
||||
|
||||
"kotlin-test-JUnit" {
|
||||
skipDeprecated.set(false)
|
||||
jdkVersion.set(8)
|
||||
platform.set(Platform.jvm)
|
||||
includes.from(kotlinTestIncludeMd.toString())
|
||||
classpath.setFrom(kotlinTestJunitClasspath)
|
||||
languageVersion.set(kotlinLanguageVersion)
|
||||
|
||||
displayName.set("JUnit")
|
||||
sourceRoots.from("$kotlin_root/libraries/kotlin.test/junit/src/main/kotlin")
|
||||
|
||||
sourceLink {
|
||||
localDirectory.set(file(kotlin_root))
|
||||
remoteUrl.set(new URL("https://github.com/JetBrains/kotlin/tree/$github_revision"))
|
||||
remoteLineSuffix.set("#L")
|
||||
}
|
||||
externalDocumentationLink {
|
||||
url.set(new URL("https://kotlinlang.org/api/latest/jvm/stdlib/"))
|
||||
packageListUrl.set(stdlibPackageList)
|
||||
}
|
||||
externalDocumentationLink {
|
||||
url.set(new URL("http://junit.org/junit4/javadoc/latest/"))
|
||||
packageListUrl.set(new URL("http://junit.org/junit4/javadoc/latest/package-list"))
|
||||
}
|
||||
}
|
||||
|
||||
"kotlin-test-JUnit5" {
|
||||
skipDeprecated.set(false)
|
||||
jdkVersion.set(8)
|
||||
platform.set(Platform.jvm)
|
||||
includes.from(kotlinTestIncludeMd.toString())
|
||||
classpath.setFrom(kotlinTestJunit5Classpath)
|
||||
languageVersion.set(kotlinLanguageVersion)
|
||||
|
||||
displayName.set("JUnit5")
|
||||
sourceRoots.from("$kotlin_root/libraries/kotlin.test/junit5/src/main/kotlin")
|
||||
|
||||
sourceLink {
|
||||
localDirectory.set(file(kotlin_root))
|
||||
remoteUrl.set(new URL("https://github.com/JetBrains/kotlin/tree/$github_revision"))
|
||||
remoteLineSuffix.set("#L")
|
||||
}
|
||||
externalDocumentationLink {
|
||||
url.set(new URL("https://kotlinlang.org/api/latest/jvm/stdlib/"))
|
||||
packageListUrl.set(stdlibPackageList)
|
||||
}
|
||||
externalDocumentationLink {
|
||||
url.set(new URL("https://junit.org/junit5/docs/current/api/"))
|
||||
packageListUrl.set(junit5PackageList)
|
||||
}
|
||||
}
|
||||
|
||||
"kotlin-test-TestNG" {
|
||||
skipDeprecated.set(false)
|
||||
jdkVersion.set(8)
|
||||
platform.set(Platform.jvm)
|
||||
includes.from(kotlinTestIncludeMd.toString())
|
||||
classpath.setFrom(kotlinTestTestngClasspath)
|
||||
languageVersion.set(kotlinLanguageVersion)
|
||||
|
||||
displayName.set("TestNG")
|
||||
sourceRoots.from("$kotlin_root/libraries/kotlin.test/testng/src/main/kotlin")
|
||||
|
||||
sourceLink {
|
||||
localDirectory.set(file(kotlin_root))
|
||||
remoteUrl.set(new URL("https://github.com/JetBrains/kotlin/tree/$github_revision"))
|
||||
remoteLineSuffix.set("#L")
|
||||
}
|
||||
externalDocumentationLink {
|
||||
url.set(new URL("https://kotlinlang.org/api/latest/jvm/stdlib/"))
|
||||
packageListUrl.set(stdlibPackageList)
|
||||
}
|
||||
// externalDocumentationLink {
|
||||
// url.set(new URL("https://jitpack.io/com/github/cbeust/testng/master/javadoc/"))
|
||||
// packageListUrl.set(new URL("https://jitpack.io/com/github/cbeust/testng/master/javadoc/package-list"))
|
||||
// }
|
||||
}
|
||||
if (version != "1.0") { // JS platform since Kotlin 1.1
|
||||
"kotlin-test-js" {
|
||||
skipDeprecated.set(false)
|
||||
jdkVersion.set(8)
|
||||
platform.set(Platform.js)
|
||||
includes.from(kotlinTestIncludeMd.toString())
|
||||
classpath.setFrom(kotlinTestJsClasspath)
|
||||
languageVersion.set(kotlinLanguageVersion)
|
||||
|
||||
displayName.set("JS")
|
||||
sourceRoots.from("$kotlin_root/libraries/kotlin.test/js/src/main/kotlin")
|
||||
|
||||
sourceLink {
|
||||
localDirectory.set(file(kotlin_root))
|
||||
remoteUrl.set(new URL("https://github.com/JetBrains/kotlin/tree/$github_revision"))
|
||||
remoteLineSuffix.set("#L")
|
||||
}
|
||||
perPackageOption {
|
||||
matchingRegex.set("org.junit(\$|\\.).*")
|
||||
skipDeprecated.set(true)
|
||||
}
|
||||
externalDocumentationLink {
|
||||
url.set(new URL("https://kotlinlang.org/api/latest/jvm/stdlib/"))
|
||||
packageListUrl.set(stdlibPackageList)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (version != "1.0" && version != "1.1" && version != "1.2") { // Native platform since Kotlin 1.3
|
||||
"kotlin-test-native" {
|
||||
skipDeprecated.set(false)
|
||||
jdkVersion.set(8)
|
||||
platform.set(Platform.native)
|
||||
includes.from(kotlinTestIncludeMd.toString())
|
||||
classpath.setFrom(kotlinTestJsClasspath)
|
||||
languageVersion.set(kotlinLanguageVersion)
|
||||
|
||||
displayName.set("Native")
|
||||
sourceRoots.from("$kotlin_native_root/runtime/src/main/kotlin/kotlin/test")
|
||||
|
||||
sourceLink {
|
||||
localDirectory.set(file(kotlin_root))
|
||||
remoteUrl.set(new URL("https://github.com/JetBrains/kotlin/tree/$github_revision"))
|
||||
remoteLineSuffix.set("#L")
|
||||
}
|
||||
externalDocumentationLink {
|
||||
url.set(new URL("https://kotlinlang.org/api/latest/jvm/stdlib/"))
|
||||
packageListUrl.set(stdlibPackageList)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gradle.projectsEvaluated {
|
||||
String[] versions = ["1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8"]
|
||||
|
||||
task buildStdLibDoc() {
|
||||
createStdLibVersionedDocTask(versions[versions.length - 1], true)
|
||||
for(int i = 0; i < versions.length -1; ++i) {
|
||||
createStdLibVersionedDocTask(versions[i], false);
|
||||
dependsOn tasks.named("stdlib_"+ versions[i])
|
||||
}
|
||||
|
||||
def latestVersionTask = tasks.named("stdlib_"+ versions[versions.length - 1])
|
||||
finalizedBy latestVersionTask
|
||||
}
|
||||
|
||||
task buildKotlinTestDoc() {
|
||||
createKotlinTestVersionedDocTask(versions[versions.length - 1], true)
|
||||
for(int i = 0; i < versions.length -1; ++i) {
|
||||
createKotlinTestVersionedDocTask(versions[i], false);
|
||||
dependsOn tasks.named("kotlin.test_"+ versions[i])
|
||||
}
|
||||
|
||||
def latestVersionTask = tasks.named("kotlin.test_"+ versions[versions.length - 1])
|
||||
finalizedBy latestVersionTask
|
||||
}
|
||||
|
||||
callDokka.finalizedBy buildStdLibDoc
|
||||
buildStdLibDoc.finalizedBy buildKotlinTestDoc
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
org.gradle.jvmargs=-Xmx6G
|
||||
dokka_version=1.7.20-dev-187
|
||||
systemProp.dokka.shouldDisplaySinceKotlin=true
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=7ba68c54029790ab444b39d7e293d3236b2632631fb5f2e012bb28b4ff669e4b
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
+244
@@ -0,0 +1,244 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -0,0 +1,10 @@
|
||||
apply plugin: 'base'
|
||||
|
||||
final boolean isTeamcityBuild = System.getenv("TEAMCITY_VERSION") != null
|
||||
|
||||
// kotlin/libraries/tools/kotlin-stdlib-docs -> kotlin/kotlin-native
|
||||
final String kotlinNativeRootDir = rootProject.file("../../../kotlin-native").absolutePath
|
||||
final String kotlinNativeLibsDir = isTeamcityBuild ? project.property("kotlinNativeDistDir") : "$kotlinNativeRootDir/dist"
|
||||
|
||||
project.extensions.kotlin_native_root = kotlinNativeRootDir
|
||||
project.extensions.kotlin_native_libs = kotlinNativeLibsDir
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
plugins {
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.6.10'
|
||||
}
|
||||
description "Dokka Plugin to transform the samples from stdlib"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url 'https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev'
|
||||
}
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
final String dokka_version = findProperty("dokka_version")
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.dokka:dokka-base:$dokka_version"
|
||||
compileOnly "org.jetbrains.dokka:dokka-core:$dokka_version"
|
||||
compileOnly "org.jetbrains.dokka:dokka-analysis:$dokka_version"
|
||||
}
|
||||
|
||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
}
|
||||
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
package org.jetbrains.dokka.kotlinlang
|
||||
|
||||
import com.intellij.psi.PsiDocumentManager
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiElementVisitor
|
||||
import com.intellij.psi.PsiWhiteSpace
|
||||
import com.intellij.psi.impl.source.tree.LeafPsiElement
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import org.jetbrains.dokka.base.transformers.pages.samples.SamplesTransformer
|
||||
import org.jetbrains.dokka.plugability.DokkaContext
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.allChildren
|
||||
import org.jetbrains.kotlin.psi.psiUtil.prevLeaf
|
||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||
import org.jetbrains.kotlin.resolve.ImportPath
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
import java.io.PrintWriter
|
||||
import java.io.StringWriter
|
||||
|
||||
class KotlinWebsiteSamplesTransformer(context: DokkaContext): SamplesTransformer(context) {
|
||||
|
||||
private class SampleBuilder : KtTreeVisitorVoid() {
|
||||
val builder = StringBuilder()
|
||||
val text: String
|
||||
get() = builder.toString()
|
||||
|
||||
val errors = mutableListOf<ConvertError>()
|
||||
|
||||
data class ConvertError(val e: Exception, val text: String, val loc: String)
|
||||
|
||||
fun KtValueArgument.extractStringArgumentValue() =
|
||||
(getArgumentExpression() as KtStringTemplateExpression)
|
||||
.entries.joinToString("") { it.text }
|
||||
|
||||
|
||||
fun convertAssertPrints(expression: KtCallExpression) {
|
||||
val (argument, commentArgument) = expression.valueArguments
|
||||
builder.apply {
|
||||
append("println(")
|
||||
append(argument.text)
|
||||
append(") // ")
|
||||
append(commentArgument.extractStringArgumentValue())
|
||||
}
|
||||
}
|
||||
|
||||
fun convertAssertTrueFalse(expression: KtCallExpression, expectedResult: Boolean) {
|
||||
val (argument) = expression.valueArguments
|
||||
builder.apply {
|
||||
expression.valueArguments.getOrNull(1)?.let {
|
||||
append("// ${it.extractStringArgumentValue()}")
|
||||
val ws = expression.prevLeaf { it is PsiWhiteSpace }
|
||||
append(ws?.text ?: "\n")
|
||||
}
|
||||
append("println(\"")
|
||||
append(argument.text)
|
||||
append(" is \${")
|
||||
append(argument.text)
|
||||
append("}\") // $expectedResult")
|
||||
}
|
||||
}
|
||||
|
||||
fun convertAssertFails(expression: KtCallExpression) {
|
||||
val valueArguments = expression.valueArguments
|
||||
|
||||
val funcArgument: KtValueArgument
|
||||
val message: KtValueArgument?
|
||||
|
||||
if (valueArguments.size == 1) {
|
||||
message = null
|
||||
funcArgument = valueArguments.first()
|
||||
} else {
|
||||
message = valueArguments.first()
|
||||
funcArgument = valueArguments.last()
|
||||
}
|
||||
|
||||
builder.apply {
|
||||
val argument = funcArgument.extractFunctionalArgumentText()
|
||||
append(argument.lines().joinToString(separator = "\n") { "// $it" })
|
||||
append(" // ")
|
||||
if (message != null) {
|
||||
append(message.extractStringArgumentValue())
|
||||
}
|
||||
append(" will fail")
|
||||
}
|
||||
}
|
||||
|
||||
private fun KtValueArgument.extractFunctionalArgumentText(): String {
|
||||
return if (getArgumentExpression() is KtLambdaExpression)
|
||||
PsiTreeUtil.findChildOfType(this, KtBlockExpression::class.java)?.text ?: ""
|
||||
else
|
||||
text
|
||||
}
|
||||
|
||||
fun convertAssertFailsWith(expression: KtCallExpression) {
|
||||
val (funcArgument) = expression.valueArguments
|
||||
val (exceptionType) = expression.typeArguments
|
||||
builder.apply {
|
||||
val argument = funcArgument.extractFunctionalArgumentText()
|
||||
append(argument.lines().joinToString(separator = "\n") { "// $it" })
|
||||
append(" // will fail with ")
|
||||
append(exceptionType.text)
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitCallExpression(expression: KtCallExpression) {
|
||||
when (expression.calleeExpression?.text) {
|
||||
"assertPrints" -> convertAssertPrints(expression)
|
||||
"assertTrue" -> convertAssertTrueFalse(expression, expectedResult = true)
|
||||
"assertFalse" -> convertAssertTrueFalse(expression, expectedResult = false)
|
||||
"assertFails" -> convertAssertFails(expression)
|
||||
"assertFailsWith" -> convertAssertFailsWith(expression)
|
||||
else -> super.visitCallExpression(expression)
|
||||
}
|
||||
}
|
||||
|
||||
private fun reportProblemConvertingElement(element: PsiElement, e: Exception) {
|
||||
val text = element.text
|
||||
val document = PsiDocumentManager.getInstance(element.project).getDocument(element.containingFile)
|
||||
|
||||
val lineInfo = if (document != null) {
|
||||
val lineNumber = document.getLineNumber(element.startOffset)
|
||||
"$lineNumber, ${element.startOffset - document.getLineStartOffset(lineNumber)}"
|
||||
} else {
|
||||
"offset: ${element.startOffset}"
|
||||
}
|
||||
errors += ConvertError(e, text, lineInfo)
|
||||
}
|
||||
|
||||
override fun visitElement(element: PsiElement) {
|
||||
if (element is LeafPsiElement)
|
||||
builder.append(element.text)
|
||||
|
||||
element.acceptChildren(object : PsiElementVisitor() {
|
||||
override fun visitElement(element: PsiElement) {
|
||||
try {
|
||||
element.accept(this@SampleBuilder)
|
||||
} catch (e: Exception) {
|
||||
try {
|
||||
reportProblemConvertingElement(element, e)
|
||||
} finally {
|
||||
builder.append(element.text) //recover
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun PsiElement.buildSampleText(): String {
|
||||
val sampleBuilder = SampleBuilder()
|
||||
this.accept(sampleBuilder)
|
||||
|
||||
sampleBuilder.errors.forEach {
|
||||
val sw = StringWriter()
|
||||
val pw = PrintWriter(sw)
|
||||
it.e.printStackTrace(pw)
|
||||
|
||||
this@KotlinWebsiteSamplesTransformer.context.logger.error("${containingFile.name}: (${it.loc}): Exception thrown while converting \n```\n${it.text}\n```\n$sw")
|
||||
}
|
||||
return sampleBuilder.text
|
||||
}
|
||||
|
||||
val importsToIgnore = arrayOf("samples.*", "samples.Sample").map { ImportPath.fromString(it) }
|
||||
|
||||
override fun processImports(psiElement: PsiElement): String {
|
||||
val psiFile = psiElement.containingFile
|
||||
return when(val text = psiFile.safeAs<KtFile>()?.importList) {
|
||||
is KtImportList -> text.let {
|
||||
it.allChildren.filter {
|
||||
it !is KtImportDirective || it.importPath !in importsToIgnore
|
||||
}.joinToString(separator = "\n") { it.text }
|
||||
}
|
||||
else -> ""
|
||||
}
|
||||
}
|
||||
|
||||
override fun processBody(psiElement: PsiElement): String {
|
||||
val text = processSampleBody(psiElement).trim { it == '\n' || it == '\r' }.trimEnd()
|
||||
val lines = text.split("\n")
|
||||
val indent = lines.filter(String::isNotBlank).map { it.takeWhile(Char::isWhitespace).count() }.minOrNull() ?: 0
|
||||
return lines.joinToString("\n") { it.drop(indent) }
|
||||
}
|
||||
|
||||
private fun processSampleBody(psiElement: PsiElement) = when (psiElement) {
|
||||
is KtDeclarationWithBody -> {
|
||||
val bodyExpression = psiElement.bodyExpression
|
||||
val bodyExpressionText = bodyExpression!!.buildSampleText()
|
||||
when (bodyExpression) {
|
||||
is KtBlockExpression -> bodyExpressionText.removeSurrounding("{", "}")
|
||||
else -> bodyExpressionText
|
||||
}
|
||||
}
|
||||
else -> psiElement.buildSampleText()
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package org.jetbrains.dokka.kotlinlang
|
||||
|
||||
import org.jetbrains.dokka.CoreExtensions
|
||||
import org.jetbrains.dokka.base.DokkaBase
|
||||
import org.jetbrains.dokka.plugability.DokkaPlugin
|
||||
|
||||
class SamplesTransformerPlugin : DokkaPlugin() {
|
||||
private val dokkaBase by lazy { plugin<DokkaBase>() }
|
||||
|
||||
@Suppress("unused")
|
||||
val kotlinWebsiteSamplesTransformer by extending {
|
||||
CoreExtensions.pageTransformer providing ::KotlinWebsiteSamplesTransformer override dokkaBase.defaultSamplesTransformer order {
|
||||
before(dokkaBase.pageMerger)
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.dokka.kotlinlang.SamplesTransformerPlugin
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
plugins {
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.6.10'
|
||||
}
|
||||
description "Dokka Plugin to configure Dokka for stdlib"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url 'https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev'
|
||||
}
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
final String dokka_version = findProperty("dokka_version")
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.dokka:dokka-base:$dokka_version"
|
||||
compileOnly "org.jetbrains.dokka:dokka-core:$dokka_version"
|
||||
compileOnly "org.jetbrains.dokka:dokka-analysis:$dokka_version"
|
||||
}
|
||||
|
||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
}
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package org.jetbrains.dokka.kotlinlang
|
||||
|
||||
import org.jetbrains.dokka.base.DokkaBase
|
||||
import org.jetbrains.dokka.plugability.DokkaPlugin
|
||||
import org.jetbrains.dokka.analysis.DokkaAnalysisConfiguration
|
||||
import org.jetbrains.dokka.analysis.KotlinAnalysis
|
||||
|
||||
class StdLibConfigurationPlugin : DokkaPlugin() {
|
||||
private val dokkaBase by lazy { plugin<DokkaBase>() }
|
||||
|
||||
@Suppress("unused")
|
||||
val stdLibKotlinAnalysis by extending {
|
||||
dokkaBase.kotlinAnalysis providing { ctx ->
|
||||
KotlinAnalysis(
|
||||
sourceSets = ctx.configuration.sourceSets,
|
||||
logger = ctx.logger,
|
||||
analysisConfiguration = DokkaAnalysisConfiguration(ignoreCommonBuiltIns = true)
|
||||
)
|
||||
} override dokkaBase.defaultKotlinAnalysis
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.dokka.kotlinlang.StdLibConfigurationPlugin
|
||||
@@ -0,0 +1,27 @@
|
||||
plugins {
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.6.10'
|
||||
}
|
||||
description "Dokka Plugin to filter version for stdlib"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url 'https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev'
|
||||
}
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
final String dokka_version = findProperty("dokka_version")
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.dokka:dokka-base:$dokka_version"
|
||||
compileOnly "org.jetbrains.dokka:dokka-core:$dokka_version"
|
||||
compileOnly "org.jetbrains.dokka:dokka-analysis:$dokka_version"
|
||||
testImplementation 'org.jetbrains.kotlin:kotlin-test'}
|
||||
|
||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
}
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package org.jetbrains.dokka.kotlinlang
|
||||
|
||||
import org.jetbrains.dokka.plugability.ConfigurableBlock
|
||||
|
||||
data class VersionFilterConfiguration(val targetVersion: String) : ConfigurableBlock
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package org.jetbrains.dokka.kotlinlang
|
||||
|
||||
import org.jetbrains.dokka.CoreExtensions
|
||||
import org.jetbrains.dokka.base.DokkaBase
|
||||
import org.jetbrains.dokka.plugability.DokkaPlugin
|
||||
|
||||
|
||||
class VersionFilterPlugin : DokkaPlugin() {
|
||||
private val dokkaBase by lazy { plugin<DokkaBase>() }
|
||||
|
||||
@Suppress("unused")
|
||||
val versionFilter by extending {
|
||||
CoreExtensions.documentableTransformer providing ::VersionFilterTransformer order {
|
||||
after(dokkaBase.sinceKotlinTransformer)
|
||||
before(dokkaBase.extensionsExtractor)
|
||||
before(dokkaBase.inheritorsExtractor)
|
||||
}
|
||||
}
|
||||
}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
package org.jetbrains.dokka.kotlinlang
|
||||
|
||||
import org.jetbrains.dokka.DokkaConfiguration
|
||||
import org.jetbrains.dokka.base.transformers.pages.annotations.SinceKotlinVersion
|
||||
import org.jetbrains.dokka.model.*
|
||||
import org.jetbrains.dokka.model.doc.CustomTagWrapper
|
||||
import org.jetbrains.dokka.model.doc.Text
|
||||
import org.jetbrains.dokka.plugability.DokkaContext
|
||||
import org.jetbrains.dokka.plugability.configuration
|
||||
import org.jetbrains.dokka.transformers.documentation.DocumentableTransformer
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty
|
||||
|
||||
class VersionFilterTransformer(private val dokkaContext: DokkaContext) :
|
||||
DocumentableTransformer {
|
||||
|
||||
private val targetVersion =
|
||||
configuration<VersionFilterPlugin, VersionFilterConfiguration>(dokkaContext)?.targetVersion?.let {
|
||||
SinceKotlinVersion(
|
||||
it
|
||||
)
|
||||
}
|
||||
|
||||
override fun invoke(original: DModule, context: DokkaContext): DModule = original.transform() as DModule
|
||||
|
||||
private fun <T : Documentable> T.transform(): Documentable? =
|
||||
when (this) {
|
||||
is DModule -> copy(
|
||||
packages = packages.mapNotNull { it.transform() as DPackage? }
|
||||
)
|
||||
|
||||
is DPackage -> copy(
|
||||
classlikes = classlikes.mapNotNull { it.transform() as DClasslike? },
|
||||
functions = functions.mapNotNull { it.transform() as DFunction? },
|
||||
properties = properties.mapNotNull { it.transform() as DProperty? },
|
||||
typealiases = typealiases.mapNotNull { it.transform() as DTypeAlias? }
|
||||
).notEmpty()
|
||||
|
||||
is DClass -> filterSourceSets().ifNotEmpty {
|
||||
this@transform.copy(
|
||||
sourceSets = this,
|
||||
classlikes = classlikes.mapNotNull { it.transform() as DClasslike? },
|
||||
functions = functions.mapNotNull { it.transform() as DFunction? },
|
||||
properties = properties.mapNotNull { it.transform() as DProperty? }
|
||||
)
|
||||
}
|
||||
|
||||
is DEnum -> filterSourceSets().ifNotEmpty {
|
||||
this@transform.copy(
|
||||
sourceSets = this,
|
||||
classlikes = classlikes.mapNotNull { it.transform() as DClasslike? },
|
||||
functions = functions.mapNotNull { it.transform() as DFunction? },
|
||||
properties = properties.mapNotNull { it.transform() as DProperty? }
|
||||
)
|
||||
}
|
||||
|
||||
is DInterface -> filterSourceSets().ifNotEmpty {
|
||||
this@transform.copy(
|
||||
sourceSets = this,
|
||||
classlikes = classlikes.mapNotNull { it.transform() as DClasslike? },
|
||||
functions = functions.mapNotNull { it.transform() as DFunction? },
|
||||
properties = properties.mapNotNull { it.transform() as DProperty? }
|
||||
)
|
||||
}
|
||||
|
||||
is DObject -> filterSourceSets().ifNotEmpty {
|
||||
this@transform.copy(
|
||||
sourceSets = this,
|
||||
classlikes = classlikes.mapNotNull { it.transform() as DClasslike? },
|
||||
functions = functions.mapNotNull { it.transform() as DFunction? },
|
||||
properties = properties.mapNotNull { it.transform() as DProperty? }
|
||||
)
|
||||
}
|
||||
|
||||
is DTypeAlias -> filterSourceSets().ifNotEmpty {
|
||||
this@transform.copy(
|
||||
sourceSets = this,
|
||||
)
|
||||
}
|
||||
|
||||
is DAnnotation -> filterSourceSets().ifNotEmpty {
|
||||
this@transform.copy(
|
||||
sourceSets = this,
|
||||
classlikes = classlikes.mapNotNull { it.transform() as DClasslike? },
|
||||
functions = functions.mapNotNull { it.transform() as DFunction? },
|
||||
properties = properties.mapNotNull { it.transform() as DProperty? }
|
||||
)
|
||||
}
|
||||
|
||||
is DFunction -> filterSourceSets().ifNotEmpty {
|
||||
this@transform.copy(
|
||||
sourceSets = this,
|
||||
)
|
||||
}
|
||||
|
||||
is DProperty -> filterSourceSets().ifNotEmpty {
|
||||
this@transform.copy(
|
||||
sourceSets = this,
|
||||
)
|
||||
}
|
||||
|
||||
is DParameter -> filterSourceSets().ifNotEmpty {
|
||||
this@transform.copy(
|
||||
sourceSets = this,
|
||||
)
|
||||
}
|
||||
|
||||
else -> this.also { dokkaContext.logger.warn("Unrecognized documentable $this while SinceKotlin transformation") }
|
||||
}
|
||||
|
||||
private fun DPackage.notEmpty() =
|
||||
this.takeUnless { classlikes.isEmpty() && functions.isEmpty() && properties.isEmpty() }
|
||||
|
||||
private fun Documentable.filterSourceSets(): Set<DokkaConfiguration.DokkaSourceSet> = this.sourceSets.filter {
|
||||
val currentVersion = getVersionFromCustomTag(it)
|
||||
targetVersion == null || currentVersion == null || currentVersion <= targetVersion
|
||||
}.toSet()
|
||||
|
||||
|
||||
private fun Documentable.getVersionFromCustomTag(sourceSet: DokkaConfiguration.DokkaSourceSet): SinceKotlinVersion? {
|
||||
return documentation[sourceSet]?.children?.find { it is CustomTagWrapper && it.name == "Since Kotlin" }
|
||||
?.let { (it.children[0] as? Text)?.body?.let { txt -> SinceKotlinVersion(txt) } }
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.dokka.kotlinlang.VersionFilterPlugin
|
||||
@@ -0,0 +1,20 @@
|
||||
pluginManagement {
|
||||
plugins {
|
||||
id("org.jetbrains.dokka") version(dokka_version)
|
||||
}
|
||||
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven {
|
||||
url 'https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = 'kotlin-stdlib-docs'
|
||||
|
||||
include 'kotlin_native'
|
||||
include 'kotlin_big'
|
||||
include 'plugins:dokka-samples-transformer-plugin'
|
||||
include 'plugins:dokka-stdlib-configuration-plugin'
|
||||
include 'plugins:dokka-version-filter-plugin'
|
||||
@@ -0,0 +1,7 @@
|
||||
<#macro display>
|
||||
<div class="footer">
|
||||
<span class="go-to-top-icon"><a href="#content" id="go-to-top-link"></a></span><span>${footerMessage}</span><span
|
||||
class="pull-right"><span>Generated by </span><a
|
||||
href="https://github.com/Kotlin/dokka"><span>dokka</span><span class="padded-icon"></span></a></span>
|
||||
</div>
|
||||
</#macro>
|
||||
@@ -0,0 +1,24 @@
|
||||
<#import "source_set_selector.ftl" as source_set_selector>
|
||||
<#macro display>
|
||||
<div class="navigation-wrapper" id="navigation-wrapper">
|
||||
<div id="leftToggler"><span class="icon-toggler"></span></div>
|
||||
<div class="library-name">
|
||||
<@template_cmd name="pathToRoot">
|
||||
<a href="${pathToRoot}index.html">
|
||||
<@template_cmd name="projectName">
|
||||
<span>${projectName}</span>
|
||||
</@template_cmd>
|
||||
</a>
|
||||
</@template_cmd>
|
||||
</div>
|
||||
<div>
|
||||
<#-- This can be handled by a versioning plugin -->
|
||||
<@version/>
|
||||
</div>
|
||||
<div class="pull-right d-flex">
|
||||
<@source_set_selector.display/>
|
||||
<button id="theme-toggle-button"><span id="theme-toggle"></span></button>
|
||||
<div id="searchBar"></div>
|
||||
</div>
|
||||
</div>
|
||||
</#macro>
|
||||
@@ -0,0 +1,6 @@
|
||||
<#macro display>
|
||||
<title>${pageName}</title>
|
||||
<@template_cmd name="pathToRoot">
|
||||
<link href="${pathToRoot}images/logo-icon.svg" rel="icon" type="image/svg">
|
||||
</@template_cmd>
|
||||
</#macro>
|
||||
Reference in New Issue
Block a user