Skip to content

Commit 1947d06

Browse files
committed
dokka tasks improved.
1 parent 632f657 commit 1947d06

2 files changed

Lines changed: 36 additions & 16 deletions

File tree

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#Thu Sep 12 17:12:58 EEST 2024
1818
distributionBase=GRADLE_USER_HOME
19-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
19+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
2020
distributionPath=wrapper/dists
2121
zipStorePath=wrapper/dists
2222
zipStoreBase=GRADLE_USER_HOME

wallet-core/build.gradle.kts

Lines changed: 35 additions & 15 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,34 +181,53 @@ 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")
188192
packageListUrl("https://developer.android.com/reference/kotlin/package-list")
189193
}
190-
externalDocumentationLinks.register("java") {
191-
url("https://docs.oracle.com/en/java/javase/17/docs/api/")
192-
packageListUrl("https://docs.oracle.com/en/java/javase/17/docs/api/allpackages-index.html")
193-
}
194194
}
195195
}
196196

197-
val dokkaHtmlJar by tasks.registering(Jar::class) {
198-
group = "documentation"
197+
val dokkaGenerateJavadocJar by tasks.registering(Jar::class) {
198+
group = "dokka"
199+
dependsOn(tasks.dokkaGeneratePublicationJavadoc)
200+
from(tasks.dokkaGeneratePublicationJavadoc.flatMap { it.outputDirectory })
201+
archiveClassifier.set("javadoc")
202+
description = "Assembles a JAR containing the Javadoc-style documentation generated by Dokka."
203+
}
204+
205+
val dokkaGenerateHtmlJar by tasks.registering(Jar::class) {
206+
group = "dokka"
199207
dependsOn(tasks.dokkaGeneratePublicationHtml)
200208
from(tasks.dokkaGeneratePublicationHtml.flatMap { it.outputDirectory })
201209
archiveClassifier.set("html-docs")
202210
description = "Assembles a JAR containing the HTML documentation generated by Dokka."
203211
}
204212

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."
213+
val dokkaCleanJavadoc by tasks.registering(Delete::class) {
214+
group = "dokka"
215+
delete = setOf(rootProject.file("docs/javadoc"))
216+
description = "It removes the documentation generated by Dokka."
217+
}
218+
219+
val dokkaCleanHtml by tasks.registering(Delete::class) {
220+
group = "dokka"
221+
delete = setOf(rootProject.file("docs/html"))
222+
description = "It removes the documentation generated by Dokka."
223+
}
224+
225+
tasks.dokkaGeneratePublicationJavadoc.dependsOn(dokkaCleanJavadoc)
226+
tasks.dokkaGeneratePublicationHtml.dependsOn(dokkaCleanHtml)
227+
228+
val dokkaClean by tasks.registering() {
229+
group = "dokka"
230+
dependsOn(dokkaCleanJavadoc, dokkaCleanHtml)
211231
}
212232

213233
// Third-party licenses report
@@ -236,8 +256,8 @@ tasks.generateLicenseReport.configure {
236256
// Build documentation and license report
237257
tasks.register<Task>("buildDocumentation") {
238258
group = "documentation"
239-
dependsOn("dokkaGfm", "generateLicenseReport")
240-
description = "Aggregates all documentation tasks (Dokka GFM, License Report)."
259+
dependsOn("dokkaGenerate", "generateLicenseReport")
260+
description = "Aggregates all documentation tasks (Dokka, License Report)."
241261
}
242262
tasks.assemble.configure {
243263
finalizedBy("buildDocumentation")

0 commit comments

Comments
 (0)