This message was deleted.
# community-support
s
This message was deleted.
t
You can add a
TaskExecutionGraphListener
to
project.getGradle().getTaskGraph()
and check for the presence of both tasks in the task execution graph. But first make sure it's compatible with configuration cache (https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:requirements:build_listeners is not clear to me)
v
I guess for example by having a shared build service
It can increase a counter when one of the tasks is executed and then fail when the other is executed
If
taskGraph.whenReady
is not CC safe, also not sure about that right now
t
An alternative maybe could "just" be to declare that the check task must be run before the dump task? `dumpTask.mustRunAfter(checkTask)`; that way the check task cannot falsely detect the output of the dump task (you don't have a custom error message though)
v
Now I am sure, it is CC safe. So simply this:
Copy code
gradle.taskGraph.whenReady {
    check(!(hasTask("a") && hasTask("b"))) {
        "Task 'a' and 'b' cannot be executed together."
    }
}