diff options
Diffstat (limited to 'build-logic/src/main/kotlin/org/jetbrains/taskUtils.kt')
-rw-r--r-- | build-logic/src/main/kotlin/org/jetbrains/taskUtils.kt | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/build-logic/src/main/kotlin/org/jetbrains/taskUtils.kt b/build-logic/src/main/kotlin/org/jetbrains/taskUtils.kt new file mode 100644 index 00000000..261d1663 --- /dev/null +++ b/build-logic/src/main/kotlin/org/jetbrains/taskUtils.kt @@ -0,0 +1,22 @@ +package org.jetbrains + +import org.gradle.api.Project +import org.gradle.api.Task + +fun Task.dependsOnMavenLocalPublication() { + project.rootProject.allprojects.forEach { otherProject -> + otherProject.invokeWhenEvaluated { evaluatedProject -> + evaluatedProject.tasks.findByName("publishToMavenLocal")?.let { publishingTask -> + this.dependsOn(publishingTask) + } + } + } +} + +val Project.isLocalPublication: Boolean + get() = gradle.startParameter.taskNames.any { + it.endsWith("publishToMavenLocal", ignoreCase = true) || + it.endsWith("integrationTest", ignoreCase = true) || + it.endsWith("check", ignoreCase = true) || + it.endsWith("test", ignoreCase = true) + } |