-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: add support for selecting the Dokka type to be included in the…
… publication (#567) * feat!: remove class MavenRepositoryDescriptor * feat: support selection of which dokkaTask should be used for generating javadoc artifacts to be published * fix: factorize Dokka-related stuff management * chore(test): test docStyle property * feat(doc): explain property in README.md * docs: improve description of docStyle in the readme
- Loading branch information
Showing
10 changed files
with
91 additions
and
62 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
8 changes: 8 additions & 0 deletions
8
src/main/kotlin/org/danilopianini/gradle/mavencentral/DocStyle.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,8 @@ | ||
package org.danilopianini.gradle.mavencentral | ||
|
||
/** | ||
* Admissible type of styles used by Dokka to generate documentation from KDoc. | ||
*/ | ||
enum class DocStyle { | ||
GFM, HTML, JAVADOC, JEKYLL | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/kotlin/org/danilopianini/gradle/mavencentral/DokkaHelper.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,36 @@ | ||
package org.danilopianini.gradle.mavencentral | ||
|
||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.api.Task | ||
import org.gradle.api.provider.Property | ||
import org.gradle.api.tasks.TaskCollection | ||
|
||
/** | ||
* Looks for the class `DokkaPlugin`, which will only be available if the plugin user is applying the Dokka plugin. | ||
*/ | ||
internal val dokkaPluginClass: Result<Class<Plugin<*>>> = runCatching { | ||
@Suppress("UNCHECKED_CAST") | ||
Class.forName("org.jetbrains.dokka.gradle.DokkaPlugin") as Class<Plugin<*>> | ||
} | ||
|
||
/** | ||
* Looks for the class `DokkaTask`, which will only be available if the plugin user is applying the Dokka plugin. | ||
*/ | ||
internal val dokkaTaskClass: Result<Class<out Task>> = dokkaPluginClass.mapCatching { | ||
@Suppress("UNCHECKED_CAST") | ||
Class.forName("org.jetbrains.dokka.gradle.DokkaTask") as Class<out Task> | ||
} | ||
|
||
/** | ||
* Selects the available Dokka tasks supporting the generation of [docStyle]-style documentation. | ||
* There may be no such tasks, if the plugin user did not apply the Dokka plugin. | ||
*/ | ||
internal fun Project.dokkaTasksFor(docStyle: Property<DocStyle>): TaskCollection<out Task> = | ||
dokkaTaskClass | ||
.map { dokkaTaskType -> | ||
tasks.withType(dokkaTaskType).matching { | ||
it.name.startsWith("dokka") && it.name.endsWith(docStyle.get().name, ignoreCase = true) | ||
} | ||
} | ||
.getOrElse { tasks.matching { false } } |
38 changes: 0 additions & 38 deletions
38
src/main/kotlin/org/danilopianini/gradle/mavencentral/MavenRepositoryDescriptor.kt
This file was deleted.
Oops, something went wrong.
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
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