Skip to content

Commit

Permalink
Merge branch 'feat/apply_kotlin_dsl_plugin' into feat/move_tasks_into…
Browse files Browse the repository at this point in the history
…_task_package

# Conflicts:
#	runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationJsonTest.kt
  • Loading branch information
aSemy committed Feb 1, 2023
2 parents 49db2ad + 0994afb commit 8754121
Show file tree
Hide file tree
Showing 62 changed files with 323 additions and 190 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/check.yml
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/dokka-examples.yml
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/gradle-test.pr.yml
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/qodana.yml
Expand Up @@ -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
Expand Down
17 changes: 13 additions & 4 deletions 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

Expand All @@ -11,8 +12,16 @@ import java.util.function.BiConsumer
class DokkaBootstrapImpl : DokkaBootstrap {

class DokkaProxyLogger(val consumer: BiConsumer<String, String>) : 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)
Expand All @@ -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() }
}
}

Expand Down
18 changes: 14 additions & 4 deletions 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
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
16 changes: 11 additions & 5 deletions 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<String>()
private var _debugMessages = synchronizedMutableListOf<String>()
val debugMessages: List<String> get() = _debugMessages.toList()

private var _infoMessages = mutableListOf<String>()
private var _infoMessages = synchronizedMutableListOf<String>()
val infoMessages: List<String> get() = _infoMessages.toList()

private var _progressMessages = mutableListOf<String>()
private var _progressMessages = synchronizedMutableListOf<String>()
val progressMessages: List<String> get() = _progressMessages.toList()

private var _warnMessages = mutableListOf<String>()
private var _warnMessages = synchronizedMutableListOf<String>()
val warnMessages: List<String> get() = _warnMessages.toList()

private var _errorMessages = mutableListOf<String>()
private var _errorMessages = synchronizedMutableListOf<String>()
val errorMessages: List<String> get() = _errorMessages.toList()

override fun debug(message: String) {
Expand All @@ -45,4 +49,6 @@ class TestLogger(private val logger: DokkaLogger) : DokkaLogger {
_errorMessages.add(message)
logger.error(message)
}

private fun <T> synchronizedMutableListOf(): MutableList<T> = Collections.synchronizedList(mutableListOf())
}
Binary file not shown.
@@ -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
12 changes: 8 additions & 4 deletions examples/gradle/dokka-customFormat-example/gradlew
Expand Up @@ -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/.
Expand All @@ -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"'
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions examples/gradle/dokka-customFormat-example/gradlew.bat
Expand Up @@ -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%

Expand Down
Binary file not shown.
@@ -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
12 changes: 8 additions & 4 deletions examples/gradle/dokka-gradle-example/gradlew
Expand Up @@ -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/.
Expand All @@ -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"'
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions examples/gradle/dokka-gradle-example/gradlew.bat
Expand Up @@ -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%

Expand Down
Binary file not shown.
@@ -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
12 changes: 8 additions & 4 deletions examples/gradle/dokka-kotlinAsJava-example/gradlew
Expand Up @@ -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/.
Expand All @@ -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"'
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions examples/gradle/dokka-kotlinAsJava-example/gradlew.bat
Expand Up @@ -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%

Expand Down
Binary file not shown.
@@ -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
12 changes: 8 additions & 4 deletions examples/gradle/dokka-library-publishing-example/gradlew
Expand Up @@ -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/.
Expand All @@ -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"'
Expand Down Expand Up @@ -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
Expand Down
Expand Up @@ -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%

Expand Down
Binary file not shown.

0 comments on commit 8754121

Please sign in to comment.