Skip to content

Commit

Permalink
Add extensions for disabling documentation tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-yevsyukov committed Jan 3, 2024
1 parent 057b1b4 commit 6b36e36
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion buildSrc/src/main/kotlin/DokkaExts.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023, TeamDev. All rights reserved.
* Copyright 2024, TeamDev. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -182,3 +182,21 @@ fun Project.dokkaJavaJar(): TaskProvider<Jar> = tasks.getOrCreate("dokkaJavaJar"
this@getOrCreate.dependsOn(dokkaTask)
}
}

/**
* Disables Dokka and Javadoc tasks in this `Project`.
*
* This function could be useful to improve build speed when building subprojects containing
* test environments or integration test projects.
*/
@Suppress("unused")
fun Project.disableDocumentationTasks() {
gradle.taskGraph.whenReady {
tasks.forEach { task ->
val lowercaseName = task.name.toLowerCase()
if (lowercaseName.contains("dokka") || lowercaseName.contains("javadoc")) {
task.enabled = false
}
}
}
}

0 comments on commit 6b36e36

Please sign in to comment.