diff --git a/ant/build.gradle b/ant/build.gradle deleted file mode 100644 index 4dcb55f..0000000 --- a/ant/build.gradle +++ /dev/null @@ -1,29 +0,0 @@ -apply plugin: 'de.undercouch.download' - -final String ext -if (System.getProperty('os.name', '').toLowerCase().contains('windows')) { - ext = ".bat" -} else { - ext = "" -} - - -final String antVersion = "1.10.8" -final String antURL = "https://cache-redirector.jetbrains.com/downloads.apache.org/ant/binaries/apache-ant-$antVersion-bin.zip" -final File antHome = new File(buildDir, "ant-home") -final File antZip = new File(buildDir, "apache-ant-$antVersion-bin.zip") -final File antExe = new File(antHome, "apache-ant-$antVersion/bin/ant$ext") - -task downloadAnt(type: Download) { - src antURL - dest buildDir - overwrite false -} - -task extractAnt(type: Sync, dependsOn: downloadAnt) { - from zipTree(antZip) - into antHome -} - -project.extensions.ant_exe = antExe - diff --git a/build.gradle b/build.gradle index aa8f21b..dd6a2ae 100644 --- a/build.gradle +++ b/build.gradle @@ -1,80 +1,445 @@ +import org.jetbrains.dokka.Platform + plugins { - id "de.undercouch.download" version "3.4.3" - id 'com.github.jk1.tcdeps' version '0.17' + id "de.undercouch.download" version "4.1.2" + id 'com.github.jk1.tcdeps' version '0.17' + id "java" + id "org.jetbrains.dokka" } - +apply from: "../template.root.gradle.kts" configurations { - dokka - kotlin_sources + kotlin_sources } -final String dokka_build = "611" -final String dokka_version = "0.10.2-SNAPSHOT" - repositories { - mavenLocal() - maven { url = "https://dl.bintray.com/kotlin/kotlin-dev" } - maven { url = "https://dl.bintray.com/kotlin/kotlin-eap" } - maven { url = "https://teamcity.jetbrains.com/guestAuth/repository/download/Kotlin_Dokka_DokkaAntMavenGradle/$dokka_build/maven" } - jcenter() + mavenLocal() + mavenCentral() + maven { url = "https://dl.bintray.com/kotlin/kotlin-eap" } + maven { url = "https://dl.bintray.com/kotlin/kotlin-dev" } + maven { url = "https://teamcity.jetbrains.com/guestAuth/repository/download/Kotlin_Dokka_DokkaAntMavenGradle/$dokka_build/maven" } + jcenter() } dependencies { - dokka "org.jetbrains.dokka:dokka-fatjar:$dokka_version" + dokkaPlugin project(":plugins:dokka-samples-transformer-plugin") + dokkaPlugin project(":plugins:dokka-stdlib-configuration-plugin") } -final File dokkaHome = new File(buildDir, "dokka-home") -task setupDokka(type: Sync) { - from configurations.dokka - into dokkaHome -} - -task extractAll(dependsOn: [setupDokka]) +task extractAll() extractAll.dependsOn ':kotlin_big:extractLibs' extractAll.dependsOn ':kotlin_big:extractSources' extractAll.dependsOn ':kotlin_big:extractKotlinSources' extractAll.dependsOn ':kotlin_native:extractKotlinNative' -extractAll.dependsOn ':ant:extractAnt' -def pAnt() { return project(':ant').extensions } def pKotlinBig() { return project(':kotlin_big').extensions } + def pKotlinNative() { return project(':kotlin_native').extensions } task cleanupSources(type: Delete) { - dependsOn extractAll - doFirst { - def base = file("${pKotlinNative().kotlin_native_root}/runtime/src/main/kotlin") - delete(files("$base/kotlin/Functions.kt", "$base/kotlin/coroutines/SuspendFunctions.kt", - "$base/kotlin/reflect/KFunctions.kt")) - } + dependsOn extractAll + doFirst { + def base = file("${pKotlinNative().kotlin_native_root}/runtime/src/main/kotlin") + delete(files("$base/kotlin/Functions.kt", "$base/kotlin/coroutines/SuspendFunctions.kt", + "$base/kotlin/reflect/KFunctions.kt")) + } } -task setupCallDokka() { } -task callDokka(type: Exec, dependsOn: [extractAll, setupCallDokka, cleanupSources]) { - workingDir = projectDir - // -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 - environment("ANT_OPTS", "-Xmx3G") - environment("JAVA_HOME", System.getProperty("java.home")) - doFirst { - def logFile = file("$buildDir/dokka.log") - standardOutput = new org.apache.tools.ant.util.TeeOutputStream(standardOutput, new FileOutputStream(logFile)) - } +def outputDir = "$buildDir/dokka" + + +task callDokka() { + delete(outputDir) + dependsOn = [extractAll, cleanupSources] +} + +gradle.projectsEvaluated { + def kotlin_root = pKotlinBig().kotlin_root + def kotlin_sources = pKotlinBig().kotlin_sources + def kotlin_libs = pKotlinBig().kotlin_libs + def kotlin_native_root = pKotlinNative().kotlin_native_root + def kotlin_native_linux = pKotlinNative().kotlin_native_bin_linux + def kotlin_native_windows = pKotlinNative().kotlin_native_bin_windows + def kotlin_native_mac = pKotlinNative().kotlin_native_bin_mac + def stdlibIncludeMd = "$kotlin_root/libraries/stdlib/src/Module.md" + def stdlibSamples = "$kotlin_root/libraries/stdlib/samples/test" + def kotlinTestIncludeMd = "$kotlin_root/libraries/kotlin.test/Module.md" + + def stdlibCommonClasspath = ["$kotlin_libs/kotlin-stdlib-common/".toString(), "$kotlin_sources/kotlin-stdlib-common/".toString()] + def stdlibJvmClasspath = ["$kotlin_libs/kotlin-stdlib/".toString(), "$kotlin_sources/kotlin-stdlib-jdk7/".toString(), "$kotlin_libs/kotlin-stdlib-jdk8/".toString(), "$kotlin_sources/kotlin-stdlib/".toString(), "$kotlin_sources/kotlin-stdlib-common/".toString(), "$kotlin_root/core/reflection.jvm/src".toString()] + def stdlibNativeClasspath = ["$kotlin_native_linux/klib/common/stdlib".toString()] + def stdlibJsClasspath = ["$kotlin_libs/kotlin-stdlib-js/".toString()] + 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/kotlin-stdlib/package-list".toString()) + def junit5PackageList = new URL("https://junit.org/junit5/docs/current/api/element-list".toString()) + def kotlinLanguageVersion = "1.4" + + task dokkaStdlib(type: org.jetbrains.dokka.gradle.DokkaTask) { + outputDirectory.set(new File(outputDir, "/kotlin-stdlib")) + moduleName.set("kotlin-stdlib") + pluginsMapConfiguration.set(["org.jetbrains.dokka.base.DokkaBase": """{ "mergeImplicitExpectActualDeclarations": "true" }"""]) + dokkaSourceSets { + register("kotlin-stdlib-common") { + 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_sources/kotlin-stdlib-common") + sourceLink { + localDirectory.set(file("$kotlin_sources/kotlin-stdlib-common")) + remoteUrl.set(new URL("https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib/common/src")) + remoteLineSuffix.set("#L") + } + sourceLink { + localDirectory.set(file("$kotlin_root/core/builtins/src")) + remoteUrl.set(new URL("https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib/src")) + remoteLineSuffix.set("#L") + } + } + + register("kotlin-stdlib-java-common") { + skipDeprecated.set(false) + jdkVersion.set(8) + platform.set(Platform.jvm) + includes.from(stdlibIncludeMd.toString()) + noStdlibLink.set(true) + classpath.setFrom(stdlibJvmClasspath + stdlibCommonClasspath) + languageVersion.set(kotlinLanguageVersion) + + samples.from(stdlibSamples.toString()) + displayName.set("JRE") + dependsOn("kotlin-stdlib-common") + sourceRoots.from("$kotlin_sources/kotlin-stdlib") + sourceRoots.from("$kotlin_root/core/reflection.jvm/src") + sourceRoots.from("$kotlin_root/libraries/stdlib/jvm/runtime/kotlin/jvm/annotations") + sourceRoots.from("$kotlin_root/libraries/stdlib/jvm/runtime/kotlin/jvm/JvmClassMapping.kt") + sourceRoots.from("$kotlin_root/libraries/stdlib/jvm/runtime/kotlin/jvm/PurelyImplements.kt") + sourceRoots.from("$kotlin_root/libraries/stdlib/jvm/runtime/kotlin/TypeAliases.kt") + sourceRoots.from("$kotlin_root/libraries/stdlib/jvm/runtime/kotlin/text/TypeAliases.kt") + 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_sources/kotlin-stdlib")) + remoteUrl.set(new URL("https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib/jvm/src")) + remoteLineSuffix.set("#L") + } + } + + + register("kotlin-stdlib-jdk8") { + skipDeprecated.set(false) + jdkVersion.set(8) + platform.set(Platform.jvm) + includes.from(stdlibIncludeMd.toString()) + noStdlibLink.set(true) + classpath.setFrom(stdlibJvmClasspath + stdlibCommonClasspath) + languageVersion.set(kotlinLanguageVersion) + + samples.from(stdlibSamples.toString()) + displayName.set("JRE8") + dependsOn("kotlin-stdlib-java-common") + dependsOn("kotlin-stdlib-common") + sourceRoots.setFrom("$kotlin_sources/kotlin-stdlib-jdk8/") + 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) + } + } + + register("kotlin-stdlib-jdk7") { + skipDeprecated.set(false) + jdkVersion.set(8) + platform.set(Platform.jvm) + includes.from(stdlibIncludeMd.toString()) + noStdlibLink.set(true) + classpath.setFrom(stdlibJvmClasspath + stdlibCommonClasspath) + languageVersion.set(kotlinLanguageVersion) + + + samples.from(stdlibSamples.toString()) + displayName.set("JRE7") + dependsOn("kotlin-stdlib-java-common") + dependsOn("kotlin-stdlib-common") + sourceRoots.from("$kotlin_sources/kotlin-stdlib-jdk7") + 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) + } + } + + + register("kotlin-stdlib-js") { + skipDeprecated.set(false) + jdkVersion.set(8) + platform.set(Platform.js) + includes.from(stdlibIncludeMd.toString()) + noStdlibLink.set(true) + noJdkLink.set(true) + classpath.setFrom(stdlibJsClasspath + stdlibCommonClasspath) + languageVersion.set(kotlinLanguageVersion) + + samples.from(stdlibSamples.toString()) + displayName.set("JS") + dependsOn("kotlin-stdlib-common") + + sourceRoots.from("$kotlin_sources/kotlin-stdlib-js") + 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) + } + } + + register("kotlin-stdlib-native") { + skipDeprecated.set(false) + jdkVersion.set(8) + platform.set(Platform.native) + includes.from(stdlibIncludeMd.toString()) + noStdlibLink.set(true) + noJdkLink.set(true) + classpath.setFrom(stdlibNativeClasspath + stdlibCommonClasspath) + 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") + perPackageOption { + matchingRegex.set("kotlin.native.internal(\$|\\.).*") + suppress.set(true) + } + perPackageOption { + matchingRegex.set("kotlin.test(\$|\\.).*") + suppress.set(true) + } + } + } + } + + task dokkaKotlinTest(type: org.jetbrains.dokka.gradle.DokkaTask) { + outputDirectory.set(new File(outputDir, "kotlin.test")) + moduleName.set("kotlin.test") + 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") + } + + "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) + } + } + + "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") + 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") + 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") + 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")) + } + } + + "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") + perPackageOption { + matchingRegex.set("org.junit(\$|\\.).*") + skipDeprecated.set(true) + } + externalDocumentationLink { + url.set(new URL("https://kotlinlang.org/api/latest/jvm/stdlib/")) + packageListUrl.set(stdlibPackageList) + } + } + + "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") + externalDocumentationLink { + url.set(new URL("https://kotlinlang.org/api/latest/jvm/stdlib/")) + packageListUrl.set(stdlibPackageList) + } + } + } + } + + + callDokka.finalizedBy dokkaStdlib + dokkaStdlib.finalizedBy dokkaKotlinTest } -setupCallDokka.doLast { - - callDokka.commandLine = [ - pAnt().ant_exe.path, - "-f", file("build-docs.xml").path, - "v2", - "-Dkotlin_root=${pKotlinBig().kotlin_root}", - "-Dkotlin_sources=${pKotlinBig().kotlin_sources}", - "-Dkotlin_libs=${pKotlinBig().kotlin_libs}", - "-Dkotlin_native_root=${pKotlinNative().kotlin_native_root}", - "-Dkotlin_native_linux=${pKotlinNative().kotlin_native_bin_linux}", - "-Dkotlin_native_windows=${pKotlinNative().kotlin_native_bin_windows}", - "-Dkotlin_native_mac=${pKotlinNative().kotlin_native_bin_mac}", - ] +tasks { + doLast { + println(" ##teamcity[publishArtifacts '${outputDir}/kotlin.test => kotlin.test.zip'] ") + } } diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..76356e8 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,3 @@ +dokka_build = 611 +dokka_version = 1.4.20.2-SNAPSHOT +org.gradle.jvmargs=-Xmx4096m diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d76b502..5028f28 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle index 5209245..bd38b18 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,20 @@ +pluginManagement { + resolutionStrategy { + eachPlugin { + if (requested.id.id == "org.jetbrains.dokka") { + useModule("org.jetbrains.dokka:dokka-gradle-plugin:${requested.version}") + } + } + } + repositories { + mavenLocal() + gradlePluginPortal() + } +} +apply from: "../template.settings.gradle.kts" rootProject.name = 'kotlin-dokka-stdlib' include 'kotlin_native' include 'kotlin_big' -include 'ant' +include 'plugins:dokka-samples-transformer-plugin' +include 'plugins:dokka-stdlib-configuration-plugin'