aboutsummaryrefslogtreecommitdiff
path: root/dokka-integration-tests/build.gradle.kts
blob: 4642f9523ebfa0e982aee3d34fb4bd201008daa3 (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
27
28
29
30
31
32
33
34
/*
 * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
 */

plugins {
    id("dokkabuild.base")
}

addDependencyToSubprojectTasks("assemble")
addDependencyToSubprojectTasks("build")
addDependencyToSubprojectTasks("clean")
addDependencyToSubprojectTasks("check")

registerParentTask("test", groupName = "verification")
registerParentTask("integrationTest", groupName = "verification")

fun addDependencyToSubprojectTasks(existingTaskName: String) {
    tasks.named(existingTaskName) {
        dependsOn(subprojectTasks(existingTaskName))
    }
}

fun registerParentTask(taskName: String, groupName: String) {
    tasks.register(taskName) {
        group = groupName
        description = "Runs $taskName tasks of all subprojects"
        dependsOn(subprojectTasks(taskName))
    }
}

fun subprojectTasks(taskName: String): List<String> =
    subprojects
        .filter { it.getTasksByName(taskName, false).isNotEmpty() }
        .map { ":${it.name}:$taskName" }