diff --git a/dokka-integration-tests/build.gradle.kts b/dokka-integration-tests/build.gradle.kts index 1c9ba4de73..cb6c0cd717 100644 --- a/dokka-integration-tests/build.gradle.kts +++ b/dokka-integration-tests/build.gradle.kts @@ -1,3 +1,33 @@ /* * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ + +plugins { + base +} + +addDependencyToSubprojectTasks("assemble") +addDependencyToSubprojectTasks("build") +addDependencyToSubprojectTasks("clean") +addDependencyToSubprojectTasks("check") + +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 = + subprojects + .filter { it.getTasksByName(taskName, false).isNotEmpty() } + .map { ":${it.name}:$taskName" }