Skip to content

Commit

Permalink
Configure the Dokka Gradle plugin and its tasks with code copied and …
Browse files Browse the repository at this point in the history
…adapted from "kotlin-common"

A source commit: huanshankeji/kotlin-common@157159b

The `dokkaGenerate` tasks fails with the following error:

```text
Execution failed for task ':dokkaGeneratePublicationHtml'.
> Could not resolve all files for configuration ':dokkaHtmlPluginIntransitiveResolver~internal'.
   > Cannot resolve external dependency org.jetbrains.dokka:templating-plugin:2.0.0-Beta because no repositories are defined.
     Required by:
         root project :
   > Cannot resolve external dependency org.jetbrains.dokka:dokka-base:2.0.0-Beta because no repositories are defined.
     Required by:
         root project :
```

This may be a bug from Dokka. See Kotlin/dokka#2260.
  • Loading branch information
ShreckYe committed Nov 5, 2024
1 parent 502df8e commit d0c8105
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dokka-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Deploy the API documentation to GitHub Pages with Dokka

on:
push:
branches: [ "release" ]
branches: [ "plugins-release" ]
pull_request:
branches: [ "release" ]
branches: [ "plugins-release" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
18 changes: 18 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,28 @@ tasks.wrapper {
distributionType = Wrapper.DistributionType.ALL
}

plugins {
id("org.jetbrains.dokka")
}

evaluationDependsOnChildren()
task("publishPluginProjectPlugins") {
group = "plugin portal"

val pluginProjects = subprojects.filter { it.name.endsWith("plugins") }
pluginProjects.forEach { dependsOn(it.tasks.named("publishPlugins")) }
}


dependencies {
/*
"common-gradle-dependencies" not added because it's published in a separate branch
"huanshankeji-team-gradle-plugins" not added because it's renamed and more cumbersome to configure, and also because it's only used by us
*/
listOf(
"kotlin-common-gradle-plugins",
"architecture-common-gradle-plugins",
).forEach {
dokka(project(":$it"))
}
}
2 changes: 2 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ dependencies {
// This is also a bootstrapping dependency.
implementation("com.huanshankeji:common-gradle-dependencies:0.7.1-20240314-boostrap") { exclude("org.jetbrains.kotlin") }
*/

implementation("org.jetbrains.dokka:dokka-gradle-plugin:2.0.0-Beta")
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
id("conventions")
id("dokka-convention")
}

version = alignedPluginVersion
Expand Down
12 changes: 12 additions & 0 deletions buildSrc/src/main/kotlin/dokka-convention.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
plugins {
id("org.jetbrains.dokka")
}

dokka {
dokkaSourceSets.all {
sourceLink {
remoteUrl("https://github.com/huanshankeji/kotlin-common/tree/v${version}/${project.name}")
remoteLineSuffix.set("#L")
}
}
}
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
#kotlin.mpp.stability.nowarn=true
# More memory is needed to build "architecture-common-gradle-plugins" since Kotlin 2.0.0
org.gradle.jvmargs=-Xmx2G
# for Dokka
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled

0 comments on commit d0c8105

Please sign in to comment.