This message was deleted.
# community-support
s
This message was deleted.
e
have you tried
Copy code
tasks.named("quickAssembleOfMostCode") {
    shouldRunAfter("someFormattingTask")
    shouldRunBefore("build")
}
z
oh bc if you just pass the
String
then it doesn’t care until after evaluation
tbh what I really want is something like:
Copy code
/**
 * Runs task1 and any of its dependencies before task 2 (shouldRunBefore)
 * when there are free parallel executors.
 * 
 * Task2 before Task3, etc
 */
priortize(
    "task1",
    "task2",
    "task3",
    "task4"
)
I think this is a better way to ask this question https://gradle-community.slack.com/archives/CAHSN3LDN/p1662065586670609
v
Given you might not like using things like
shouldRunAfter("plainStringHere")
, usually you should know which plugin adds the task in question and then you just react to that plugin being applied using
pluginManager.withPlugin("...") { ... }
Otherwise to have a lazy reference of a named task, you need to use a task collection with 0 or 1 value like
tasks.withType<TheTaskType>().matching { it.name == "yourTaskName" }
for the price of all tasks with that type getting realized to check the name attribute whether they will be run or not. Because of that you should avoid doing
tasks.matching { ... }
as that would realize each and every task.