[Gradle] Stop using flow control to locate Gradle task

^KT-57052 Fixed
This commit is contained in:
Yahor Berdnikau
2023-05-10 22:46:16 +02:00
committed by Space Team
parent 9a267176f5
commit cc9325eb5b
@@ -65,12 +65,7 @@ internal inline fun <reified S : Task> TaskCollection<in S>.withType(): TaskColl
/**
* Locates a task by [name] and [type], without triggering its creation or configuration.
*/
internal inline fun <reified T : Task> Project.locateTask(name: String): TaskProvider<T>? =
try {
tasks.withType(T::class.java).named(name)
} catch (e: UnknownTaskException) {
null
}
internal inline fun <reified T : Task> Project.locateTask(name: String): TaskProvider<T>? = tasks.locateTask(name)
/**
* Locates a task by [name] and [type], without triggering its creation or configuration.