-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add composite build example * add 'clue' to flaky test * add DuplicateModulePathWarningTest test * bump MultiModuleProject.kt KGP to embeddedKotlinVersion so it's more likely to stay up to date * skip empty dirs in test (empty dirs can't be committed to git, so this is an easy workaround) * fix dir comparison assertions to optionally filter out empty files * tidy
- Loading branch information
Showing
81 changed files
with
4,691 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Dokkatoo Composite Build Example | ||
|
||
This project demonstrates how to use Dokkatoo to aggregate modules across a | ||
[composite build projects](https://docs.gradle.org/current/userguide/composite_builds.html). | ||
|
||
> [!WARN] | ||
> HTML is the only format that correctly supports multimodule aggregation. | ||
> This is a limitation of Dokka. | ||
### Summary | ||
|
||
There are 4 included builds. | ||
|
||
* [`build-logic`](./build-logic) contains Kotlin/JVM and Dokkatoo convention plugins. | ||
* [`module-kakapo`](./module-kakapo) and [`module-kea`](./module-kea) | ||
(named after [New Zealand birds](https://en.wikipedia.org/wiki/Birds_of_New_Zealand)) | ||
represent regular Kotlin/JVM projects. | ||
* [`docs`](./docs) aggregates the modules. | ||
|
||
### Run locally | ||
|
||
To run locally, follow these steps. | ||
|
||
1. In the root Dokkatoo project directory, run `./gradlew assemble`. | ||
2. Either open the example project in an IDE, or `cd` into it. | ||
3. In the example project, run `gradle build`. | ||
|
||
The docs will be generated into [`./docs/build/dokka/`](./docs/build/dokka/). | ||
|
||
> [!IMPORTANT] | ||
> When Dokkatoo aggregates modules, each module **must** have a distinct `modulePath`. | ||
> By default, this path is set to be the project path. With composite builds these | ||
> paths may not be distinct, causing Dokkatoo to overwrite modules. | ||
> | ||
> When using composite builds, project paths may clash, so make sure to set a distinct `modulePath`. | ||
> | ||
> This can be achieved in a convention plugin. | ||
> [build-logic/src/main/kotlin/dokka-convention.gradle.kts](./build-logic/src/main/kotlin/dokka-convention.gradle.kts). |
8 changes: 8 additions & 0 deletions
8
examples/composite-build-example/dokkatoo/build-logic/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
dependencies { | ||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$embeddedKotlinVersion") | ||
implementation("dev.adamko.dokkatoo:dokkatoo-plugin:2.3.0-SNAPSHOT") | ||
} |
47 changes: 47 additions & 0 deletions
47
examples/composite-build-example/dokkatoo/build-logic/settings.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
rootProject.name = "build-logic" | ||
|
||
pluginManagement { | ||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
exclusiveContent { | ||
forRepository { | ||
maven(providers.gradleProperty("testMavenRepo")) { | ||
name = "DokkatooTestMavenRepo" | ||
} | ||
} | ||
filter { | ||
includeGroup("dev.adamko.dokkatoo") | ||
includeGroup("dev.adamko.dokkatoo-html") | ||
includeGroup("dev.adamko.dokkatoo-javadoc") | ||
includeGroup("dev.adamko.dokkatoo-jekyll") | ||
includeGroup("dev.adamko.dokkatoo-gfm") | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Suppress("UnstableApiUsage") | ||
dependencyResolutionManagement { | ||
|
||
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) | ||
|
||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
exclusiveContent { | ||
forRepository { | ||
maven(providers.gradleProperty("testMavenRepo")) { | ||
name = "DokkatooTestMavenRepo" | ||
} | ||
} | ||
filter { | ||
includeGroup("dev.adamko.dokkatoo") | ||
includeGroup("dev.adamko.dokkatoo-html") | ||
includeGroup("dev.adamko.dokkatoo-javadoc") | ||
includeGroup("dev.adamko.dokkatoo-jekyll") | ||
includeGroup("dev.adamko.dokkatoo-gfm") | ||
} | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
.../composite-build-example/dokkatoo/build-logic/src/main/kotlin/dokka-convention.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* Common conventions for generating documentation with Dokkatoo. | ||
*/ | ||
|
||
plugins { | ||
id("dev.adamko.dokkatoo-html") | ||
} | ||
|
||
dokkatoo { | ||
// Important! Ensure that each project has a distinct module path. | ||
// See the example README for more information. | ||
modulePath = rootProject.name + project.path.replace(":", "/") | ||
} |
7 changes: 7 additions & 0 deletions
7
...osite-build-example/dokkatoo/build-logic/src/main/kotlin/kotlin-jvm-convention.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
plugins { | ||
kotlin("jvm") | ||
} | ||
|
||
kotlin { | ||
jvmToolchain(11) | ||
} |
19 changes: 19 additions & 0 deletions
19
examples/composite-build-example/dokkatoo/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
plugins { | ||
base | ||
} | ||
|
||
tasks.build { | ||
dependsOn(gradle.includedBuild("docs").task(":dokkatooGenerate")) | ||
} | ||
|
||
group = "foo.example.composite.builds" | ||
version = "1.0.1" | ||
|
||
|
||
tasks.clean { | ||
dependsOn( | ||
gradle.includedBuild("docs").task(":clean"), | ||
gradle.includedBuild("module-kakapo").task(":clean"), | ||
gradle.includedBuild("module-kea").task(":clean"), | ||
) | ||
} |
12 changes: 12 additions & 0 deletions
12
examples/composite-build-example/dokkatoo/docs/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
plugins { | ||
id("dokka-convention") | ||
} | ||
|
||
dependencies { | ||
dokkatoo("foo.example:module-kakapo") | ||
dokkatoo("foo.example:module-kea") | ||
} | ||
|
||
dokkatoo { | ||
moduleName = "Dokkatoo Composite Builds Example" | ||
} |
47 changes: 47 additions & 0 deletions
47
examples/composite-build-example/dokkatoo/docs/settings.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
rootProject.name = "docs" | ||
|
||
pluginManagement { | ||
includeBuild("../build-logic") | ||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
exclusiveContent { | ||
forRepository { | ||
maven(providers.gradleProperty("testMavenRepo")) { | ||
name = "DokkatooTestMavenRepo" | ||
} | ||
} | ||
filter { | ||
includeGroup("dev.adamko.dokkatoo") | ||
includeGroup("dev.adamko.dokkatoo-html") | ||
includeGroup("dev.adamko.dokkatoo-javadoc") | ||
includeGroup("dev.adamko.dokkatoo-jekyll") | ||
includeGroup("dev.adamko.dokkatoo-gfm") | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Suppress("UnstableApiUsage") | ||
dependencyResolutionManagement { | ||
repositories { | ||
mavenCentral() | ||
exclusiveContent { | ||
forRepository { | ||
maven(providers.gradleProperty("testMavenRepo")) { | ||
name = "DokkatooTestMavenRepo" | ||
} | ||
} | ||
filter { | ||
includeGroup("dev.adamko.dokkatoo") | ||
includeGroup("dev.adamko.dokkatoo-html") | ||
includeGroup("dev.adamko.dokkatoo-javadoc") | ||
includeGroup("dev.adamko.dokkatoo-jekyll") | ||
includeGroup("dev.adamko.dokkatoo-gfm") | ||
} | ||
} | ||
} | ||
} | ||
|
||
includeBuild("../module-kakapo") | ||
includeBuild("../module-kea") |
12 changes: 12 additions & 0 deletions
12
examples/composite-build-example/dokkatoo/module-kakapo/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
plugins { | ||
id("kotlin-jvm-convention") | ||
id("dokka-convention") | ||
} | ||
|
||
group = "foo.example" | ||
version = "1.2.3" | ||
|
||
dokkatoo { | ||
moduleName = "Kakapo Module" | ||
modulePath = "kakakpo" | ||
} |
44 changes: 44 additions & 0 deletions
44
examples/composite-build-example/dokkatoo/module-kakapo/settings.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
rootProject.name = "module-kakapo" | ||
|
||
pluginManagement { | ||
includeBuild("../build-logic") | ||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
exclusiveContent { | ||
forRepository { | ||
maven(providers.gradleProperty("testMavenRepo")) { | ||
name = "DokkatooTestMavenRepo" | ||
} | ||
} | ||
filter { | ||
includeGroup("dev.adamko.dokkatoo") | ||
includeGroup("dev.adamko.dokkatoo-html") | ||
includeGroup("dev.adamko.dokkatoo-javadoc") | ||
includeGroup("dev.adamko.dokkatoo-jekyll") | ||
includeGroup("dev.adamko.dokkatoo-gfm") | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Suppress("UnstableApiUsage") | ||
dependencyResolutionManagement { | ||
repositories { | ||
mavenCentral() | ||
exclusiveContent { | ||
forRepository { | ||
maven(providers.gradleProperty("testMavenRepo")) { | ||
name = "DokkatooTestMavenRepo" | ||
} | ||
} | ||
filter { | ||
includeGroup("dev.adamko.dokkatoo") | ||
includeGroup("dev.adamko.dokkatoo-html") | ||
includeGroup("dev.adamko.dokkatoo-javadoc") | ||
includeGroup("dev.adamko.dokkatoo-jekyll") | ||
includeGroup("dev.adamko.dokkatoo-gfm") | ||
} | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
examples/composite-build-example/dokkatoo/module-kakapo/src/main/kotlin/Kakapo.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package foo.example.module.kakapo | ||
|
||
class Kakapo { | ||
val description = """ | ||
The Kakapo (Strigops habroptilus) is the only parrot which cannot fly. | ||
It lives in grassland, scrubland and coastal regions of New Zealand, but is now so rare they can only be seen | ||
on protected offshore islands. | ||
Kakapo means 'night parrot' in the Māori language. | ||
""".trimIndent() | ||
} |
12 changes: 12 additions & 0 deletions
12
examples/composite-build-example/dokkatoo/module-kea/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
plugins { | ||
id("kotlin-jvm-convention") | ||
id("dokka-convention") | ||
} | ||
|
||
group = "foo.example" | ||
version = "4.5.6" | ||
|
||
dokkatoo { | ||
moduleName = "Kea Module" | ||
modulePath = "kea" | ||
} |
44 changes: 44 additions & 0 deletions
44
examples/composite-build-example/dokkatoo/module-kea/settings.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
rootProject.name = "module-kea" | ||
|
||
pluginManagement { | ||
includeBuild("../build-logic") | ||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
exclusiveContent { | ||
forRepository { | ||
maven(providers.gradleProperty("testMavenRepo")) { | ||
name = "DokkatooTestMavenRepo" | ||
} | ||
} | ||
filter { | ||
includeGroup("dev.adamko.dokkatoo") | ||
includeGroup("dev.adamko.dokkatoo-html") | ||
includeGroup("dev.adamko.dokkatoo-javadoc") | ||
includeGroup("dev.adamko.dokkatoo-jekyll") | ||
includeGroup("dev.adamko.dokkatoo-gfm") | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Suppress("UnstableApiUsage") | ||
dependencyResolutionManagement { | ||
repositories { | ||
mavenCentral() | ||
exclusiveContent { | ||
forRepository { | ||
maven(providers.gradleProperty("testMavenRepo")) { | ||
name = "DokkatooTestMavenRepo" | ||
} | ||
} | ||
filter { | ||
includeGroup("dev.adamko.dokkatoo") | ||
includeGroup("dev.adamko.dokkatoo-html") | ||
includeGroup("dev.adamko.dokkatoo-javadoc") | ||
includeGroup("dev.adamko.dokkatoo-jekyll") | ||
includeGroup("dev.adamko.dokkatoo-gfm") | ||
} | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
examples/composite-build-example/dokkatoo/module-kea/src/main/kotlin/Kea.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package foo.example.module.kea | ||
|
||
class Kea { | ||
val description = """ | ||
The kea (Nestor notabilis) is a large parrot. | ||
It lives in forests and high rocky hills on the South Island of New Zealand. It is mostly olive-green in color. | ||
It has a large, narrow, curved, grey-brown upper beak. The kea is the only parrot in the world that lives in alpine habitats. | ||
""".trimIndent() | ||
} |
Oops, something went wrong.