Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Dokka 2.0.0 #1732

Merged
merged 6 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 32 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import com.squareup.anvil.plugin.AnvilExtension
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import java.net.URI
import kotlinx.validation.ExperimentalBCVApi
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import org.jetbrains.dokka.gradle.DokkaExtension
import org.jetbrains.dokka.gradle.engine.parameters.VisibilityModifier
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginExtension
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinJsCompilerOptions
Expand Down Expand Up @@ -62,9 +62,11 @@ val ktfmtVersion = libs.versions.ktfmt.get()
val detektVersion = libs.versions.detekt.get()
val twitterDetektPlugin = libs.detektPlugins.twitterCompose

tasks.dokkaHtmlMultiModule {
outputDirectory.set(rootDir.resolve("docs/api/0.x"))
includes.from(project.layout.projectDirectory.file("README.md"))
dokka {
dokkaPublications.html {
outputDirectory.set(rootDir.resolve("docs/api/0.x"))
includes.from(project.layout.projectDirectory.file("README.md"))
}
}

allprojects {
Expand Down Expand Up @@ -263,9 +265,9 @@ subprojects {
pluginManager.withPlugin("com.vanniktech.maven.publish") {
apply(plugin = "org.jetbrains.dokka")

tasks.withType<DokkaTaskPartial>().configureEach {
configure<DokkaExtension> {
moduleName.set(project.path.removePrefix(":").replace(":", "/"))
outputDirectory.set(layout.buildDirectory.dir("docs/partial"))
basePublicationsDirectory.set(layout.buildDirectory.dir("dokkaDir"))
dokkaSourceSets.configureEach {
val readMeProvider = project.layout.projectDirectory.file("README.md")
if (readMeProvider.asFile.exists()) {
Expand All @@ -276,6 +278,7 @@ subprojects {
suppress.set(true)
}
skipDeprecated.set(true)
documentedVisibilities.add(VisibilityModifier.Public)

// Skip internal packages
perPackageOption {
Expand All @@ -287,11 +290,11 @@ subprojects {

// Add source links
sourceLink {
localDirectory.set(layout.projectDirectory.dir("src").asFile)
localDirectory.set(layout.projectDirectory.dir("src"))
val relPath = rootProject.projectDir.toPath().relativize(projectDir.toPath())
remoteUrl.set(
remoteUrl(
providers.gradleProperty("POM_SCM_URL").map { scmUrl ->
URI("$scmUrl/tree/main/$relPath/src").toURL()
"$scmUrl/tree/main/$relPath/src"
}
)
remoteLineSuffix.set("#L")
Expand Down Expand Up @@ -499,3 +502,22 @@ apiValidation {
"internal-test-utils",
)
}

// Dokka aggregating deps
dependencies {
dokka(projects.backstack)
dokka(projects.circuitCodegen)
dokka(projects.circuitCodegenAnnotations)
dokka(projects.circuitFoundation)
dokka(projects.circuitOverlay)
dokka(projects.circuitRetained)
dokka(projects.circuitRuntime)
dokka(projects.circuitRuntimePresenter)
dokka(projects.circuitRuntimeScreen)
dokka(projects.circuitRuntimeUi)
dokka(projects.circuitTest)
dokka(projects.circuitx.android)
dokka(projects.circuitx.effects)
dokka(projects.circuitx.gestureNavigation)
dokka(projects.circuitx.overlays)
}
2 changes: 1 addition & 1 deletion deploy_website.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if ! [[ ${local} ]]; then
cd ${DIR}

# Generate the API docs
./gradlew dokkaHtmlMultiModule --no-configuration-cache
./gradlew :dokkaGenerate
fi

# Copy in special files that GitHub wants in the project root.
Expand Down
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ android.lint.useK2Uast=true
# TODO blocked on https://github.com/google/ksp/issues/2091
ksp.useKSP2=false

# Dokka flags
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true

# SKIE sets max versions, so we leave this in (even if commented out) for ease of use with new
# Kotlin versions
skie.kgpVersion=2.0.20
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ compose-integration-constraintlayout = "1.1.0"
dagger = "2.52"
datastore = "1.1.1"
detekt = "1.23.7"
dokka = "1.9.20"
dokka = "2.0.0"
eithernet = "2.0.0"
jdk = "22"
jvmTarget = "11"
Expand Down
2 changes: 1 addition & 1 deletion release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ git commit -am "Prepare for release $NEW_VERSION."
git tag -a "$NEW_VERSION" -m "Version $NEW_VERSION"

# Publish
./gradlew publish -x dokkaHtml --no-configuration-cache
./gradlew publish --no-configuration-cache -PSONATYPE_CONNECT_TIMEOUT_SECONDS=300

# Prepare next snapshot
echo "Setting next snapshot version $NEXT_SNAPSHOT_VERSION"
Expand Down
Loading