diff --git a/buildSrc/src/main/kotlin/DokkaExts.kt b/buildSrc/src/main/kotlin/DokkaExts.kt index 9756dc3b..1214f4d6 100644 --- a/buildSrc/src/main/kotlin/DokkaExts.kt +++ b/buildSrc/src/main/kotlin/DokkaExts.kt @@ -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. @@ -182,3 +182,21 @@ fun Project.dokkaJavaJar(): TaskProvider = 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 + } + } + } +}