Skip to content

Commit 37f2d26

Browse files
committed
dokka tasks improved.
1 parent 632f657 commit 37f2d26

1 file changed

Lines changed: 35 additions & 11 deletions

File tree

wallet-core/build.gradle.kts

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
import com.android.build.gradle.internal.tasks.factory.dependsOn
1718
import com.github.jk1.license.filter.DependencyFilter
1819
import com.github.jk1.license.filter.ExcludeTransitiveDependenciesFilter
1920
import com.github.jk1.license.filter.LicenseBundleNormalizer
@@ -180,8 +181,11 @@ dependencyCheck {
180181
// Dokka generation
181182
dokka {
182183
dokkaSourceSets.configureEach {
184+
dokkaPublications.javadoc {
185+
outputDirectory.set(rootProject.file("docs/javadoc"))
186+
}
183187
dokkaPublications.html {
184-
outputDirectory.set(rootProject.file("docs"))
188+
outputDirectory.set(rootProject.file("docs/html"))
185189
}
186190
externalDocumentationLinks.register("android") {
187191
url("https://developer.android.com/reference")
@@ -194,20 +198,40 @@ dokka {
194198
}
195199
}
196200

197-
val dokkaHtmlJar by tasks.registering(Jar::class) {
198-
group = "documentation"
201+
val dokkaGenerateJavadocJar by tasks.registering(Jar::class) {
202+
group = "dokka"
203+
dependsOn(tasks.dokkaGeneratePublicationJavadoc)
204+
from(tasks.dokkaGeneratePublicationJavadoc.flatMap { it.outputDirectory })
205+
archiveClassifier.set("javadoc")
206+
description = "Assembles a JAR containing the Javadoc-style documentation generated by Dokka."
207+
}
208+
209+
val dokkaGenerateHtmlJar by tasks.registering(Jar::class) {
210+
group = "dokka"
199211
dependsOn(tasks.dokkaGeneratePublicationHtml)
200212
from(tasks.dokkaGeneratePublicationHtml.flatMap { it.outputDirectory })
201213
archiveClassifier.set("html-docs")
202214
description = "Assembles a JAR containing the HTML documentation generated by Dokka."
203215
}
204216

205-
val dokkaJavadocJar by tasks.registering(Jar::class) {
206-
group = "documentation"
207-
dependsOn(tasks.dokkaGeneratePublicationJavadoc)
208-
from(tasks.dokkaGeneratePublicationJavadoc.flatMap { it.outputDirectory })
209-
archiveClassifier.set("javadoc")
210-
description = "Assembles a JAR containing the Javadoc-style documentation generated by Dokka."
217+
val dokkaCleanJavadoc by tasks.registering(Delete::class) {
218+
group = "dokka"
219+
delete = setOf(rootProject.file("docs/javadoc"))
220+
description = "It removes the documentation generated by Dokka."
221+
}
222+
223+
val dokkaCleanHtml by tasks.registering(Delete::class) {
224+
group = "dokka"
225+
delete = setOf(rootProject.file("docs/html"))
226+
description = "It removes the documentation generated by Dokka."
227+
}
228+
229+
tasks.dokkaGeneratePublicationJavadoc.dependsOn(dokkaCleanJavadoc)
230+
tasks.dokkaGeneratePublicationHtml.dependsOn(dokkaCleanHtml)
231+
232+
val dokkaClean by tasks.registering() {
233+
group = "dokka"
234+
dependsOn(dokkaCleanJavadoc, dokkaCleanHtml)
211235
}
212236

213237
// Third-party licenses report
@@ -236,8 +260,8 @@ tasks.generateLicenseReport.configure {
236260
// Build documentation and license report
237261
tasks.register<Task>("buildDocumentation") {
238262
group = "documentation"
239-
dependsOn("dokkaGfm", "generateLicenseReport")
240-
description = "Aggregates all documentation tasks (Dokka GFM, License Report)."
263+
dependsOn("dokkaGenerate", "generateLicenseReport")
264+
description = "Aggregates all documentation tasks (Dokka, License Report)."
241265
}
242266
tasks.assemble.configure {
243267
finalizedBy("buildDocumentation")

0 commit comments

Comments
 (0)