diff options
27 files changed, 1639 insertions, 80 deletions
diff --git a/.github/workflows/s3-cleanup.yml b/.github/workflows/s3-cleanup.yml new file mode 100644 index 00000000..5193290d --- /dev/null +++ b/.github/workflows/s3-cleanup.yml @@ -0,0 +1,21 @@ +name: S3-cleanup + +on: delete + +env: + branch-name: ${GITHUB_REF#refs/heads/} + bucket-name: 'dokka-snapshots' + +jobs: + cleanup: + runs-on: ubuntu-latest + steps: + - name: Configure AWS credentials for S3 access + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: eu-central-1 + + - name: Delete branch from s3 + run: aws s3 --recursive rm s3://${{ env.bucket-name }}/${{ env.branch-name }} diff --git a/.github/workflows/s3-snapshots.yml b/.github/workflows/s3-snapshots.yml index 29a4357f..0020adfe 100644 --- a/.github/workflows/s3-snapshots.yml +++ b/.github/workflows/s3-snapshots.yml @@ -1,4 +1,4 @@ -name: S3-snapshots +name: Build example projects and publish them to s3 on: push @@ -13,30 +13,19 @@ jobs: - name: Checkout dokka uses: actions/checkout@v2 with: - path: dokka + submodules: true - uses: actions/setup-java@v1 with: - java-version: 11 + java-version: 12 - name: Publish dokka locally - run: ./gradlew clean publishToMavenLocal --stacktrace - working-directory: ./dokka - - - name: Get current dokka version - run: echo "::set-env name=DOKKA_VERSION::`./gradlew :properties | grep '^version:.*' | cut -d ' ' -f 2`" - working-directory: ./dokka - - - name: Checkout coroutines - uses: actions/checkout@v2 - with: - repository: 'kamildoleglo/kotlinx.coroutines' - ref: 'aws' - path: coroutines + run: ./gradlew publishToMavenLocal --stacktrace - name: Document coroutines - run: ./gradlew clean dokkaHtml :dokkaHtmlMultimodule -Pdokka_version=$DOKKA_VERSION --stacktrace - working-directory: ./coroutines + run: ./gradlew :integration-tests:gradle:integrationTest --tests org.jetbrains.dokka.it.gradle.kotlin.CoroutinesGradleIntegrationTest --stacktrace --info + env: + DOKKA_IT_AWS_PATH: /home/runner/work/dokka/coroutines - name: Configure AWS credentials for S3 access uses: aws-actions/configure-aws-credentials@v1 @@ -46,27 +35,10 @@ jobs: aws-region: eu-central-1 - name: Copy files to dokka's S3 bucket - run: | - aws s3 --recursive rm s3://${{ env.bucket-name }}/${{ env.branch-name }}/coroutines/prev - aws s3 --recursive mv s3://${{ env.bucket-name }}/${{ env.branch-name }}/coroutines/latest s3://${{ env.bucket-name }}/${{ env.branch-name }}/coroutines/prev - aws s3 sync ./coroutines/htmlMultimodule s3://${{ env.bucket-name }}/${{ env.branch-name }}/coroutines/latest/htmlMultimodule - aws s3 sync ./coroutines/ui/kotlinx-coroutines-android/build/dokka s3://${{ env.bucket-name }}/${{ env.branch-name }}/coroutines/latest/ui/kotlinx-coroutines-android/build/dokka - aws s3 sync ./coroutines/kotlinx-coroutines-core/build/dokka s3://${{ env.bucket-name }}/${{ env.branch-name }}/coroutines/latest/kotlinx-coroutines-core/build/dokka - aws s3 sync ./coroutines/kotlinx-coroutines-debug/build/dokka s3://${{ env.bucket-name }}/${{ env.branch-name }}/coroutines/latest/kotlinx-coroutines-debug/build/dokka - aws s3 sync ./coroutines/integration/kotlinx-coroutines-guava/build/dokka s3://${{ env.bucket-name }}/${{ env.branch-name }}/coroutines/latest/integration/kotlinx-coroutines-guava/build/dokka - aws s3 sync ./coroutines/ui/kotlinx-coroutines-javafx/build/dokka s3://${{ env.bucket-name }}/${{ env.branch-name }}/coroutines/latest/ui/kotlinx-coroutines-javafx/build/dokka - aws s3 sync ./coroutines/integration/kotlinx-coroutines-jdk8/build/dokka s3://${{ env.bucket-name }}/${{ env.branch-name }}/coroutines/latest/integration/kotlinx-coroutines-jdk8/build/dokka - aws s3 sync ./coroutines/reactive/kotlinx-coroutines-jdk9/build/dokka s3://${{ env.bucket-name }}/${{ env.branch-name }}/coroutines/latest/reactive/kotlinx-coroutines-jdk9/build/dokka - aws s3 sync ./coroutines/integration/kotlinx-coroutines-play-services/build/dokka s3://${{ env.bucket-name }}/${{ env.branch-name }}/coroutines/latest/integration/kotlinx-coroutines-play-services/build/dokka - aws s3 sync ./coroutines/reactive/kotlinx-coroutines-reactive/build/dokka s3://${{ env.bucket-name }}/${{ env.branch-name }}/coroutines/latest/reactive/kotlinx-coroutines-reactive/build/dokka - aws s3 sync ./coroutines/reactive/kotlinx-coroutines-reactor/build/dokka s3://${{ env.bucket-name }}/${{ env.branch-name }}/coroutines/latest/reactive/kotlinx-coroutines-reactor/build/dokka - aws s3 sync ./coroutines/reactive/kotlinx-coroutines-rx2/build/dokka s3://${{ env.bucket-name }}/${{ env.branch-name }}/coroutines/latest/reactive/kotlinx-coroutines-rx2/build/dokka - aws s3 sync ./coroutines/reactive/kotlinx-coroutines-rx3/build/dokka s3://${{ env.bucket-name }}/${{ env.branch-name }}/coroutines/latest/reactive/kotlinx-coroutines-rx3/build/dokka - aws s3 sync ./coroutines/integration/kotlinx-coroutines-slf4j/build/dokka s3://${{ env.bucket-name }}/${{ env.branch-name }}/coroutines/latest/integration/kotlinx-coroutines-slf4j/build/dokka - aws s3 sync ./coroutines/ui/kotlinx-coroutines-swing/build/dokka s3://${{ env.bucket-name }}/${{ env.branch-name }}/coroutines/latest/ui/kotlinx-coroutines-swing/build/dokka - aws s3 sync ./coroutines/kotlinx-coroutines-test/build/dokka s3://${{ env.bucket-name }}/${{ env.branch-name }}/coroutines/latest/kotlinx-coroutines-test/build/dokka + run: ./integration-tests/aws_sync.sh s3://${{ env.bucket-name }} coroutines ../coroutines + - name: Print link - run: echo http://dokka-snapshots.s3.eu-central-1.amazonaws.com/${{ env.branch-name }}/coroutines/latest/htmlMultimodule/-modules.html + run: echo http://dokka-snapshots.s3.eu-central-1.amazonaws.com/${{ env.branch-name }}/coroutines/${GITHUB_SHA::7}/-modules.html stdlib: runs-on: ubuntu-latest @@ -74,30 +46,19 @@ jobs: - name: Checkout dokka uses: actions/checkout@v2 with: - path: dokka + submodules: true - uses: actions/setup-java@v1 with: - java-version: 11 + java-version: 12 - name: Publish dokka locally run: ./gradlew clean publishToMavenLocal --stacktrace - working-directory: ./dokka - - - name: Get current dokka version - run: echo "::set-env name=DOKKA_VERSION::`./gradlew :properties | grep '^version:.*' | cut -d ' ' -f 2`" - working-directory: ./dokka - - - name: Checkout stdlib - uses: actions/checkout@v2 - with: - repository: 'kamildoleglo/kotlin-dokka-stdlib' - ref: 'aws' - path: stdlib - name: Document stdlib - run: ./gradlew clean callDokka -Pdokka_version=$DOKKA_VERSION --stacktrace - working-directory: ./stdlib + run: ./gradlew :integration-tests:gradle:integrationTest --tests org.jetbrains.dokka.it.gradle.kotlin.StdlibGradleIntegrationTest --stacktrace --info + env: + DOKKA_IT_AWS_PATH: /home/runner/work/dokka/stdlib - name: Configure AWS credentials for S3 access uses: aws-actions/configure-aws-credentials@v1 @@ -107,44 +68,63 @@ jobs: aws-region: eu-central-1 - name: Copy files to dokka's S3 bucket - run: | - aws s3 --recursive rm s3://${{ env.bucket-name }}/${{ env.branch-name }}/stdlib/prev - aws s3 --recursive mv s3://${{ env.bucket-name }}/${{ env.branch-name }}/stdlib/latest s3://${{ env.bucket-name }}/${{ env.branch-name }}/stdlib/prev - aws s3 sync ./stdlib/build/dokka s3://${{ env.bucket-name }}/${{ env.branch-name }}/stdlib/latest + run: ./integration-tests/aws_sync.sh s3://${{ env.bucket-name }} stdlib ../stdlib - name: Print link - run: echo http://dokka-snapshots.s3.eu-central-1.amazonaws.com/${{ env.branch-name }}/stdlib/latest/kotlin-stdlib/kotlin-stdlib/index.html + run: echo http://dokka-snapshots.s3.eu-central-1.amazonaws.com/${{ env.branch-name }}/stdlib/${GITHUB_SHA::7}/index.html - biojava: + serialization: runs-on: ubuntu-latest steps: - name: Checkout dokka uses: actions/checkout@v2 with: - path: dokka + submodules: true - uses: actions/setup-java@v1 with: - java-version: 11 + java-version: 12 - name: Publish dokka locally run: ./gradlew clean publishToMavenLocal --stacktrace - working-directory: ./dokka - - name: Get current dokka version - run: echo "::set-env name=DOKKA_VERSION::`./gradlew :properties | grep '^version:.*' | cut -d ' ' -f 2`" - working-directory: ./dokka + - name: Document serialization + run: ./gradlew :integration-tests:gradle:integrationTest --tests org.jetbrains.dokka.it.gradle.kotlin.SerializationGradleIntegrationTest --stacktrace --info + env: + DOKKA_IT_AWS_PATH: /home/runner/work/dokka/serialization - - name: Checkout biojava + - name: Configure AWS credentials for S3 access + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: eu-central-1 + + - name: Copy files to dokka's S3 bucket + run: ./integration-tests/aws_sync.sh s3://${{ env.bucket-name }} serialization ../serialization + + - name: Print link + run: echo http://dokka-snapshots.s3.eu-central-1.amazonaws.com/${{ env.branch-name }}/serialization/${GITHUB_SHA::7}/-modules.html + + biojava: + runs-on: ubuntu-latest + steps: + - name: Checkout dokka uses: actions/checkout@v2 with: - repository: 'kamildoleglo/biojava' - ref: 'aws' - path: biojava + submodules: true + + - uses: actions/setup-java@v1 + with: + java-version: 12 + + - name: Publish dokka locally + run: ./gradlew clean publishToMavenLocal --stacktrace - name: Document biojava-core - run: mvn site -pl biojava-core "-Ddokka-version=$DOKKA_VERSION" - working-directory: ./biojava + run: ./gradlew :integration-tests:maven:integrationTest --tests org.jetbrains.dokka.it.maven.BiojavaIntegrationTest --stacktrace --info + env: + DOKKA_IT_AWS_PATH: /home/runner/work/dokka/biojava - name: Configure AWS credentials for S3 access uses: aws-actions/configure-aws-credentials@v1 @@ -154,11 +134,7 @@ jobs: aws-region: eu-central-1 - name: Copy files to dokka's S3 bucket - run: | - aws s3 --recursive rm s3://${{ env.bucket-name }}/${{ env.branch-name }}/biojava/prev - aws s3 --recursive mv s3://${{ env.bucket-name }}/${{ env.branch-name }}/biojava/latest s3://${{ env.bucket-name }}/${{ env.branch-name }}/biojava/prev - aws s3 sync ./biojava/biojava-core/target/dokkaJavadoc s3://${{ env.bucket-name }}/${{ env.branch-name }}/biojava/latest + run: ./integration-tests/aws_sync.sh s3://${{ env.bucket-name }} biojava ../biojava - name: Print link - run: echo http://dokka-snapshots.s3.eu-central-1.amazonaws.com/${{ env.branch-name }}/biojava/latest/index.html - + run: echo http://dokka-snapshots.s3.eu-central-1.amazonaws.com/${{ env.branch-name }}/biojava/${GITHUB_SHA::7}/index.html diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..89cd6fb9 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,12 @@ +[submodule "integration-tests/gradle/projects/stdlib/kotlin-dokka-stdlib"] + path = integration-tests/gradle/projects/stdlib/kotlin-dokka-stdlib + url = https://github.com/JetBrains/kotlin-dokka-stdlib +[submodule "integration-tests/gradle/projects/coroutines/kotlinx-coroutines"] + path = integration-tests/gradle/projects/coroutines/kotlinx-coroutines + url = https://github.com/Kotlin/kotlinx.coroutines +[submodule "integration-tests/gradle/projects/serialization/kotlinx-serialization"] + path = integration-tests/gradle/projects/serialization/kotlinx-serialization + url = https://github.com/Kotlin/kotlinx.serialization +[submodule "integration-tests/maven/projects/biojava/biojava"] + path = integration-tests/maven/projects/biojava/biojava + url = https://github.com/biojava/biojava diff --git a/core/src/main/kotlin/plugability/extensions.kt b/core/src/main/kotlin/plugability/extensions.kt index c6dd0b85..be45c237 100644 --- a/core/src/main/kotlin/plugability/extensions.kt +++ b/core/src/main/kotlin/plugability/extensions.kt @@ -84,4 +84,4 @@ class OrderDsl { fun before(vararg extensions: Extension<*, *, *>) { following += extensions } -}
\ No newline at end of file +} diff --git a/gradle.properties b/gradle.properties index df0f91ae..a48961e7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,5 +12,5 @@ language_version=1.4 # Code style kotlin.code.style=official # Gradle settings -org.gradle.jvmargs=-Xmx4g +org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g org.gradle.parallel=true diff --git a/integration-tests/aws_sync.sh b/integration-tests/aws_sync.sh new file mode 100755 index 00000000..fbc6d535 --- /dev/null +++ b/integration-tests/aws_sync.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +commits_to_store=3 + +if [ $# -lt 3 ]; then + echo "Too little arguments. Usage: ./aws_generate <s3_address> <project_name> <path_to_project_output_dir>" + exit 1 +fi + +aws_s3_address=${1%/} # Remove trailing slash if given +project_name=$2 +project_path=$3 + +current_branch=$(git branch --show-current) +s3_project_address="${aws_s3_address}/${current_branch}/${project_name}/" +last_commits=$(git log --pretty=format:%h -n $commits_to_store) + +# List all project versions +dir=$(aws s3 ls "$s3_project_address" | awk '{print $2}') + +# Remove old versions +for d in $dir; do + for commit in "${last_commits[@]}"; do + [[ $d == "$commit/" ]] && continue + aws s3 rm --recursive "$s3_project_address$d" + done +done + +# Sync the new one +commit_hash=$(git log -1 --format="%h") + +aws s3 sync "$project_path" "$s3_project_address$commit_hash/" + +echo "$commit_hash" diff --git a/integration-tests/build.gradle.kts b/integration-tests/build.gradle.kts index 76dfeb76..f0a534e9 100644 --- a/integration-tests/build.gradle.kts +++ b/integration-tests/build.gradle.kts @@ -62,4 +62,5 @@ dependencies { val coroutines_version: String by project implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") implementation("org.jsoup:jsoup:1.12.1") + implementation("org.eclipse.jgit:org.eclipse.jgit:5.9.0.202009080501-r") } diff --git a/integration-tests/gradle/projects/coroutines/coroutines.diff b/integration-tests/gradle/projects/coroutines/coroutines.diff new file mode 100644 index 00000000..9892f4a6 --- /dev/null +++ b/integration-tests/gradle/projects/coroutines/coroutines.diff @@ -0,0 +1,588 @@ +diff --git a/build.gradle b/build.gradle +index 79c7f355..d5209f10 100644 +--- a/build.gradle ++++ b/build.gradle +@@ -4,18 +4,14 @@ + import org.jetbrains.kotlin.konan.target.HostManager + import org.gradle.util.VersionNumber + +-apply plugin: 'jdk-convention' +-apply from: rootProject.file("gradle/experimental.gradle") +- +-def rootModule = "kotlinx.coroutines" +-def coreModule = "kotlinx-coroutines-core" ++buildscript { ++ def rootModule = "kotlinx.coroutines" ++ def coreModule = "kotlinx-coroutines-core" + // Not applicable for Kotlin plugin +-def sourceless = ['kotlinx.coroutines', 'site', 'kotlinx-coroutines-bom', 'integration-testing'] +-def internal = ['kotlinx.coroutines', 'site', 'benchmarks', 'js-stub', 'stdlib-stubs', 'integration-testing'] ++ def sourceless = ['kotlinx.coroutines', 'site', 'kotlinx-coroutines-bom', 'integration-testing'] ++ def internal = ['kotlinx.coroutines', 'site', 'benchmarks', 'js-stub', 'stdlib-stubs', 'integration-testing'] + // Not published +-def unpublished = internal + ['example-frontend-js', 'android-unit-tests'] +- +-buildscript { ++ def unpublished = internal + ['example-frontend-js', 'android-unit-tests'] + /* + * These property group is used to build kotlinx.coroutines against Kotlin compiler snapshot. + * How does it work: +@@ -74,7 +70,6 @@ buildscript { + + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" +- classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version" + classpath "org.jetbrains.kotlinx:atomicfu-gradle-plugin:$atomicfu_version" + classpath "org.jetbrains.kotlinx:kotlinx-knit:$knit_version" + classpath "com.moowork.gradle:gradle-node-plugin:$gradle_node_version" +@@ -87,6 +82,21 @@ buildscript { + CacheRedirector.configureBuildScript(buildscript, rootProject) + } + ++plugins { ++ id("org.jetbrains.dokka") ++} ++ ++apply plugin: 'jdk-convention' ++apply from: rootProject.file("gradle/experimental.gradle") ++apply from: "../template.root.gradle.kts" ++ ++def rootModule = "kotlinx.coroutines" ++def coreModule = "kotlinx-coroutines-core" ++def sourceless = ['kotlinx.coroutines', 'site', 'kotlinx-coroutines-bom', 'integration-testing'] ++def internal = ['kotlinx.coroutines', 'site', 'benchmarks', 'js-stub', 'stdlib-stubs', 'integration-testing'] ++def unpublished = internal + ['example-frontend-js', 'android-unit-tests'] ++ ++ + import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType + + // todo:KLUDGE: Hierarchical project structures are not fully supported in IDEA, enable only for a regular built +@@ -271,7 +281,7 @@ configure(subprojects.findAll { + } + + def core_docs_url = "https://kotlin.github.io/kotlinx.coroutines/$coreModule/" +-def core_docs_file = "$projectDir/kotlinx-coroutines-core/build/dokka/kotlinx-coroutines-core/package-list" ++def core_docs_file = "$projectDir/kotlinx-coroutines-core/build/dokka/html/kotlinx-coroutines-core/package-list" + + configure(subprojects.findAll { !unpublished.contains(it.name) }) { + if (it.name != 'kotlinx-coroutines-bom') { +@@ -283,11 +293,15 @@ configure(subprojects.findAll { !unpublished.contains(it.name) }) { + configure(subprojects.findAll { !unpublished.contains(it.name) }) { + if (it.name != "kotlinx-coroutines-bom") { + if (it.name != coreModule) { +- dokka.dependsOn project(":$coreModule").dokka +- tasks.withType(dokka.getClass()) { +- externalDocumentationLink { +- url = new URL(core_docs_url) +- packageListUrl = new File(core_docs_file).toURI().toURL() ++ dokkaHtml.dependsOn project(":$coreModule").dokkaHtml ++ tasks.withType(dokkaHtml.getClass()) { ++ dokkaSourceSets { ++ configureEach { ++ externalDocumentationLink { ++ url.set(new URL(core_docs_url)) ++ packageListUrl.set(new File(core_docs_file).toURI().toURL()) ++ } ++ } + } + } + } +diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts +index 96b17a3d..caedbe8d 100644 +--- a/buildSrc/build.gradle.kts ++++ b/buildSrc/build.gradle.kts +@@ -35,5 +35,4 @@ fun version(target: String): String = + + dependencies { + implementation(kotlin("gradle-plugin", version("kotlin"))) +- implementation("org.jetbrains.dokka:dokka-gradle-plugin:${version("dokka")}") + } +diff --git a/buildSrc/src/main/kotlin/Dokka.kt b/buildSrc/src/main/kotlin/Dokka.kt +deleted file mode 100644 +index dd5f1ea4..00000000 +--- a/buildSrc/src/main/kotlin/Dokka.kt ++++ /dev/null +@@ -1,26 +0,0 @@ +-/* +- * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. +- */ +- +-import org.gradle.api.Project +-import org.gradle.kotlin.dsl.delegateClosureOf +-import org.gradle.kotlin.dsl.withType +-import org.jetbrains.dokka.DokkaConfiguration.ExternalDocumentationLink.Builder +-import org.jetbrains.dokka.gradle.DokkaTask +-import java.io.File +-import java.net.URL +- +-/** +- * Package-list by external URL for documentation generation. +- */ +-fun Project.externalDocumentationLink( +- url: String, +- packageList: File = projectDir.resolve("package.list") +-) { +- tasks.withType<DokkaTask>().configureEach { +- externalDocumentationLink(delegateClosureOf<Builder> { +- this.url = URL(url) +- packageListUrl = packageList.toPath().toUri().toURL() +- }) +- } +-} +diff --git a/gradle.properties b/gradle.properties +index 18b95166..36881b53 100644 +--- a/gradle.properties ++++ b/gradle.properties +@@ -5,6 +5,7 @@ + # Kotlin + version=1.4.0-M1-SNAPSHOT + group=org.jetbrains.kotlinx ++dokka_it_kotlin_version= + kotlin_version=1.4.0 + + # Dependencies +diff --git a/gradle/dokka.gradle b/gradle/dokka.gradle +index 559ec8b6..891e07b3 100644 +--- a/gradle/dokka.gradle ++++ b/gradle/dokka.gradle +@@ -5,11 +5,10 @@ + // Configures generation of JavaDoc & Dokka artifacts + + def makeLinkMapping(dokka, projectDir) { +- dokka.linkMapping { ++ dokka.sourceLink { + def relPath = rootProject.projectDir.toPath().relativize(projectDir.toPath()) +- dir = "$projectDir/src" +- url = "https://github.com/kotlin/kotlinx.coroutines/tree/master/$relPath/src" +- suffix = "#L" ++ localDirectory.set(project.file("src")) ++ remoteUrl.set(new URL("https://github.com/kotlin/kotlinx.coroutines/tree/master/$relPath/src")) + } + } + +@@ -20,9 +19,13 @@ configurations { + + apply plugin: 'org.jetbrains.dokka' + +-tasks.withType(dokka.getClass()) { +- jdkVersion = 8 +- includes = ['README.md'] ++tasks.withType(dokkaHtml.getClass()) { ++ dokkaSourceSets { ++ configureEach { ++ jdkVersion.set(8) ++ includes.from('README.md') ++ } ++ } + } + + dependencies { +@@ -30,24 +33,64 @@ dependencies { + } + + +-dokka { +- kotlinTasks { [] } +- outputFormat = 'kotlin-website' ++dokkaHtml { + dependsOn(project.configurations.dokkaStubs) ++ dokkaSourceSets { ++ if (project.name != "kotlinx-coroutines-core") { ++ configureEach { ++ externalDocumentationLink { ++ packageListUrl.set(rootProject.projectDir.toPath().resolve("site/stdlib.package.list").toUri().toURL()) ++ url.set(new URL("https://kotlinlang.org/api/latest/jvm/stdlib/")) ++ } ++ noStdlibLink.set(true) ++ } + +- noStdlibLink = true +- +- externalDocumentationLink { +- packageListUrl = rootProject.projectDir.toPath().resolve("site/stdlib.package.list").toUri().toURL() +- url = new URL("https://kotlinlang.org/api/latest/jvm/stdlib/") +- } ++ } else { ++ commonMain { ++ makeLinkMapping(it, project.file("common")) ++ ++ includes.from('README.md') ++ externalDocumentationLink { ++ packageListUrl.set(rootProject.projectDir.toPath().resolve("site/stdlib.package.list").toUri().toURL()) ++ url.set(new URL("https://kotlinlang.org/api/latest/jvm/stdlib/")) ++ } ++ noStdlibLink.set(true) ++ } ++ jvmMain { ++ makeLinkMapping(it, project.file("jvm")) ++ ++ includes.from('README.md') ++ externalDocumentationLink { ++ packageListUrl.set(rootProject.projectDir.toPath().resolve("site/stdlib.package.list").toUri().toURL()) ++ url.set(new URL("https://kotlinlang.org/api/latest/jvm/stdlib/")) ++ } ++ noStdlibLink.set(true) ++ } ++ jsMain { ++ makeLinkMapping(it, project.file("js")) ++ ++ includes.from('README.md') ++ externalDocumentationLink { ++ packageListUrl.set(rootProject.projectDir.toPath().resolve("site/stdlib.package.list").toUri().toURL()) ++ url.set(new URL("https://kotlinlang.org/api/latest/jvm/stdlib/")) ++ } ++ noStdlibLink.set(true) ++ } ++ } + ++ } + if (project.name != "kotlinx-coroutines-core") { + dependsOn(project.configurations.compileClasspath) + dependsOn(project.sourceSets.main.output) + doFirst { + // resolve classpath only during execution +- classpath = project.configurations.dokkaStubs.files + project.configurations.compileClasspath.files + project.sourceSets.main.output.files ++ dokkaSourceSets { ++ configureEach { ++ classpath.setFrom(project.configurations.dokkaStubs.files) ++ classpath.from(project.configurations.compileClasspath.files) ++ classpath.from(project.sourceSets.main.output.files) ++ } ++ } + } + } + } +@@ -57,37 +100,17 @@ if (project.name == "kotlinx-coroutines-core") { + dependencies { + dokkaStubs project(":js-stub") // so that JS library reference can resolve properly + dokkaStubs project(":kotlinx-coroutines-core") ++ dokkaStubs project(":stdlib-stubs") + } +- +- dokka { +- kotlinTasks { [] } +- suppressedModifiers = ['actual'] +- makeLinkMapping(it, projectDir) +- makeLinkMapping(it, project.file("js")) +- makeLinkMapping(it, project.file("jvm")) +- makeLinkMapping(it, project.file("native")) +- makeLinkMapping(it, project.file("common")) +- // source roots +- impliedPlatforms = ['JVM', 'JS', 'Native'] +- sourceRoot { +- path = rootProject.file("$project.name/common/src") +- } +- sourceRoot { +- path = rootProject.file("$project.name/jvm/src") +- platforms = ['JVM'] +- } +- sourceRoot { +- path = rootProject.file("$project.name/js/src") +- platforms = ['JS'] +- } +- sourceRoot { +- path = rootProject.file("$project.name/native/src") +- platforms = ['Native'] +- } ++ dokkaHtml { + doFirst { +- classpath = project.configurations.dokkaStubs.files + +- project.configurations.jvmCompileClasspath.files + +- project.kotlin.targets.jvm.compilations.main.output.allOutputs ++ dokkaSourceSets { ++ configureEach { ++ classpath.setFrom(project.configurations.dokkaStubs.files) ++ classpath.from(project.configurations.jvmCompileClasspath.files) ++ classpath.from(project.kotlin.targets.jvm.compilations.main.output.allOutputs) ++ } ++ } + } + } + } +diff --git a/integration/kotlinx-coroutines-guava/build.gradle.kts b/integration/kotlinx-coroutines-guava/build.gradle.kts +index 53e91add..810c730c 100644 +--- a/integration/kotlinx-coroutines-guava/build.gradle.kts ++++ b/integration/kotlinx-coroutines-guava/build.gradle.kts +@@ -1,6 +1,7 @@ + /* + * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ ++import java.net.URL + + val guavaVersion = "28.0-jre" + +@@ -8,6 +9,15 @@ dependencies { + compile("com.google.guava:guava:$guavaVersion") + } + +-externalDocumentationLink( +- url = "https://google.github.io/guava/releases/$guavaVersion/api/docs/" +-) ++tasks { ++ dokkaHtml { ++ dokkaSourceSets { ++ configureEach { ++ externalDocumentationLink { ++ url.set(URL("https://google.github.io/guava/releases/$guavaVersion/api/docs/")) ++ packageListUrl.set(projectDir.toPath().resolve("package.list").toUri().toURL()) ++ } ++ } ++ } ++ } ++} +diff --git a/integration/kotlinx-coroutines-play-services/build.gradle b/integration/kotlinx-coroutines-play-services/build.gradle +index 29ce3d60..97f03e2e 100644 +--- a/integration/kotlinx-coroutines-play-services/build.gradle ++++ b/integration/kotlinx-coroutines-play-services/build.gradle +@@ -36,10 +36,14 @@ dependencies { + } + } + +-tasks.withType(dokka.getClass()) { +- externalDocumentationLink { +- url = new URL("https://developers.google.com/android/reference/") +- // This is workaround for missing package list in Google API +- packageListUrl = projectDir.toPath().resolve("package.list").toUri().toURL() ++tasks.withType(dokkaHtml.getClass()) { ++ dokkaSourceSets{ ++ configureEach{ ++ externalDocumentationLink { ++ url.set(new URL("https://developers.google.com/android/reference/")) ++ // This is workaround for missing package list in Google API ++ packageListUrl.set(projectDir.toPath().resolve("package.list").toUri().toURL()) ++ } ++ } + } + } +diff --git a/integration/kotlinx-coroutines-slf4j/build.gradle.kts b/integration/kotlinx-coroutines-slf4j/build.gradle.kts +index c7d0d82d..a8993dce 100644 +--- a/integration/kotlinx-coroutines-slf4j/build.gradle.kts ++++ b/integration/kotlinx-coroutines-slf4j/build.gradle.kts +@@ -2,6 +2,8 @@ + * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + ++import java.net.URL ++ + dependencies { + compile("org.slf4j:slf4j-api:1.7.25") + testCompile("io.github.microutils:kotlin-logging:1.5.4") +@@ -9,6 +11,15 @@ dependencies { + testRuntime("ch.qos.logback:logback-core:1.2.3") + } + +-externalDocumentationLink( +- url = "https://www.slf4j.org/apidocs/" +-) ++tasks { ++ dokkaHtml { ++ dokkaSourceSets { ++ configureEach { ++ externalDocumentationLink { ++ url.set(URL("https://www.slf4j.org/apidocs/")) ++ packageListUrl.set(projectDir.toPath().resolve("package.list").toUri().toURL()) ++ } ++ } ++ } ++ } ++} +diff --git a/kotlinx-coroutines-core/build.gradle b/kotlinx-coroutines-core/build.gradle +index f98f6a52..5f3cd967 100644 +--- a/kotlinx-coroutines-core/build.gradle ++++ b/kotlinx-coroutines-core/build.gradle +@@ -158,13 +158,13 @@ kotlin.sourceSets { + + task checkJdk16() { + // only fail w/o JDK_16 |
