diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index c6f169dcca..a6475749f9 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -2,6 +2,10 @@ name: Check on: pull_request +concurrency: + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' + cancel-in-progress: true + jobs: validate-wrapper: runs-on: ubuntu-latest diff --git a/.github/workflows/dokka-examples.yml b/.github/workflows/dokka-examples.yml index f116777125..e8782c1c7b 100644 --- a/.github/workflows/dokka-examples.yml +++ b/.github/workflows/dokka-examples.yml @@ -2,6 +2,10 @@ name: Build examples on: pull_request +concurrency: + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' + cancel-in-progress: true + jobs: build: strategy: diff --git a/.github/workflows/gradle-test.pr.yml b/.github/workflows/gradle-test.pr.yml index 1a40239cf5..6a732dfcc9 100644 --- a/.github/workflows/gradle-test.pr.yml +++ b/.github/workflows/gradle-test.pr.yml @@ -2,6 +2,10 @@ name: Test on: pull_request +concurrency: + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' + cancel-in-progress: true + jobs: test-ubuntu: strategy: diff --git a/.github/workflows/qodana.yml b/.github/workflows/qodana.yml index b77719eaa9..2975c50496 100644 --- a/.github/workflows/qodana.yml +++ b/.github/workflows/qodana.yml @@ -7,6 +7,10 @@ on: branches: - master +concurrency: + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' + cancel-in-progress: true + jobs: inspection: runs-on: ubuntu-latest diff --git a/core/src/main/kotlin/DokkaBootstrapImpl.kt b/core/src/main/kotlin/DokkaBootstrapImpl.kt index 114bade7d2..d2e138f075 100644 --- a/core/src/main/kotlin/DokkaBootstrapImpl.kt +++ b/core/src/main/kotlin/DokkaBootstrapImpl.kt @@ -1,6 +1,7 @@ package org.jetbrains.dokka import org.jetbrains.dokka.utilities.DokkaLogger +import java.util.concurrent.atomic.AtomicInteger import java.util.function.BiConsumer @@ -11,8 +12,16 @@ import java.util.function.BiConsumer class DokkaBootstrapImpl : DokkaBootstrap { class DokkaProxyLogger(val consumer: BiConsumer) : DokkaLogger { - override var warningsCount: Int = 0 - override var errorsCount: Int = 0 + private val warningsCounter = AtomicInteger() + private val errorsCounter = AtomicInteger() + + override var warningsCount: Int + get() = warningsCounter.get() + set(value) = warningsCounter.set(value) + + override var errorsCount: Int + get() = errorsCounter.get() + set(value) = errorsCounter.set(value) override fun debug(message: String) { consumer.accept("debug", message) @@ -27,11 +36,11 @@ class DokkaBootstrapImpl : DokkaBootstrap { } override fun warn(message: String) { - consumer.accept("warn", message).also { warningsCount++ } + consumer.accept("warn", message).also { warningsCounter.incrementAndGet() } } override fun error(message: String) { - consumer.accept("error", message).also { errorsCount++ } + consumer.accept("error", message).also { errorsCounter.incrementAndGet() } } } diff --git a/core/src/main/kotlin/utilities/DokkaLogging.kt b/core/src/main/kotlin/utilities/DokkaLogging.kt index 0302b8a221..80c762a360 100644 --- a/core/src/main/kotlin/utilities/DokkaLogging.kt +++ b/core/src/main/kotlin/utilities/DokkaLogging.kt @@ -1,5 +1,7 @@ package org.jetbrains.dokka.utilities +import java.util.concurrent.atomic.AtomicInteger + interface DokkaLogger { var warningsCount: Int var errorsCount: Int @@ -40,8 +42,16 @@ class DokkaConsoleLogger( val minLevel: LoggingLevel = LoggingLevel.DEBUG, private val emitter: MessageEmitter = MessageEmitter.consoleEmitter ) : DokkaLogger { - override var warningsCount: Int = 0 - override var errorsCount: Int = 0 + private val warningsCounter = AtomicInteger() + private val errorsCounter = AtomicInteger() + + override var warningsCount: Int + get() = warningsCounter.get() + set(value) = warningsCounter.set(value) + + override var errorsCount: Int + get() = errorsCounter.get() + set(value) = errorsCounter.set(value) override fun debug(message: String) { if (shouldBeDisplayed(LoggingLevel.DEBUG)) emitter(message) @@ -59,14 +69,14 @@ class DokkaConsoleLogger( if (shouldBeDisplayed(LoggingLevel.WARN)) { emitter("WARN: $message") } - warningsCount++ + warningsCounter.incrementAndGet() } override fun error(message: String) { if (shouldBeDisplayed(LoggingLevel.ERROR)) { emitter("ERROR: $message") } - errorsCount++ + errorsCounter.incrementAndGet() } private fun shouldBeDisplayed(messageLevel: LoggingLevel): Boolean = messageLevel.index >= minLevel.index diff --git a/core/test-api/src/main/kotlin/testApi/logger/TestLogger.kt b/core/test-api/src/main/kotlin/testApi/logger/TestLogger.kt index 0bc66a2b1b..e70200a7bc 100644 --- a/core/test-api/src/main/kotlin/testApi/logger/TestLogger.kt +++ b/core/test-api/src/main/kotlin/testApi/logger/TestLogger.kt @@ -1,24 +1,28 @@ package org.jetbrains.dokka.testApi.logger import org.jetbrains.dokka.utilities.DokkaLogger +import java.util.Collections +/* + * Even in tests it be used in a concurrent environment, so needs to be thread safe + */ class TestLogger(private val logger: DokkaLogger) : DokkaLogger { override var warningsCount: Int by logger::warningsCount override var errorsCount: Int by logger::errorsCount - private var _debugMessages = mutableListOf() + private var _debugMessages = synchronizedMutableListOf() val debugMessages: List get() = _debugMessages.toList() - private var _infoMessages = mutableListOf() + private var _infoMessages = synchronizedMutableListOf() val infoMessages: List get() = _infoMessages.toList() - private var _progressMessages = mutableListOf() + private var _progressMessages = synchronizedMutableListOf() val progressMessages: List get() = _progressMessages.toList() - private var _warnMessages = mutableListOf() + private var _warnMessages = synchronizedMutableListOf() val warnMessages: List get() = _warnMessages.toList() - private var _errorMessages = mutableListOf() + private var _errorMessages = synchronizedMutableListOf() val errorMessages: List get() = _errorMessages.toList() override fun debug(message: String) { @@ -45,4 +49,6 @@ class TestLogger(private val logger: DokkaLogger) : DokkaLogger { _errorMessages.add(message) logger.error(message) } + + private fun synchronizedMutableListOf(): MutableList = Collections.synchronizedList(mutableListOf()) } diff --git a/examples/gradle/dokka-customFormat-example/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/dokka-customFormat-example/gradle/wrapper/gradle-wrapper.jar index 249e5832f0..943f0cbfa7 100644 Binary files a/examples/gradle/dokka-customFormat-example/gradle/wrapper/gradle-wrapper.jar and b/examples/gradle/dokka-customFormat-example/gradle/wrapper/gradle-wrapper.jar differ diff --git a/examples/gradle/dokka-customFormat-example/gradle/wrapper/gradle-wrapper.properties b/examples/gradle/dokka-customFormat-example/gradle/wrapper/gradle-wrapper.properties index ae04661ee7..f398c33c4b 100644 --- a/examples/gradle/dokka-customFormat-example/gradle/wrapper/gradle-wrapper.properties +++ b/examples/gradle/dokka-customFormat-example/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/examples/gradle/dokka-customFormat-example/gradlew b/examples/gradle/dokka-customFormat-example/gradlew index a69d9cb6c2..65dcd68d65 100755 --- a/examples/gradle/dokka-customFormat-example/gradlew +++ b/examples/gradle/dokka-customFormat-example/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac diff --git a/examples/gradle/dokka-customFormat-example/gradlew.bat b/examples/gradle/dokka-customFormat-example/gradlew.bat index 53a6b238d4..6689b85bee 100644 --- a/examples/gradle/dokka-customFormat-example/gradlew.bat +++ b/examples/gradle/dokka-customFormat-example/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/examples/gradle/dokka-gradle-example/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/dokka-gradle-example/gradle/wrapper/gradle-wrapper.jar index 249e5832f0..943f0cbfa7 100644 Binary files a/examples/gradle/dokka-gradle-example/gradle/wrapper/gradle-wrapper.jar and b/examples/gradle/dokka-gradle-example/gradle/wrapper/gradle-wrapper.jar differ diff --git a/examples/gradle/dokka-gradle-example/gradle/wrapper/gradle-wrapper.properties b/examples/gradle/dokka-gradle-example/gradle/wrapper/gradle-wrapper.properties index ae04661ee7..f398c33c4b 100644 --- a/examples/gradle/dokka-gradle-example/gradle/wrapper/gradle-wrapper.properties +++ b/examples/gradle/dokka-gradle-example/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/examples/gradle/dokka-gradle-example/gradlew b/examples/gradle/dokka-gradle-example/gradlew index a69d9cb6c2..65dcd68d65 100755 --- a/examples/gradle/dokka-gradle-example/gradlew +++ b/examples/gradle/dokka-gradle-example/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac diff --git a/examples/gradle/dokka-gradle-example/gradlew.bat b/examples/gradle/dokka-gradle-example/gradlew.bat index 53a6b238d4..6689b85bee 100644 --- a/examples/gradle/dokka-gradle-example/gradlew.bat +++ b/examples/gradle/dokka-gradle-example/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/examples/gradle/dokka-kotlinAsJava-example/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/dokka-kotlinAsJava-example/gradle/wrapper/gradle-wrapper.jar index 249e5832f0..943f0cbfa7 100644 Binary files a/examples/gradle/dokka-kotlinAsJava-example/gradle/wrapper/gradle-wrapper.jar and b/examples/gradle/dokka-kotlinAsJava-example/gradle/wrapper/gradle-wrapper.jar differ diff --git a/examples/gradle/dokka-kotlinAsJava-example/gradle/wrapper/gradle-wrapper.properties b/examples/gradle/dokka-kotlinAsJava-example/gradle/wrapper/gradle-wrapper.properties index ae04661ee7..f398c33c4b 100644 --- a/examples/gradle/dokka-kotlinAsJava-example/gradle/wrapper/gradle-wrapper.properties +++ b/examples/gradle/dokka-kotlinAsJava-example/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/examples/gradle/dokka-kotlinAsJava-example/gradlew b/examples/gradle/dokka-kotlinAsJava-example/gradlew index a69d9cb6c2..65dcd68d65 100755 --- a/examples/gradle/dokka-kotlinAsJava-example/gradlew +++ b/examples/gradle/dokka-kotlinAsJava-example/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac diff --git a/examples/gradle/dokka-kotlinAsJava-example/gradlew.bat b/examples/gradle/dokka-kotlinAsJava-example/gradlew.bat index 53a6b238d4..6689b85bee 100644 --- a/examples/gradle/dokka-kotlinAsJava-example/gradlew.bat +++ b/examples/gradle/dokka-kotlinAsJava-example/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/examples/gradle/dokka-library-publishing-example/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/dokka-library-publishing-example/gradle/wrapper/gradle-wrapper.jar index 249e5832f0..943f0cbfa7 100644 Binary files a/examples/gradle/dokka-library-publishing-example/gradle/wrapper/gradle-wrapper.jar and b/examples/gradle/dokka-library-publishing-example/gradle/wrapper/gradle-wrapper.jar differ diff --git a/examples/gradle/dokka-library-publishing-example/gradle/wrapper/gradle-wrapper.properties b/examples/gradle/dokka-library-publishing-example/gradle/wrapper/gradle-wrapper.properties index ae04661ee7..f398c33c4b 100644 --- a/examples/gradle/dokka-library-publishing-example/gradle/wrapper/gradle-wrapper.properties +++ b/examples/gradle/dokka-library-publishing-example/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/examples/gradle/dokka-library-publishing-example/gradlew b/examples/gradle/dokka-library-publishing-example/gradlew index a69d9cb6c2..65dcd68d65 100755 --- a/examples/gradle/dokka-library-publishing-example/gradlew +++ b/examples/gradle/dokka-library-publishing-example/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac diff --git a/examples/gradle/dokka-library-publishing-example/gradlew.bat b/examples/gradle/dokka-library-publishing-example/gradlew.bat index 53a6b238d4..6689b85bee 100644 --- a/examples/gradle/dokka-library-publishing-example/gradlew.bat +++ b/examples/gradle/dokka-library-publishing-example/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/examples/gradle/dokka-multimodule-example/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/dokka-multimodule-example/gradle/wrapper/gradle-wrapper.jar index 249e5832f0..943f0cbfa7 100644 Binary files a/examples/gradle/dokka-multimodule-example/gradle/wrapper/gradle-wrapper.jar and b/examples/gradle/dokka-multimodule-example/gradle/wrapper/gradle-wrapper.jar differ diff --git a/examples/gradle/dokka-multimodule-example/gradle/wrapper/gradle-wrapper.properties b/examples/gradle/dokka-multimodule-example/gradle/wrapper/gradle-wrapper.properties index ae04661ee7..f398c33c4b 100644 --- a/examples/gradle/dokka-multimodule-example/gradle/wrapper/gradle-wrapper.properties +++ b/examples/gradle/dokka-multimodule-example/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/examples/gradle/dokka-multimodule-example/gradlew b/examples/gradle/dokka-multimodule-example/gradlew index a69d9cb6c2..65dcd68d65 100755 --- a/examples/gradle/dokka-multimodule-example/gradlew +++ b/examples/gradle/dokka-multimodule-example/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac diff --git a/examples/gradle/dokka-multimodule-example/gradlew.bat b/examples/gradle/dokka-multimodule-example/gradlew.bat index 53a6b238d4..6689b85bee 100644 --- a/examples/gradle/dokka-multimodule-example/gradlew.bat +++ b/examples/gradle/dokka-multimodule-example/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/examples/gradle/dokka-multiplatform-example/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/dokka-multiplatform-example/gradle/wrapper/gradle-wrapper.jar index 249e5832f0..943f0cbfa7 100644 Binary files a/examples/gradle/dokka-multiplatform-example/gradle/wrapper/gradle-wrapper.jar and b/examples/gradle/dokka-multiplatform-example/gradle/wrapper/gradle-wrapper.jar differ diff --git a/examples/gradle/dokka-multiplatform-example/gradle/wrapper/gradle-wrapper.properties b/examples/gradle/dokka-multiplatform-example/gradle/wrapper/gradle-wrapper.properties index ae04661ee7..f398c33c4b 100644 --- a/examples/gradle/dokka-multiplatform-example/gradle/wrapper/gradle-wrapper.properties +++ b/examples/gradle/dokka-multiplatform-example/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/examples/gradle/dokka-multiplatform-example/gradlew b/examples/gradle/dokka-multiplatform-example/gradlew index a69d9cb6c2..65dcd68d65 100755 --- a/examples/gradle/dokka-multiplatform-example/gradlew +++ b/examples/gradle/dokka-multiplatform-example/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac diff --git a/examples/gradle/dokka-multiplatform-example/gradlew.bat b/examples/gradle/dokka-multiplatform-example/gradlew.bat index 53a6b238d4..6689b85bee 100644 --- a/examples/gradle/dokka-multiplatform-example/gradlew.bat +++ b/examples/gradle/dokka-multiplatform-example/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/examples/gradle/dokka-versioning-multimodule-example/gradle/wrapper/gradle-wrapper.jar b/examples/gradle/dokka-versioning-multimodule-example/gradle/wrapper/gradle-wrapper.jar index 249e5832f0..943f0cbfa7 100644 Binary files a/examples/gradle/dokka-versioning-multimodule-example/gradle/wrapper/gradle-wrapper.jar and b/examples/gradle/dokka-versioning-multimodule-example/gradle/wrapper/gradle-wrapper.jar differ diff --git a/examples/gradle/dokka-versioning-multimodule-example/gradle/wrapper/gradle-wrapper.properties b/examples/gradle/dokka-versioning-multimodule-example/gradle/wrapper/gradle-wrapper.properties index ae04661ee7..f398c33c4b 100644 --- a/examples/gradle/dokka-versioning-multimodule-example/gradle/wrapper/gradle-wrapper.properties +++ b/examples/gradle/dokka-versioning-multimodule-example/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/examples/gradle/dokka-versioning-multimodule-example/gradlew b/examples/gradle/dokka-versioning-multimodule-example/gradlew index a69d9cb6c2..65dcd68d65 100755 --- a/examples/gradle/dokka-versioning-multimodule-example/gradlew +++ b/examples/gradle/dokka-versioning-multimodule-example/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac diff --git a/examples/gradle/dokka-versioning-multimodule-example/gradlew.bat b/examples/gradle/dokka-versioning-multimodule-example/gradlew.bat index 53a6b238d4..6689b85bee 100644 --- a/examples/gradle/dokka-versioning-multimodule-example/gradlew.bat +++ b/examples/gradle/dokka-versioning-multimodule-example/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/examples/plugin/hide-internal-api/gradle/wrapper/gradle-wrapper.jar b/examples/plugin/hide-internal-api/gradle/wrapper/gradle-wrapper.jar index 249e5832f0..943f0cbfa7 100644 Binary files a/examples/plugin/hide-internal-api/gradle/wrapper/gradle-wrapper.jar and b/examples/plugin/hide-internal-api/gradle/wrapper/gradle-wrapper.jar differ diff --git a/examples/plugin/hide-internal-api/gradle/wrapper/gradle-wrapper.properties b/examples/plugin/hide-internal-api/gradle/wrapper/gradle-wrapper.properties index ae04661ee7..f398c33c4b 100644 --- a/examples/plugin/hide-internal-api/gradle/wrapper/gradle-wrapper.properties +++ b/examples/plugin/hide-internal-api/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/examples/plugin/hide-internal-api/gradlew b/examples/plugin/hide-internal-api/gradlew index a69d9cb6c2..65dcd68d65 100755 --- a/examples/plugin/hide-internal-api/gradlew +++ b/examples/plugin/hide-internal-api/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac diff --git a/examples/plugin/hide-internal-api/gradlew.bat b/examples/plugin/hide-internal-api/gradlew.bat index 53a6b238d4..6689b85bee 100644 --- a/examples/plugin/hide-internal-api/gradlew.bat +++ b/examples/plugin/hide-internal-api/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 249e5832f0..943f0cbfa7 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae04661ee7..f398c33c4b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index a69d9cb6c2..65dcd68d65 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac diff --git a/gradlew.bat b/gradlew.bat index 53a6b238d4..6689b85bee 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/integration-tests/gradle/projects/it-multimodule-versioning-0/gradle/wrapper/gradle-wrapper.jar b/integration-tests/gradle/projects/it-multimodule-versioning-0/gradle/wrapper/gradle-wrapper.jar index 249e5832f0..943f0cbfa7 100644 Binary files a/integration-tests/gradle/projects/it-multimodule-versioning-0/gradle/wrapper/gradle-wrapper.jar and b/integration-tests/gradle/projects/it-multimodule-versioning-0/gradle/wrapper/gradle-wrapper.jar differ diff --git a/integration-tests/gradle/projects/it-multimodule-versioning-0/gradle/wrapper/gradle-wrapper.properties b/integration-tests/gradle/projects/it-multimodule-versioning-0/gradle/wrapper/gradle-wrapper.properties index ae04661ee7..f398c33c4b 100644 --- a/integration-tests/gradle/projects/it-multimodule-versioning-0/gradle/wrapper/gradle-wrapper.properties +++ b/integration-tests/gradle/projects/it-multimodule-versioning-0/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/integration-tests/gradle/projects/it-multimodule-versioning-0/gradlew b/integration-tests/gradle/projects/it-multimodule-versioning-0/gradlew index a69d9cb6c2..65dcd68d65 100755 --- a/integration-tests/gradle/projects/it-multimodule-versioning-0/gradlew +++ b/integration-tests/gradle/projects/it-multimodule-versioning-0/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac diff --git a/integration-tests/gradle/projects/it-multimodule-versioning-0/gradlew.bat b/integration-tests/gradle/projects/it-multimodule-versioning-0/gradlew.bat index 53a6b238d4..6689b85bee 100644 --- a/integration-tests/gradle/projects/it-multimodule-versioning-0/gradlew.bat +++ b/integration-tests/gradle/projects/it-multimodule-versioning-0/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt index f67ee15c7d..c410104c6f 100644 --- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt @@ -300,7 +300,7 @@ class DefaultPsiToDocumentableTranslator( classlikes = classlikes.await(), visibility = visibility, companion = null, - constructors = parseConstructors(), + constructors = parseConstructors(dri), generics = mapTypeParameters(dri), sourceSets = setOf(sourceSetData), isExpectActual = false, @@ -340,7 +340,7 @@ class DefaultPsiToDocumentableTranslator( classlikes = classlikes.await(), visibility = visibility, companion = null, - constructors = parseConstructors(), + constructors = parseConstructors(dri), supertypes = ancestors, sourceSets = setOf(sourceSetData), isExpectActual = false, @@ -376,7 +376,7 @@ class DefaultPsiToDocumentableTranslator( else -> DClass( dri = dri, name = name.orEmpty(), - constructors = parseConstructors(), + constructors = parseConstructors(dri), functions = allFunctions.await(), properties = allFields.await(), classlikes = classlikes.await(), @@ -401,13 +401,17 @@ class DefaultPsiToDocumentableTranslator( } } - private fun PsiClass.parseConstructors(): List { + /* + * Parameter `parentDRI` required for substitute package name: + * in the case of synthetic constructor, it will return empty from [DRI.Companion.from]. + */ + private fun PsiClass.parseConstructors(parentDRI: DRI): List { val constructors = when { isAnnotationType || isInterface -> emptyArray() isEnum -> this.constructors else -> this.constructors.takeIf { it.isNotEmpty() } ?: arrayOf(createDefaultConstructor()) } - return constructors.map { parseFunction(it, true) } + return constructors.map { parseFunction(psi = it, isConstructor = true, parentDRI = parentDRI) } } /** diff --git a/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt b/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt index 537a4bfc23..5ce6bbb6ce 100644 --- a/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt +++ b/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt @@ -827,6 +827,29 @@ class DefaultPsiToDocumentableTranslatorTest : BaseAbstractTest() { } } } + + @Test + fun `default constructor should get the package name`() { + testInline( + """ + |/src/main/java/org/test/A.java + |package org.test; + |public class A { + |} + """.trimIndent(), + configuration + ) { + documentablesMergingStage = { module -> + val testedClass = module.findClasslike(packageName = "org.test", "A") as DClass + + assertEquals(1, testedClass.constructors.size, "Expect 1 default constructor") + + val constructorDRI = testedClass.constructors.first().dri + assertEquals("org.test", constructorDRI.packageName) + assertEquals("A", constructorDRI.classNames) + } + } + } } private fun DFunction.visibility() = visibility.values.first() diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder.kt index 1802a73757..deff505081 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder.kt @@ -465,9 +465,9 @@ open class GradleDokkaSourceSetBuilder( fun externalDocumentationLink(url: URL, packageListUrl: URL? = null) { externalDocumentationLinks.add( GradleExternalDocumentationLinkBuilder(project).apply { - this.url by url + this.url.convention(url) if (packageListUrl != null) { - this.packageListUrl by packageListUrl + this.packageListUrl.convention(packageListUrl) } } ) @@ -475,4 +475,3 @@ open class GradleDokkaSourceSetBuilder( override fun build(): DokkaSourceSetImpl = toDokkaSourceSetImpl() } - diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/sourceSetKotlinGistConfiguration.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/sourceSetKotlinGistConfiguration.kt index b14e4f5235..0a0c7854e2 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/sourceSetKotlinGistConfiguration.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/sourceSetKotlinGistConfiguration.kt @@ -14,15 +14,15 @@ internal fun GradleDokkaSourceSetBuilder.configureWithKotlinSourceSetGist(source sourceSetNames.map { sourceSetName -> DokkaSourceSetID(sourceSetName) } } - this.suppress by sourceSet.isMain.map { !it } + this.suppress.convention(sourceSet.isMain.map { !it }) this.sourceRoots.from(sourceSet.sourceRoots) this.classpath.from(sourceSet.classpath) - this.platform by sourceSet.platform.map { Platform.fromString(it.name) } - this.dependentSourceSets by dependentSourceSetIds - this.displayName by sourceSet.platform.map { platform -> + this.platform.convention(sourceSet.platform.map { Platform.fromString(it.name) }) + this.dependentSourceSets.convention(dependentSourceSetIds) + this.displayName.convention(sourceSet.platform.map { platform -> sourceSet.name.substringBeforeLast( delimiter = "Main", missingDelimiterValue = platform.name ) - } + }) } diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt index 0f2482dbb6..37ec66c13d 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt @@ -3,31 +3,15 @@ package org.jetbrains.dokka.gradle import org.gradle.api.NamedDomainObjectContainer import org.gradle.api.Project import org.gradle.api.UnknownDomainObjectException -import org.gradle.api.provider.HasMultipleValues -import org.gradle.api.provider.Property -import org.gradle.api.provider.Provider -import org.gradle.kotlin.dsl.* import org.gradle.util.Path +import org.gradle.kotlin.dsl.findByType +import org.gradle.kotlin.dsl.getByType import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType import org.jetbrains.kotlin.gradle.plugin.KotlinTarget -internal infix fun Property.by(value: T?) { - this.set(value) -} - -internal infix fun Property.by(value: Provider) { - this.set(value) -} - -internal infix fun HasMultipleValues.by(values: Iterable) { - this.set(values) -} - -internal infix fun HasMultipleValues.by(values: Provider>) { - this.set(values) -} +/** Parse a Gradle path, e.g. `:project:subproject:taskName` */ internal fun parsePath(path: String): Path = Path.path(path) internal val Project.kotlinOrNull: KotlinProjectExtension? diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/CheckSourceSetDependenciesTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/CheckSourceSetDependenciesTest.kt index cc0efea439..2cd216fdc0 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/CheckSourceSetDependenciesTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/CheckSourceSetDependenciesTest.kt @@ -50,7 +50,7 @@ class CheckSourceSetDependenciesTest { GradleDokkaSourceSetBuilder("common", project), GradleDokkaSourceSetBuilder("intermediate", project).apply { dependsOn("common") - suppress by true + suppress.set(true) }, GradleDokkaSourceSetBuilder("jvm", project).apply { dependsOn("intermediate") diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationJsonTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationJsonTest.kt index 1469bda6af..733595fe62 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationJsonTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationJsonTest.kt @@ -1,5 +1,3 @@ -@file:Suppress("UnstableApiUsage") - package org.jetbrains.dokka.gradle import org.gradle.kotlin.dsl.withType @@ -9,11 +7,11 @@ import org.jetbrains.dokka.DokkaDefaults.documentedVisibilities import org.jetbrains.dokka.DokkaDefaults.includeNonPublic import org.jetbrains.dokka.DokkaDefaults.reportUndocumented import org.jetbrains.dokka.DokkaDefaults.skipDeprecated +import org.jetbrains.dokka.gradle.tasks.DokkaTask import java.io.File import java.net.URL import kotlin.test.Test import kotlin.test.assertEquals -import org.jetbrains.dokka.gradle.tasks.DokkaTask class DokkaConfigurationJsonTest { @@ -24,25 +22,29 @@ class DokkaConfigurationJsonTest { val dokkaTask = project.tasks.withType().first() dokkaTask.plugins.withDependencies { clear() } dokkaTask.apply { - this.failOnWarning by true - this.offlineMode by true - this.outputDirectory by File("customOutputDir") - this.cacheRoot by File("customCacheRoot") - this.pluginsConfiguration.add(PluginConfigurationImpl("A", DokkaConfiguration.SerializationFormat.JSON, """ { "key" : "value1" } """)) - this.pluginsConfiguration.add(PluginConfigurationImpl("B", DokkaConfiguration.SerializationFormat.JSON, """ { "key" : "value2" } """)) + this.failOnWarning.set(true) + this.offlineMode.set(true) + this.outputDirectory.set(File("customOutputDir")) + this.cacheRoot.set(File("customCacheRoot")) + this.pluginsConfiguration.add( + PluginConfigurationImpl("A", DokkaConfiguration.SerializationFormat.JSON, """ { "key" : "value1" } """) + ) + this.pluginsConfiguration.add( + PluginConfigurationImpl("B", DokkaConfiguration.SerializationFormat.JSON, """ { "key" : "value2" } """) + ) this.dokkaSourceSets.create("main") { - displayName by "customSourceSetDisplayName" - reportUndocumented by true + displayName.set("customSourceSetDisplayName") + reportUndocumented.set(true) externalDocumentationLink { - packageListUrl by URL("http://some.url") - url by URL("http://some.other.url") + packageListUrl.set(URL("http://some.url")) + url.set(URL("http://some.other.url")) } perPackageOption { - includeNonPublic by true - reportUndocumented by true - skipDeprecated by true - documentedVisibilities by setOf(DokkaConfiguration.Visibility.PRIVATE) + includeNonPublic.set(true) + reportUndocumented.set(true) + skipDeprecated.set(true) + documentedVisibilities.set(setOf(DokkaConfiguration.Visibility.PRIVATE)) } } } diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationSerializableTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationSerializableTest.kt index 59c6c7bc2e..d585613442 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationSerializableTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationSerializableTest.kt @@ -30,26 +30,26 @@ class DokkaConfigurationSerializableTest { val dokkaTask = project.tasks.withType().first() dokkaTask.plugins.withDependencies { clear() } dokkaTask.apply { - this.failOnWarning by true - this.offlineMode by true - this.outputDirectory by File("customOutputDir") - this.cacheRoot by File("customCacheRoot") + this.failOnWarning.set(true) + this.offlineMode.set(true) + this.outputDirectory.set(File("customOutputDir")) + this.cacheRoot.set(File("customCacheRoot")) this.pluginsConfiguration.add(PluginConfigurationImpl("A", DokkaConfiguration.SerializationFormat.JSON, """ { "key" : "value1" } """)) this.pluginsConfiguration.add(PluginConfigurationImpl("B", DokkaConfiguration.SerializationFormat.JSON, """ { "key" : "value2" } """)) this.dokkaSourceSets.create("main") { - displayName by "customSourceSetDisplayName" - reportUndocumented by true + displayName.set("customSourceSetDisplayName") + reportUndocumented.set(true) externalDocumentationLink { - packageListUrl by URL("http://some.url") - url by URL("http://some.other.url") + packageListUrl.set(URL("http://some.url")) + url.set(URL("http://some.other.url")) } perPackageOption { - includeNonPublic by true - reportUndocumented by true - skipDeprecated by true - documentedVisibilities by setOf(DokkaConfiguration.Visibility.PRIVATE) + includeNonPublic.set(true) + reportUndocumented.set(true) + skipDeprecated.set(true) + documentedVisibilities.set(setOf(DokkaConfiguration.Visibility.PRIVATE)) } } } diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayoutTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayoutTest.kt index 4b3c3421f0..dc3257699f 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayoutTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleFileLayoutTest.kt @@ -21,7 +21,7 @@ class DokkaMultiModuleFileLayoutTest { val project = ProjectBuilder.builder().build() val child = project.tasks.create("child") val parent = project.tasks.create("parent") - child.outputDirectory by File("some/path") + child.outputDirectory.set(File("some/path")) assertEquals( File("some/path"), NoCopy.targetChildOutputDirectory(parent, child), @@ -60,11 +60,7 @@ class DokkaMultiModuleFileLayoutTest { subFolder.mkdirs() subFolder.resolve("other.file").writeText("other text") - parentTask.fileLayout by object : DokkaMultiModuleFileLayout { - override fun targetChildOutputDirectory(parent: DokkaMultiModuleTask, child: AbstractDokkaTask): File { - return parent.project.file("target/output") - } - } + parentTask.fileLayout.set(DokkaMultiModuleFileLayout { parent, _ -> parent.project.file("target/output") }) parentTask.copyChildOutputDirectory(childTask) /* Assertions */ @@ -108,9 +104,9 @@ class DokkaMultiModuleFileLayoutTest { val project = ProjectBuilder.builder().build() val childTask = project.tasks.create("child") val parentTask = project.tasks.create("parent") - parentTask.fileLayout by DokkaMultiModuleFileLayout { _, child -> + parentTask.fileLayout.set(DokkaMultiModuleFileLayout { _, child -> child.outputDirectory.getSafe().resolve("subfolder") - } + }) assertFailsWith { parentTask.copyChildOutputDirectory(childTask) } } @@ -119,7 +115,7 @@ class DokkaMultiModuleFileLayoutTest { val project = ProjectBuilder.builder().build() val childTask = project.tasks.create("child") val parentTask = project.tasks.create("parent") - parentTask.fileLayout by NoCopy + parentTask.fileLayout.set(NoCopy) parentTask.copyChildOutputDirectory(childTask) } } diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderTest.kt index 0247a82f92..fb834ff883 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderTest.kt @@ -62,8 +62,7 @@ class GradleDokkaSourceSetBuilderTest { "after building source set with no ${GradleDokkaSourceSetBuilder::displayName.name} being set" ) - sourceSet.displayName by "displayName" - + sourceSet.displayName.set("displayName") assertEquals( "displayName", sourceSet.build().displayName, "Expected previously set ${GradleDokkaSourceSetBuilder::displayName.name} to be present after build" @@ -220,21 +219,21 @@ class GradleDokkaSourceSetBuilderTest { sourceSet.sourceLinks.add( GradleSourceLinkBuilder(project).apply { - this.remoteLineSuffix by "ls1" - this.localDirectory by project.file("p1") - this.remoteUrl by URL("https://u1") + this.remoteLineSuffix.set("ls1") + this.localDirectory.set(project.file("p1")) + this.remoteUrl.set(URL("https://u1")) }) sourceSet.sourceLink { - remoteLineSuffix by "ls2" - localDirectory by project.file("p2") - remoteUrl by URL("https://u2") + remoteLineSuffix.set("ls2") + localDirectory.set(project.file("p2")) + remoteUrl.set(URL("https://u2")) } sourceSet.sourceLink(project.closureOf { - this.remoteLineSuffix by "ls3" - this.localDirectory by project.file("p3") - this.remoteUrl by URL("https://u3") + this.remoteLineSuffix.set("ls3") + this.localDirectory.set(project.file("p3")) + this.remoteUrl.set(URL("https://u3")) }) assertEquals( @@ -266,15 +265,15 @@ class GradleDokkaSourceSetBuilderTest { assertEquals(emptyList(), sourceSet.build().perPackageOptions, "Expected no default per package options") sourceSet.perPackageOptions.add(GradlePackageOptionsBuilder(project).apply { - this.matchingRegex by "p1.*" + this.matchingRegex.set("p1.*") }) sourceSet.perPackageOption { - matchingRegex by "p2.*" + matchingRegex.set("p2.*") } sourceSet.perPackageOption(project.closureOf { - this.matchingRegex by "p3.*" + this.matchingRegex.set("p3.*") }) assertEquals( @@ -296,9 +295,9 @@ class GradleDokkaSourceSetBuilderTest { @Test fun externalDocumentationLink() { val sourceSet = GradleDokkaSourceSetBuilder("", project) - sourceSet.noAndroidSdkLink by true - sourceSet.noJdkLink by true - sourceSet.noStdlibLink by true + sourceSet.noAndroidSdkLink.set(true) + sourceSet.noJdkLink.set(true) + sourceSet.noStdlibLink.set(true) assertEquals( emptySet(), sourceSet.build().externalDocumentationLinks, "Expected no default external documentation links" @@ -306,17 +305,17 @@ class GradleDokkaSourceSetBuilderTest { sourceSet.externalDocumentationLinks.add( GradleExternalDocumentationLinkBuilder(project).apply { - this.url by URL("https://u1") - this.packageListUrl by URL("https://pl1") + this.url.set(URL("https://u1")) + this.packageListUrl.set(URL("https://pl1")) } ) sourceSet.externalDocumentationLink { - url by URL("https://u2") + url.set(URL("https://u2")) } sourceSet.externalDocumentationLink(project.closureOf { - url by URL("https://u3") + url.set(URL("https://u3")) }) sourceSet.externalDocumentationLink(url = "https://u4", packageListUrl = "https://pl4") @@ -340,7 +339,7 @@ class GradleDokkaSourceSetBuilderTest { val sourceSet = GradleDokkaSourceSetBuilder("", project) assertNull(sourceSet.build().languageVersion, "Expected no language version being set by default") - sourceSet.languageVersion by "JAVA_20" + sourceSet.languageVersion.set("JAVA_20") assertEquals( "JAVA_20", sourceSet.build().languageVersion, "Expected previously set language version to be present after build" @@ -352,7 +351,7 @@ class GradleDokkaSourceSetBuilderTest { val sourceSet = GradleDokkaSourceSetBuilder("", project) assertNull(sourceSet.build().apiVersion, "Expected no api version being set by default") - sourceSet.apiVersion by "20" + sourceSet.apiVersion.set("20") assertEquals( "20", sourceSet.build().apiVersion, "Expected previously set api version to be present after build" @@ -368,7 +367,7 @@ class GradleDokkaSourceSetBuilderTest { "https://kotlinlang.org/api" in it.url.toURI().toString() }, "Expected kotlin stdlib in external documentation links") - sourceSet.noStdlibLink by true + sourceSet.noStdlibLink.set(true) assertEquals( 0, sourceSet.build().externalDocumentationLinks.count { @@ -386,7 +385,7 @@ class GradleDokkaSourceSetBuilderTest { "https://docs.oracle.com/" in it.url.toURI().toString() }, "Expected java jdk in external documentation links") - sourceSet.noJdkLink by true + sourceSet.noJdkLink.set(true) assertEquals( 0, sourceSet.build().externalDocumentationLinks.count { @@ -417,18 +416,20 @@ class GradleDokkaSourceSetBuilderTest { }, "Expected android sdk in external documentation links") assertEquals(1, sourceSet.build().externalDocumentationLinks.count { - "https://developer.android.com/reference/kotlin/androidx/package-list" in it.packageListUrl.toURI().toString() + "https://developer.android.com/reference/kotlin/androidx/package-list" in it.packageListUrl.toURI() + .toString() }, "Expected androidx in external documentation links") - sourceSet.noAndroidSdkLink by true + sourceSet.noAndroidSdkLink.set(true) assertEquals(0, sourceSet.build().externalDocumentationLinks.count { "https://developer.android.com/reference" in it.url.toURI().toString() }, "Expected no android sdk in external documentation links") assertEquals(0, sourceSet.build().externalDocumentationLinks.count { - "https://developer.android.com/reference/kotlin/androidx/package-list" in it.packageListUrl.toURI().toString() + "https://developer.android.com/reference/kotlin/androidx/package-list" in it.packageListUrl.toURI() + .toString() }, "Expected no androidx in external documentation links") } @@ -479,7 +480,7 @@ class GradleDokkaSourceSetBuilderTest { val sourceSet = GradleDokkaSourceSetBuilder("", project) assertEquals(Platform.DEFAULT, sourceSet.build().analysisPlatform, "Expected default platform if not specified") - sourceSet.platform by Platform.common + sourceSet.platform.set(Platform.common) assertEquals( Platform.common, sourceSet.build().analysisPlatform, "Expected previously set analysis platform being present after build" diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinDslDokkaTaskConfigurationTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinDslDokkaTaskConfigurationTest.kt index ac5a010f5f..9b00e7b9f8 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinDslDokkaTaskConfigurationTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinDslDokkaTaskConfigurationTest.kt @@ -15,7 +15,7 @@ class KotlinDslDokkaTaskConfigurationTest { val project = ProjectBuilder.builder().build() project.plugins.apply("org.jetbrains.dokka") project.tasks.withType().configureEach { - outputDirectory by File("test") + outputDirectory.set(File("test")) } project.tasks.withType(DokkaTask::class.java).forEach { dokkaTask -> diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/tasks/DokkaCollectorTaskTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/tasks/DokkaCollectorTaskTest.kt index c556e4090f..633703d91d 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/tasks/DokkaCollectorTaskTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/tasks/DokkaCollectorTaskTest.kt @@ -39,11 +39,11 @@ class DokkaCollectorTaskTest { val collectorTasks = rootProject.tasks.withType() collectorTasks.configureEach { - moduleName by "custom Module Name" - outputDirectory by File("customOutputDirectory") - cacheRoot by File("customCacheRoot") - failOnWarning by true - offlineMode by true + moduleName.set("custom Module Name") + outputDirectory.set(File("customOutputDirectory")) + cacheRoot.set(File("customCacheRoot")) + failOnWarning.set(true) + offlineMode.set(true) } assertTrue(collectorTasks.isNotEmpty(), "Expected at least one collector task") diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/tasks/DokkaMultiModuleTaskTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/tasks/DokkaMultiModuleTaskTest.kt index b5fa817ad6..db70f52878 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/tasks/DokkaMultiModuleTaskTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/tasks/DokkaMultiModuleTaskTest.kt @@ -62,13 +62,19 @@ class DokkaMultiModuleTaskTest { } multiModuleTask.apply { - moduleVersion by "1.5.0" - moduleName by "custom Module Name" - outputDirectory by project.buildDir.resolve("customOutputDirectory") - cacheRoot by File("customCacheRoot") - pluginsConfiguration.add(PluginConfigurationImpl("pluginA", DokkaConfiguration.SerializationFormat.JSON, """ { "key" : "value2" } """)) - failOnWarning by true - offlineMode by true + moduleVersion.set("1.5.0") + moduleName.set("custom Module Name") + outputDirectory.set(project.buildDir.resolve("customOutputDirectory")) + cacheRoot.set(File("customCacheRoot")) + pluginsConfiguration.add( + PluginConfigurationImpl( + "pluginA", + DokkaConfiguration.SerializationFormat.JSON, + """ { "key" : "value2" } """ + ) + ) + failOnWarning.set(true) + offlineMode.set(true) includes.from(listOf(topLevelInclude)) } @@ -79,7 +85,13 @@ class DokkaMultiModuleTaskTest { moduleVersion = "1.5.0", outputDir = multiModuleTask.project.buildDir.resolve("customOutputDirectory"), cacheRoot = File("customCacheRoot"), - pluginsConfiguration = mutableListOf(PluginConfigurationImpl("pluginA", DokkaConfiguration.SerializationFormat.JSON, """ { "key" : "value2" } """)), + pluginsConfiguration = mutableListOf( + PluginConfigurationImpl( + "pluginA", + DokkaConfiguration.SerializationFormat.JSON, + """ { "key" : "value2" } """ + ) + ), pluginsClasspath = emptyList(), failOnWarning = true, offlineMode = true, @@ -98,14 +110,14 @@ class DokkaMultiModuleTaskTest { } @Test - fun `multimodule task should not include unspecified version`(){ + fun `multimodule task should not include unspecified version`() { childDokkaTask.apply { dokkaSourceSets.create("main") dokkaSourceSets.create("test") } multiModuleTask.apply { - moduleVersion by "unspecified" + moduleVersion.set("unspecified") } val dokkaConfiguration = multiModuleTask.buildDokkaConfiguration() @@ -118,7 +130,10 @@ class DokkaMultiModuleTaskTest { assertEquals(1, dependenciesInitial.size, "Expected one dependency") val dependency = dependenciesInitial.single() - assertTrue(dependency is DokkaTaskPartial, "Expected dependency to be of Type ${DokkaTaskPartial::class.simpleName}") + assertTrue( + dependency is DokkaTaskPartial, + "Expected dependency to be of Type ${DokkaTaskPartial::class.simpleName}" + ) assertEquals(childProject, dependency.project, "Expected dependency from child project") @@ -185,7 +200,7 @@ class DokkaMultiModuleTaskTest { val childTask = child.tasks.create("child") parentTask.addChildTask(childTask) - childTask.outputDirectory by child.file("custom/output") + childTask.outputDirectory.set(child.file("custom/output")) assertEquals( listOf(parent.file("child/custom/output")), parentTask.sourceChildOutputDirectories, @@ -203,10 +218,9 @@ class DokkaMultiModuleTaskTest { parentTask.addChildTask(childTask) - @Suppress("NAME_SHADOWING") // ¯\_(ツ)_/¯ - parentTask.fileLayout by DokkaMultiModuleFileLayout { parent, child -> - parent.project.buildDir.resolve(child.name) - } + parentTask.fileLayout.set(DokkaMultiModuleFileLayout { taskParent, taskChild -> + taskParent.project.buildDir.resolve(taskChild.name) + }) assertEquals( listOf(parent.project.buildDir.resolve("child")), parentTask.targetChildOutputDirectories, diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/tasks/DokkaTaskTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/tasks/DokkaTaskTest.kt index ee6ad50bde..c405f83442 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/tasks/DokkaTaskTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/tasks/DokkaTaskTest.kt @@ -18,7 +18,7 @@ class DokkaTaskTest { task.dokkaSourceSets.register("main") task.dokkaSourceSets.register("jvm") task.dokkaSourceSets.register("test") { - suppress by true + suppress.set(true) } assertEquals( diff --git a/runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt b/runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt index 4b5f4fa983..ac8ed37673 100644 --- a/runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt +++ b/runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt @@ -2,14 +2,23 @@ package org.jetbrains.dokka.maven import org.apache.maven.plugin.logging.Log import org.jetbrains.dokka.utilities.DokkaLogger +import java.util.concurrent.atomic.AtomicInteger class MavenDokkaLogger(val log: Log) : DokkaLogger { - override var warningsCount: Int = 0 - override var errorsCount: Int = 0 + private val warningsCounter = AtomicInteger() + private val errorsCounter = AtomicInteger() + + override var warningsCount: Int + get() = warningsCounter.get() + set(value) = warningsCounter.set(value) + + override var errorsCount: Int + get() = errorsCounter.get() + set(value) = errorsCounter.set(value) override fun debug(message: String) = log.debug(message) override fun info(message: String) = log.info(message) override fun progress(message: String) = log.info(message) - override fun warn(message: String) = log.warn(message).also { warningsCount++ } - override fun error(message: String) = log.error(message).also { errorsCount++ } + override fun warn(message: String) = log.warn(message).also { warningsCounter.incrementAndGet() } + override fun error(message: String) = log.error(message).also { errorsCounter.incrementAndGet() } }