|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 |
|
| 17 | +import com.android.build.gradle.internal.tasks.factory.dependsOn |
17 | 18 | import com.github.jk1.license.filter.DependencyFilter |
18 | 19 | import com.github.jk1.license.filter.ExcludeTransitiveDependenciesFilter |
19 | 20 | import com.github.jk1.license.filter.LicenseBundleNormalizer |
@@ -180,34 +181,53 @@ dependencyCheck { |
180 | 181 | // Dokka generation |
181 | 182 | dokka { |
182 | 183 | dokkaSourceSets.configureEach { |
| 184 | + dokkaPublications.javadoc { |
| 185 | + outputDirectory.set(rootProject.file("docs/javadoc")) |
| 186 | + } |
183 | 187 | dokkaPublications.html { |
184 | | - outputDirectory.set(rootProject.file("docs")) |
| 188 | + outputDirectory.set(rootProject.file("docs/html")) |
185 | 189 | } |
186 | 190 | externalDocumentationLinks.register("android") { |
187 | 191 | url("https://developer.android.com/reference") |
188 | 192 | packageListUrl("https://developer.android.com/reference/kotlin/package-list") |
189 | 193 | } |
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 | | - } |
194 | 194 | } |
195 | 195 | } |
196 | 196 |
|
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" |
199 | 207 | dependsOn(tasks.dokkaGeneratePublicationHtml) |
200 | 208 | from(tasks.dokkaGeneratePublicationHtml.flatMap { it.outputDirectory }) |
201 | 209 | archiveClassifier.set("html-docs") |
202 | 210 | description = "Assembles a JAR containing the HTML documentation generated by Dokka." |
203 | 211 | } |
204 | 212 |
|
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) |
211 | 231 | } |
212 | 232 |
|
213 | 233 | // Third-party licenses report |
@@ -236,8 +256,8 @@ tasks.generateLicenseReport.configure { |
236 | 256 | // Build documentation and license report |
237 | 257 | tasks.register<Task>("buildDocumentation") { |
238 | 258 | 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)." |
241 | 261 | } |
242 | 262 | tasks.assemble.configure { |
243 | 263 | finalizedBy("buildDocumentation") |
|
0 commit comments