diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-09-16 09:29:25 +0200 |
---|---|---|
committer | Kamil Doległo <9080183+kamildoleglo@users.noreply.github.com> | 2020-11-13 19:46:36 +0100 |
commit | 1a552c1f64fc15a94c298e50a3dd614f3794c0e3 (patch) | |
tree | 5aab050b712775ef98da5041e673100c75f9ee56 | |
parent | e03aed7331756eaef766c7306bd033c84f7fd815 (diff) | |
download | dokka-1a552c1f64fc15a94c298e50a3dd614f3794c0e3.tar.gz dokka-1a552c1f64fc15a94c298e50a3dd614f3794c0e3.tar.bz2 dokka-1a552c1f64fc15a94c298e50a3dd614f3794c0e3.zip |
Add integration tests for Kotlin projects
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 when actually trying to compile, not during project setup phase +- doLast { +- if (!System.env.JDK_16) { +- throw new GradleException("JDK_16 environment variable is not defined. " + +- "Can't build against JDK 1.6 runtime and run JDK 1.6 compatibility tests. " + +- "Please ensure JDK 1.6 is installed and that JDK_16 points to it.") +- } +- } ++// doLast { ++// if (!System.env.JDK_16) { ++// throw new GradleException("JDK_16 environment variable is not defined. " + ++// "Can't build against JDK 1.6 runtime and run JDK 1.6 compatibility tests. " + ++// "Please ensure JDK 1.6 is installed and that JDK_16 points to it.") ++// } ++// } + } + + tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) { +diff --git a/reactive/kotlinx-coroutines-jdk9/build.gradle.kts b/reactive/kotlinx-coroutines-jdk9/build.gradle.kts +index c721746f..d839c3ec 100644 +--- a/reactive/kotlinx-coroutines-jdk9/build.gradle.kts ++++ b/reactive/kotlinx-coroutines-jdk9/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 + + dependencies { + compile(project(":kotlinx-coroutines-reactive")) +@@ -17,6 +18,15 @@ tasks { + } + } + +-externalDocumentationLink( +- url = "https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/Flow.html" +-) ++tasks { ++ dokkaHtml { ++ dokkaSourceSets { ++ configureEach { ++ externalDocumentationLink { ++ url.set(URL("https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/Flow.html")) ++ packageListUrl.set(projectDir.toPath().resolve("package.list").toUri().toURL()) ++ } ++ } ++ } ++ } ++} +diff --git a/reactive/kotlinx-coroutines-reactive/build.gradle.kts b/reactive/kotlinx-coroutines-reactive/build.gradle.kts +index 2ace4f9f..0641395e 100644 +--- a/reactive/kotlinx-coroutines-reactive/build.gradle.kts ++++ b/reactive/kotlinx-coroutines-reactive/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 reactiveStreamsVersion = property("reactive_streams_version") + +@@ -31,6 +32,15 @@ tasks.check { + dependsOn(testNG) + } + +-externalDocumentationLink( +- url = "https://www.reactive-streams.org/reactive-streams-$reactiveStreamsVersion-javadoc/" +-) ++tasks { ++ dokkaHtml { ++ dokkaSourceSets { ++ configureEach { ++ externalDocumentationLink { ++ url.set(URL("https://www.reactive-streams.org/reactive-streams-$reactiveStreamsVersion-javadoc/")) ++ packageListUrl.set(projectDir.toPath().resolve("package.list").toUri().toURL()) ++ } ++ } ++ } ++ } ++} +diff --git a/reactive/kotlinx-coroutines-reactor/build.gradle.kts b/reactive/kotlinx-coroutines-reactor/build.gradle.kts +index d5fd208a..d0133a22 100644 +--- a/reactive/kotlinx-coroutines-reactor/build.gradle.kts ++++ b/reactive/kotlinx-coroutines-reactor/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 reactorVersion = version("reactor") + +@@ -20,6 +21,15 @@ tasks { + } + } + +-externalDocumentationLink( +- url = "https://projectreactor.io/docs/core/$reactorVersion/api/" +-) ++tasks { ++ dokkaHtml { ++ dokkaSourceSets { ++ configureEach { ++ externalDocumentationLink { ++ url.set(URL("https://projectreactor.io/docs/core/$reactorVersion/api/")) ++ packageListUrl.set(projectDir.toPath().resolve("package.list").toUri().toURL()) ++ } ++ } ++ } ++ } ++} +diff --git a/reactive/kotlinx-coroutines-rx2/build.gradle b/reactive/kotlinx-coroutines-rx2/build.gradle +index 6d2c4abc..57cdac2a 100644 +--- a/reactive/kotlinx-coroutines-rx2/build.gradle ++++ b/reactive/kotlinx-coroutines-rx2/build.gradle +@@ -9,10 +9,14 @@ dependencies { + compile "io.reactivex.rxjava2:rxjava:$rxjava2_version" + } + +-tasks.withType(dokka.getClass()) { +- externalDocumentationLink { +- url = new URL('http://reactivex.io/RxJava/2.x/javadoc/') +- packageListUrl = projectDir.toPath().resolve("package.list").toUri().toURL() ++tasks.withType(dokkaHtml.getClass()) { ++ dokkaSourceSets { ++ configureEach { ++ externalDocumentationLink { ++ url.set(new URL('http://reactivex.io/RxJava/2.x/javadoc/')) ++ packageListUrl.set(projectDir.toPath().resolve("package.list").toUri().toURL()) ++ } ++ } + } + } + +diff --git a/reactive/kotlinx-coroutines-rx3/build.gradle b/reactive/kotlinx-coroutines-rx3/build.gradle +index ced694ab..d5cd6319 100644 +--- a/reactive/kotlinx-coroutines-rx3/build.gradle ++++ b/reactive/kotlinx-coroutines-rx3/build.gradle +@@ -18,10 +18,14 @@ compileKotlin { + kotlinOptions.jvmTarget = "1.8" + } + +-tasks.withType(dokka.getClass()) { +- externalDocumentationLink { +- url = new URL('http://reactivex.io/RxJava/3.x/javadoc/') +- packageListUrl = projectDir.toPath().resolve("package.list").toUri().toURL() ++tasks.withType(dokkaHtml.getClass()) { ++ dokkaSourceSets { ++ configureEach { ++ externalDocumentationLink { ++ url.set(new URL('http://reactivex.io/RxJava/3.x/javadoc/')) ++ packageListUrl.set(projectDir.toPath().resolve("package.list").toUri().toURL()) ++ } ++ } + } + } + +diff --git a/settings.gradle b/settings.gradle +index d22d65fd..497eebf1 100644 +--- a/settings.gradle ++++ b/settings.gradle +@@ -11,7 +11,7 @@ pluginManagement { + id "me.champeau.gradle.jmh" version "0.5.0" + } + } +- ++apply from: "../template.settings.gradle.kts" + rootProject.name = 'kotlinx.coroutines' + enableFeaturePreview('GRADLE_METADATA') + +diff --git a/ui/kotlinx-coroutines-android/build.gradle.kts b/ui/kotlinx-coroutines-android/build.gradle.kts +index 4f247883..11dbabf0 100644 +--- a/ui/kotlinx-coroutines-android/build.gradle.kts ++++ b/ui/kotlinx-coroutines-android/build.gradle.kts +@@ -57,6 +57,15 @@ tasks.test { + } + } + +-externalDocumentationLink( +- url = "https://developer.android.com/reference/" +-) ++tasks { ++ dokkaHtml { ++ dokkaSourceSets { ++ configureEach { ++ externalDocumentationLink { ++ url.set(URL("https://developer.android.com/reference/")) ++ packageListUrl.set(projectDir.toPath().resolve("package.list").toUri().toURL()) ++ } ++ } ++ } ++ } ++} diff --git a/integration-tests/gradle/projects/coroutines/kotlinx-coroutines b/integration-tests/gradle/projects/coroutines/kotlinx-coroutines new file mode 160000 +Subproject 768e92bec37fa86026237e5d9780a85b4df7790 diff --git a/integration-tests/gradle/projects/coroutines/template.root.gradle.kts b/integration-tests/gradle/projects/coroutines/template.root.gradle.kts new file mode 120000 index 00000000..895ca83d --- /dev/null +++ b/integration-tests/gradle/projects/coroutines/template.root.gradle.kts @@ -0,0 +1 @@ +../template.root.gradle.kts
\ No newline at end of file diff --git a/integration-tests/gradle/projects/coroutines/template.settings.gradle.kts b/integration-tests/gradle/projects/coroutines/template.settings.gradle.kts new file mode 120000 index 00000000..7b43b3e7 --- /dev/null +++ b/integration-tests/gradle/projects/coroutines/template.settings.gradle.kts @@ -0,0 +1 @@ +../template.settings.gradle.kts
\ No newline at end of file diff --git a/integration-tests/gradle/projects/serialization/kotlinx-serialization b/integration-tests/gradle/projects/serialization/kotlinx-serialization new file mode 160000 +Subproject 66f323855cf745f3896023e6c2079621f7940c2 diff --git a/integration-tests/gradle/projects/serialization/serialization.diff b/integration-tests/gradle/projects/serialization/serialization.diff new file mode 100644 index 00000000..a7fad66b --- /dev/null +++ b/integration-tests/gradle/projects/serialization/serialization.diff @@ -0,0 +1,48 @@ +diff --git a/build.gradle b/build.gradle +index f1cd0012..d1d3b6c6 100644 +--- a/build.gradle ++++ b/build.gradle +@@ -73,7 +73,6 @@ buildscript { + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" +- classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version" + classpath "org.jetbrains.kotlinx:binary-compatibility-validator:$validator_version" + classpath "org.jetbrains.kotlinx:kotlinx-knit:$knit_version" + +@@ -86,6 +85,11 @@ buildscript { + } + } + ++plugins { ++ id("org.jetbrains.dokka") ++} ++ ++apply from: "../template.root.gradle.kts" + // To make it visible for compiler-version.gradle + ext.compilerVersion = org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION + apply plugin: 'binary-compatibility-validator' +diff --git a/gradle.properties b/gradle.properties +index c753aa76..ee9e725a 100644 +--- a/gradle.properties ++++ b/gradle.properties +@@ -5,6 +5,7 @@ + group=org.jetbrains.kotlinx + version=1.0.0 + ++dokka_it_kotlin_version= + kotlin.version=1.4.10 + + # This version take precedence if 'bootstrap' property passed to project +diff --git a/settings.gradle b/settings.gradle +index 88bcb942..848efd27 100644 +--- a/settings.gradle ++++ b/settings.gradle +@@ -2,6 +2,7 @@ + * Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + ++apply from: "../template.settings.gradle.kts" + rootProject.name = 'kotlinx-serialization' + enableFeaturePreview('GRADLE_METADATA') + diff --git a/integration-tests/gradle/projects/serialization/template.root.gradle.kts b/integration-tests/gradle/projects/serialization/template.root.gradle.kts new file mode 120000 index 00000000..895ca83d --- /dev/null +++ b/integration-tests/gradle/projects/serialization/template.root.gradle.kts @@ -0,0 +1 @@ +../template.root.gradle.kts
\ No newline at end of file diff --git a/integration-tests/gradle/projects/serialization/template.settings.gradle.kts b/integration-tests/gradle/projects/serialization/template.settings.gradle.kts new file mode 120000 index 00000000..7b43b3e7 --- /dev/null +++ b/integration-tests/gradle/projects/serialization/template.settings.gradle.kts @@ -0,0 +1 @@ +../template.settings.gradle.kts
\ No newline at end of file diff --git a/integration-tests/gradle/projects/stdlib/kotlin-dokka-stdlib b/integration-tests/gradle/projects/stdlib/kotlin-dokka-stdlib new file mode 160000 +Subproject 10ed102f01ee37f3bacbe86171afec06898dad5 diff --git a/integration-tests/gradle/projects/stdlib/stdlib.diff b/integration-tests/gradle/projects/stdlib/stdlib.diff new file mode 100644 index 00000000..b7f7e30d --- /dev/null +++ b/integration-tests/gradle/projects/stdlib/stdlib.diff @@ -0,0 +1,567 @@ +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,424 @@ ++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 "3.4.3" ++ 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" +-} +- +-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") ++ 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") ++ } ++ ++ 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 { ++ prefix.set("kotlin.reflect.jvm.internal") ++ suppress.set(true) ++ } ++ perPackageOption { ++ prefix.set("kotlin.jvm.functions") ++ suppress.set(true) ++ } ++ perPackageOption { ++ prefix.set("kotlin.jvm.internal") ++ suppress.set(true) ++ } ++ perPackageOption { ++ prefix.set("kotlin.coroutines.jvm.internal") ++ suppress.set(true) ++ } ++ perPackageOption { ++ prefix.set("kotlin.coroutines.experimental.migration") ++ suppress.set(true) ++ } ++ } ++ ++ ++ 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 { ++ prefix.set("kotlin.reflect.jvm.internal") ++ suppress.set(true) ++ } ++ perPackageOption { ++ prefix.set("kotlin.jvm.functions") ++ suppress.set(true) ++ } ++ perPackageOption { ++ prefix.set("kotlin.jvm.internal") ++ suppress.set(true) ++ } ++ perPackageOption { ++ prefix.set("kotlin.coroutines.jvm.internal") ++ suppress.set(true) ++ } ++ perPackageOption { ++ prefix.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 { ++ prefix.set("kotlin.reflect.jvm.internal") ++ suppress.set(true) ++ } ++ perPackageOption { ++ prefix.set("kotlin.jvm.functions") ++ suppress.set(true) ++ } ++ perPackageOption { ++ prefix.set("kotlin.jvm.internal") ++ suppress.set(true) ++ } ++ perPackageOption { ++ prefix.set("kotlin.coroutines.jvm.internal") ++ suppress.set(true) ++ } ++ perPackageOption { ++ prefix.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 { ++ prefix.set("org.w3c") ++ reportUndocumented.set(false) ++ } ++ perPackageOption { ++ prefix.set("org.khronos") ++ reportUndocumented.set(false) ++ } ++ perPackageOption { ++ prefix.set("jquery") ++ suppress.set(true) ++ } ++ perPackageOption { ++ prefix.set("kotlin.reflect.jvm.internal") ++ suppress.set(true) ++ } ++ perPackageOption { ++ prefix.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 { ++ prefix.set("kotlin.native.internal") ++ suppress.set(true) ++ } ++ perPackageOption { ++ prefix.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 { ++ prefix.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 { ++ prefix.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-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,21 @@ ++pluginManagement { ++ resolutionStrategy { ++ eachPlugin { ++ if (requested.id.id == "org.jetbrains.dokka") { ++ useModule("org.jetbrains.dokka:dokka-gradle-plugin:${requested.version}") ++ } ++ } ++ } ++ repositories { ++ mavenLocal() ++ maven { ++ url "https://dl.bintray.com/kotlin/kotlin-dev" ++ } ++ gradlePluginPortal() ++ } ++} ++apply from: "../template.settings.gradle.kts" + rootProject.name = 'kotlin-dokka-stdlib' + + include 'kotlin_native' + include 'kotlin_big' +-include 'ant' diff --git a/integration-tests/gradle/projects/stdlib/template.root.gradle.kts b/integration-tests/gradle/projects/stdlib/template.root.gradle.kts new file mode 120000 index 00000000..895ca83d --- /dev/null +++ b/integration-tests/gradle/projects/stdlib/template.root.gradle.kts @@ -0,0 +1 @@ +../template.root.gradle.kts
\ No newline at end of file diff --git a/integration-tests/gradle/projects/stdlib/template.settings.gradle.kts b/integration-tests/gradle/projects/stdlib/template.settings.gradle.kts new file mode 120000 index 00000000..7b43b3e7 --- /dev/null +++ b/integration-tests/gradle/projects/stdlib/template.settings.gradle.kts @@ -0,0 +1 @@ +../template.settings.gradle.kts
\ No newline at end of file diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/CoroutinesGradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/CoroutinesGradleIntegrationTest.kt new file mode 100644 index 00000000..b4978ea9 --- /dev/null +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/CoroutinesGradleIntegrationTest.kt @@ -0,0 +1,50 @@ +package org.jetbrains.dokka.it.gradle.kotlin + +import org.gradle.testkit.runner.TaskOutcome +import org.jetbrains.dokka.it.S3Project +import org.jetbrains.dokka.it.copyAndApplyGitDiff +import org.jetbrains.dokka.it.gradle.* +import org.junit.runners.Parameterized +import java.io.File +import kotlin.test.* + +class CoroutinesGradleIntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest(), + S3Project { + + companion object { + @get:JvmStatic + @get:Parameterized.Parameters(name = "{0}") + val versions = BuildVersions.permutations( + gradleVersions = listOf("6.3"), + kotlinVersions = listOf("1.4.10") + ) + } + + override val projectOutputLocation: File by lazy { File(projectDir, "build/dokka/htmlMultiModule") } + + @BeforeTest + fun prepareProjectFiles() { + val templateProjectDir = File("projects", "coroutines/kotlinx-coroutines") + templateProjectDir.listFiles().orEmpty() + .forEach { topLevelFile -> topLevelFile.copyRecursively(File(projectDir, topLevelFile.name)) } + + copyAndApplyGitDiff(File("projects", "coroutines/coroutines.diff")) + } + + @Test + fun execute() { + val result = createGradleRunner(":dokkaHtmlMultiModule", "-i", "-s").buildRelaxed() + + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtmlMultiModule")).outcome) + + assertTrue(projectOutputLocation.isDirectory, "Missing dokka output directory") + + projectOutputLocation.allHtmlFiles().forEach { file -> +// assertContainsNoErrorClass(file) +// assertNoUnresolvedLinks(file) +// assertNoHrefToMissingLocalFileOrDirectory(file) + assertNoEmptyLinks(file) + assertNoEmptySpans(file) + } + } +} diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/SerializationGradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/SerializationGradleIntegrationTest.kt new file mode 100644 index 00000000..e097369f --- /dev/null +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/SerializationGradleIntegrationTest.kt @@ -0,0 +1,49 @@ +package org.jetbrains.dokka.it.gradle.kotlin + +import org.gradle.testkit.runner.TaskOutcome +import org.jetbrains.dokka.it.S3Project +import org.jetbrains.dokka.it.copyAndApplyGitDiff +import org.jetbrains.dokka.it.gradle.* +import org.junit.runners.Parameterized +import java.io.File +import kotlin.test.* + +class SerializationGradleIntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest(), + S3Project { + + companion object { + @get:JvmStatic + @get:Parameterized.Parameters(name = "{0}") + val versions = BuildVersions.permutations( + gradleVersions = listOf("6.3"), + kotlinVersions = listOf("1.4.10") + ) + } + + override val projectOutputLocation: File by lazy { File(projectDir, "build/dokka/htmlMultiModule") } + + @BeforeTest + fun prepareProjectFiles() { + val templateProjectDir = File("projects", "serialization/kotlinx-serialization") + templateProjectDir.listFiles().orEmpty() + .forEach { topLevelFile -> topLevelFile.copyRecursively(File(projectDir, topLevelFile.name)) } + copyAndApplyGitDiff(File("projects", "serialization/serialization.diff")) + } + + @Test + fun execute() { + val result = createGradleRunner(":dokkaHtmlMultiModule", "-i", "-s").buildRelaxed() + + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtmlMultiModule")).outcome) + + assertTrue(projectOutputLocation.isDirectory, "Missing dokka output directory") + + projectOutputLocation.allHtmlFiles().forEach { file -> + assertContainsNoErrorClass(file) + assertNoUnresolvedLinks(file) +// assertNoHrefToMissingLocalFileOrDirectory(file) + assertNoEmptyLinks(file) + assertNoEmptySpans(file) + } + } +} diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/StdlibGradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/StdlibGradleIntegrationTest.kt new file mode 100644 index 00000000..ca768962 --- /dev/null +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/StdlibGradleIntegrationTest.kt @@ -0,0 +1,50 @@ +package org.jetbrains.dokka.it.gradle.kotlin + +import org.gradle.testkit.runner.TaskOutcome +import org.jetbrains.dokka.it.S3Project +import org.jetbrains.dokka.it.copyAndApplyGitDiff +import org.jetbrains.dokka.it.gradle.* +import org.junit.runners.Parameterized +import java.io.File +import kotlin.test.* + +class StdlibGradleIntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest(), + S3Project { + + companion object { + @get:JvmStatic + @get:Parameterized.Parameters(name = "{0}") + val versions = BuildVersions.permutations( + gradleVersions = listOf("5.6"), + kotlinVersions = listOf("1.4.10") + ) + } + + override val projectOutputLocation: File by lazy { File(projectDir, "build/dokka/kotlin-stdlib") } + + @BeforeTest + fun prepareProjectFiles() { + val templateProjectDir = File("projects", "stdlib/kotlin-dokka-stdlib") + templateProjectDir.listFiles().orEmpty() + .forEach { topLevelFile -> topLevelFile.copyRecursively(File(projectDir, topLevelFile.name)) } + + copyAndApplyGitDiff(File("projects", "stdlib/stdlib.diff")) + } + + @Test + fun execute() { + val result = createGradleRunner("callDokka", "-i", "-s").buildRelaxed() + + assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":callDokka")).outcome) + + assertTrue(projectOutputLocation.isDirectory, "Missing dokka output directory") + + projectOutputLocation.allHtmlFiles().forEach { file -> + assertContainsNoErrorClass(file) +// assertNoUnresolvedLinks(file) +// assertNoHrefToMissingLocalFileOrDirectory(file) + assertNoEmptyLinks(file) + assertNoEmptySpans(file) + } + } +} diff --git a/integration-tests/maven/projects/biojava/biojava b/integration-tests/maven/projects/biojava/biojava new file mode 160000 +Subproject 633021b1cf6c1aafd45df2d94dc2ad6eadad398 diff --git a/integration-tests/maven/projects/biojava/biojava.diff b/integration-tests/maven/projects/biojava/biojava.diff new file mode 100644 index 00000000..84fbe50f --- /dev/null +++ b/integration-tests/maven/projects/biojava/biojava.diff @@ -0,0 +1,42 @@ +diff --git a/biojava-core/pom.xml b/biojava-core/pom.xml +index 6cc9c6c9a..ef4f28225 100644 +--- a/biojava-core/pom.xml ++++ b/biojava-core/pom.xml +@@ -22,9 +22,36 @@ + </license> + </licenses> + ++ <pluginRepositories> ++ <pluginRepository> ++ <id>kotlin-dev</id> ++ <url>https://dl.bintray.com/kotlin/kotlin-dev</url> ++ </pluginRepository> ++ <pluginRepository> ++ <id>kotlin-eap</id> ++ <url>https://dl.bintray.com/kotlin/kotlin-eap</url> ++ </pluginRepository> ++ <pluginRepository> ++ <id>jcenter</id> ++ <url>https://jcenter.bintray.com/</url> ++ </pluginRepository> ++ </pluginRepositories> ++ + <build> + <plugins> +- ++ <plugin> ++ <groupId>org.jetbrains.dokka</groupId> ++ <artifactId>dokka-maven-plugin</artifactId> ++ <version>${dokka_version}</version> ++ <executions> ++ <execution> ++ <phase>pre-site</phase> ++ <goals> ++ <goal>javadoc</goal> ++ </goals> ++ </execution> ++ </executions> ++ </plugin> + <!-- Excluding demo package is required for avoiding namespace clashes (demo package is in all modules) for signing the jar. See issue #387 --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> diff --git a/integration-tests/maven/src/integrationTest/kotlin/org/jetbrains/dokka/it/maven/BiojavaIntegrationTest.kt b/integration-tests/maven/src/integrationTest/kotlin/org/jetbrains/dokka/it/maven/BiojavaIntegrationTest.kt new file mode 100644 index 00000000..4037cc08 --- /dev/null +++ b/integration-tests/maven/src/integrationTest/kotlin/org/jetbrains/dokka/it/maven/BiojavaIntegrationTest.kt @@ -0,0 +1,59 @@ +package org.jetbrains.dokka.it.maven + +import org.jetbrains.dokka.it.* +import java.io.File +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertTrue + +class BiojavaIntegrationTest : AbstractIntegrationTest(), S3Project { + + private val currentDokkaVersion: String = checkNotNull(System.getenv("DOKKA_VERSION")) + private val mavenBinaryFile: File = File(checkNotNull(System.getenv("MVN_BINARY_PATH"))) + override val projectOutputLocation: File by lazy { File(projectDir, "biojava-core/target/dokkaJavadoc") } + + @BeforeTest + fun prepareProjectFiles() { + val templateProjectDir = File("projects", "biojava/biojava") + templateProjectDir.copyRecursively(projectDir) + val customResourcesDir = File(templateProjectDir, "custom Resources") + if (customResourcesDir.exists() && customResourcesDir.isDirectory) { + customResourcesDir.copyRecursively(File(projectDir, "customResources"), overwrite = true) + } + copyAndApplyGitDiff(File("projects", "biojava/biojava.diff")) + } + + @Test + fun `dokka javadoc`() { + val result = ProcessBuilder().directory(projectDir) + .command(mavenBinaryFile.absolutePath, "dokka:javadoc", "-pl", "biojava-core", "\"-Ddokka_version=$currentDokkaVersion\"", "-U", "-e").start().awaitProcessResult() + + diagnosticAsserts(result) + + assertTrue(projectOutputLocation.isDirectory, "Missing dokka output directory") + + val scriptsDir = File(projectOutputLocation, "jquery") + assertTrue(scriptsDir.isDirectory, "Missing jquery directory") + + val stylesDir = File(projectOutputLocation, "resources") + assertTrue(stylesDir.isDirectory, "Missing resources directory") + + projectDir.allHtmlFiles().forEach { file -> + assertContainsNoErrorClass(file) + assertNoUnresolvedLinks(file) + } + } + + private fun diagnosticAsserts(result: ProcessResult) { + assertEquals(0, result.exitCode, "Expected exitCode 0 (Success)") + + val extensionLoadedRegex = Regex("""Extension: org\.jetbrains\.dokka\.base\.DokkaBase""") + val amountOfExtensionsLoaded = extensionLoadedRegex.findAll(result.output).count() + + assertTrue( + amountOfExtensionsLoaded > 10, + "Expected more than 10 extensions being present (found $amountOfExtensionsLoaded)" + ) + } +} diff --git a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/S3Project.kt b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/S3Project.kt new file mode 100644 index 00000000..ee69ef62 --- /dev/null +++ b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/S3Project.kt @@ -0,0 +1,16 @@ +package org.jetbrains.dokka.it + +import org.junit.After +import java.io.File + +interface S3Project { + val projectOutputLocation: File + + @After + fun copyToLocation() { + System.getenv("DOKKA_IT_AWS_PATH")?.also { location -> + println("Copying to ${File(location).absolutePath}") + projectOutputLocation.copyRecursively(File(location)) + } ?: println("No copy path provided, skipping") + } +} diff --git a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/gitSubmoduleUtils.kt b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/gitSubmoduleUtils.kt new file mode 100644 index 00000000..312ff21f --- /dev/null +++ b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/gitSubmoduleUtils.kt @@ -0,0 +1,40 @@ +package org.jetbrains.dokka.it + +import org.eclipse.jgit.api.Git +import org.eclipse.jgit.storage.file.FileRepositoryBuilder +import java.io.File +import java.nio.file.Path + +fun AbstractIntegrationTest.copyAndApplyGitDiff(diffFile: File) = + copyGitDiffFileToParent(diffFile).let(::applyGitDiffFromFile) + +fun AbstractIntegrationTest.copyGitDiffFileToParent(originalDiffFile: File) = + originalDiffFile.copyTo(File(projectDir.parent, originalDiffFile.name)) + +fun AbstractIntegrationTest.applyGitDiffFromFile(diffFile: File) { + val projectGitFile = projectDir.resolve(".git") + val git = if (projectGitFile.exists()) { + if (projectGitFile.isFile) { + println(".git file inside project directory exists, removing") + removeGitFile(projectDir.toPath()) + Git.init().setDirectory(projectDir).call() + } else { + println(".git directory inside project directory exists, reusing") + FileRepositoryBuilder().apply { + isMustExist = true + gitDir = projectDir + }.let { Git(it.build()) } + } + } else { + Git.init().setDirectory(projectDir).call() + } + git.apply().setPatch(diffFile.inputStream()).call() +} + +private fun removeGitFile(repository: Path) = + repository.toFile() + .listFiles().orEmpty() + .filter { it.name.toLowerCase() == ".git" } + .forEach { it.delete() } + + |