aboutsummaryrefslogtreecommitdiff
path: root/build-logic/src/main/kotlin/org/jetbrains/taskUtils.kt
blob: b492d9a96e0302e1c183e2aa4038fa5759eae3d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
 * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
 */

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)
    }