Make Dokka work

Fix deprecations
This commit is contained in:
Abe Pazos
2025-07-22 13:14:55 +02:00
parent b4d27198ea
commit 77f30d4d84
10 changed files with 63 additions and 41 deletions

View File

@@ -8,7 +8,7 @@ repositories {
mavenCentral()
}
task buildMainReadme {
tasks.register('buildMainReadme') {
doFirst {
def subProjects = project.subprojects
//.findAll { !it.name.contains("kinect-common") && !it.name.contains
@@ -37,7 +37,7 @@ task buildMainReadme {
// Skip the hash character from the headline, then start
// on the next line and continue until the next empty line.
// Don't fall into Windows line breaks.
def descriptionRx = ~/(?s)\#.*?\n(.+?)\n\r?\n/
def descriptionRx = ~/(?s)#.*?\n(.+?)\n\r?\n/
// Note: the readme needs an empty line after the description
def orxMultiplatform = []
@@ -93,8 +93,8 @@ group = "org.openrndr.extra"
nexusPublishing {
repositories {
sonatype {
username.set(findProperty("ossrhUsername") ?: System.getenv("OSSRH_USERNAME"))
password.set(findProperty("ossrhPassword") ?: System.getenv("OSSRH_PASSWORD"))
username.set(findProperty("ossrhUsername")?.toString() ?: System.getenv("OSSRH_USERNAME"))
password.set(findProperty("ossrhPassword")?.toString() ?: System.getenv("OSSRH_PASSWORD"))
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots"))
}
@@ -109,6 +109,14 @@ subprojects {
}
}
dependencies {
subprojects.findAll {
it.name.startsWith("orx-")
}.each { subproject ->
dokka(project(subproject.path))
}
}
gradle.buildFinished {
println("\n")
println("orx = \"${version}\"")

View File

@@ -1,8 +1,5 @@
package org.openrndr.extra.convention
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import java.net.URL
plugins {
id("org.jetbrains.dokka")
}
@@ -11,27 +8,31 @@ repositories {
mavenCentral()
}
tasks.withType<DokkaTaskPartial>() {
dokkaSourceSets {
configureEach {
skipDeprecated.set(true)
val sourcesDirectory = try {
file("src/$name/kotlin", PathValidation.EXISTS)
} catch (_: InvalidUserDataException) {
return@configureEach
}
// Specifies the location of the project source code on the Web.
// If provided, Dokka generates "source" links for each declaration.
sourceLink {
// Unix based directory relative path to the root of the project (where you execute gradle respectively).
localDirectory.set(sourcesDirectory)
// URL showing where the source code can be accessed through the web browser
remoteUrl.set(
URL("https://github.com/openrndr/orx/blob/master/${moduleName.get()}/src/$name/kotlin")
)
// Suffix which is used to append the line number to the URL. Use #L for GitHub
remoteLineSuffix.set("#L")
}
dokka {
pluginsConfiguration.html {
customStyleSheets.from(rootProject.file("dokka/styles/extra.css"))
customAssets.from(rootProject.file("dokka/images/logo-icon.svg"))
}
dokkaSourceSets.configureEach {
skipDeprecated.set(false)
val sourcesDirectory = try {
file("src/$name/kotlin", PathValidation.EXISTS)
} catch (_: InvalidUserDataException) {
return@configureEach
}
// Specifies the location of the project source code on the Web.
// If provided, Dokka generates "source" links for each declaration.
sourceLink {
// Unix based directory relative path to the root of the project (where you execute gradle respectively).
localDirectory = sourcesDirectory
// URL showing where the source code can be accessed through the web browser
remoteUrl("https://github.com/openrndr/orx/blob/master/${moduleName.get()}/src/$name/kotlin")
// Suffix which is used to append the line number to the URL. Use #L for GitHub
remoteLineSuffix.set("#L")
}
}
}

View File

@@ -116,7 +116,7 @@ val isReleaseVersion = !(version.toString()).endsWith("SNAPSHOT")
if (shouldPublish) {
publishing {
publications {
val fjdj = tasks.create("fakeJavaDocJar", Jar::class) {
val fjdj = tasks.register("fakeJavaDocJar", Jar::class) {
archiveClassifier.set("javadoc")
}
named("js") {

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="48" height="48" version="1.2" viewBox="0 0 12.7 12.7" xmlns="http://www.w3.org/2000/svg"><rect width="12.7" height="12.7" fill="#ffc0cb" stroke-width="1.027"/><g stop-color="#000000" stroke-width=".6"><path d="m4.135 8.32-0.333-1.123h-1.383l-0.333 1.123h-0.4911l1.208-3.94h0.6265l1.208 3.94zm-0.9991-3.437h-0.0508l-0.5532 1.902h1.157z"/><path d="m5.314 8.32v-3.94h1.434q0.5475 0 0.8354 0.2992 0.2879 0.2992 0.2879 0.8354t-0.2879 0.8354q-0.2879 0.2992-0.8354 0.2992h-0.9596v1.671zm0.4741-2.083h0.9483q0.2992 0 0.4628-0.1468 0.1693-0.1524 0.1693-0.429v-0.2935q0-0.2766-0.1693-0.4233-0.1637-0.1524-0.4628-0.1524h-0.9483z"/><path d="m8.667 8.32v-0.3782h0.9821v-3.183h-0.9821v-0.3782h2.438v0.3782h-0.9821v3.183h0.9821v0.3782z"/></g></svg>

After

Width:  |  Height:  |  Size: 785 B

4
dokka/styles/extra.css Normal file
View File

@@ -0,0 +1,4 @@
.library-name--link { text-transform: uppercase; }
.library-version { top: 0px; margin-left: 10px; }

View File

@@ -1,6 +1,7 @@
# suppress inspection "UnusedProperty" for whole file
kotlin.code.style=official
# For optimal compilation performance
org.gradle.jvmargs=-Xmx2G -XX:+UseParallelGC
kotlin.incremental.multiplatform=true
@@ -8,7 +9,15 @@ kotlin.incremental.multiplatform=true
kotlin.jvm.target.validation.mode=error
org.gradle.parallel=true
org.gradle.caching=true
#org.gradle.configuration-cache=true
#org.gradle.configuration-cache.parallel=true
#org.gradle.configuration-cache.problems=warn
# Whether to automatically bundle the Kotlin standard library (true by default)
# https://kotlinlang.org/docs/gradle.html#dependency-on-the-standard-library
kotlin.stdlib.default.dependency=true
kotlin.mpp.import.legacyTestSourceSetDetection=true
# Enable Dokka 2.0.0
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled

View File

@@ -8,7 +8,7 @@ kotlinxCoroutines = "1.10.2"
kotlinLogging = "7.0.7"
kotlinxSerialization = "1.9.0"
kotest = "5.9.1"
dokka = "1.7.10"
dokka = "2.0.0"
nebulaRelease = "18.0.7"
gradleNexusPublish = "2.0.0"
boofcv = "1.2.3"

View File

@@ -50,10 +50,7 @@ kotlin {
}
}
tasks.withType<KotlinCompilationTask<*>> {
dependsOn(generateKotlinGrammarSource)
}
tasks.withType<org.gradle.jvm.tasks.Jar> {
dependsOn(generateKotlinGrammarSource)
}
tasks.withType<KotlinCompilationTask<*>> { dependsOn(generateKotlinGrammarSource) }
tasks.withType<org.gradle.jvm.tasks.Jar> { dependsOn(generateKotlinGrammarSource) }
tasks.named("dokkaGeneratePublicationHtml") { dependsOn(generateKotlinGrammarSource) }
tasks.named("dokkaGenerateModuleHtml") { dependsOn(generateKotlinGrammarSource) }

View File

@@ -23,3 +23,5 @@ dependencies {
tasks.getByName("compileKotlin").dependsOn("generateGrammarSource")
tasks.getByName("sourcesJar").dependsOn("generateGrammarSource")
tasks.named("dokkaGeneratePublicationHtml") { dependsOn("generateGrammarSource") }
tasks.named("dokkaGenerateModuleHtml") { dependsOn("generateGrammarSource") }

View File

@@ -72,7 +72,6 @@ include(
"orx-shade-styles",
"orx-shapes",
"orx-svg",
"orx-jvm:orx-syphon",
"orx-temporal-blur",
"orx-timer",