Skip to content

Commit

Permalink
docs: revert to Dokka for now
Browse files Browse the repository at this point in the history
Until adamko-dev/dokkatoo#71 is fixed, we'll
probably have to rollback to plain ol' Dokka
  • Loading branch information
EdricChan03 committed May 25, 2023
1 parent 73f5f9f commit 9cb9d32
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,16 @@ jobs:
gradle-home-cache-strict-match: true

- name: Build docs
run: ./gradlew dokkatooGeneratePublicationHtml --stacktrace
# run: ./gradlew dokkatooGeneratePublicationHtml --stacktrace
run: ./gradlew dokkaHtmlMultiModule --stacktrace

- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# Upload Dokka folder
path: './build/dokka/html'
path: './build/dokka/htmlMultiModule'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
7 changes: 7 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
plugins {
org.jetbrains.dokka // TODO: Remove
dev.adamko.`dokkatoo-html`
}

Expand All @@ -14,3 +15,9 @@ dependencies {
}
)
}

dokkatoo {
// TODO: Remove
dokkatooPublicationDirectory.set(layout.buildDirectory.dir("dokkatoo"))
dokkatooConfigurationsDirectory.set(layout.buildDirectory.dir("dokkatoo-config"))
}
2 changes: 2 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ dependencies {
implementation(libs.plugins.kotlin.android.asDependency)
implementation(libs.plugins.dokkatoo.html.asDependency)
implementation(libs.plugins.kotlinx.bcv.asDependency)
// TODO: Remove
implementation(libs.plugins.dokka.asDependency)
}

private val Provider<PluginDependency>.asDependency
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
package io.github.edricchan03.docs

import org.gradle.util.Path as GradleProjectPath
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import org.jetbrains.dokka.gradle.AbstractDokkaTask
import java.net.URL

plugins {
org.jetbrains.dokka // TODO: Remove
dev.adamko.`dokkatoo-html`
}

// Path to the Module.md file, or null if it doesn't exist
val moduleReadme = file("Module.md").takeIf { it.exists() }

//<editor-fold desc="Dokkatoo extensions">
// Copied from Dokkatoo
fun Project.pathAsFilePath() = path
.removePrefix(GradleProjectPath.SEPARATOR)
.replace(GradleProjectPath.SEPARATOR, "/")

val AbstractDokkaTask.modulePath get() = provider { pathAsFilePath() }
//</editor-fold>

dokkatoo {
dokkatooSourceSets.configureEach {
reportUndocumented.set(true)
Expand All @@ -27,4 +42,32 @@ dokkatoo {
includes.from(it)
}
}

// TODO: Remove
dokkatooPublicationDirectory.set(layout.buildDirectory.dir("dokkatoo"))
dokkatooConfigurationsDirectory.set(layout.buildDirectory.dir("dokkatoo-config"))
}

// TODO: Remove below Dokka config once https://github.com/adamko-dev/dokkatoo/issues/71 is fixed
tasks.withType<DokkaTaskPartial>().configureEach {
dokkaSourceSets.configureEach {
reportUndocumented.set(true)

// Link to source
sourceLink {
localDirectory.set(file("src/${name}/kotlin"))
remoteUrl.set(
modulePath.map {
URL(
"https://github.com/EdricChan03/androidx-ktx-extras/" +
"tree/main/${it}/src/${name}/kotlin"
)
}
)
}

moduleReadme?.let {
includes.from(it)
}
}
}
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[versions]
android-gradle = "8.0.1"
dokka = "1.8.10"
dokkatoo = "1.3.0"
kotlin = "1.8.21"

[plugins]
kotlinx-bcv = "org.jetbrains.kotlinx.binary-compatibility-validator:0.13.1"
android-gradle-library = { id = "com.android.library", version.ref = "android-gradle" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
dokkatoo-html = { id = "dev.adamko.dokkatoo-html", version.ref = "dokkatoo" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }

0 comments on commit 9cb9d32

Please sign in to comment.