Slackbot
08/23/2023, 8:26 PMChris Lee
08/23/2023, 8:27 PMonlyIf { fn() } to all relevant tasks.Miles Peele
08/23/2023, 8:32 PMregister<AggregateThing>("aggregate") {
dependsOn(named("test", onlyIfFunctionThing()))
}
Where I couldn't configure using onlyIfFunctionThing .
Is the above pattern not supported?Chris Lee
08/23/2023, 8:34 PMnamed("test", onlyIfFunctionThing()) is not for `onlyIf`; the second parameter is a configuration action to configure the task.Miles Peele
08/23/2023, 8:37 PMChris Lee
08/23/2023, 8:38 PMafterEvaluate then?Miles Peele
08/23/2023, 8:42 PMcannot be executed in current context issue.
I didn't want to do something like this:
target.tasks.named("something") {
... onlyIf logic
}
Because I wanted that something task to be executable without any special conditional logic.
Instead, I wanted to do something like:
register<AggregateThing>("aggregate") {
dependsOn(named("something", onlyIfLogic()))
}
So you could execute something independently, and have that conditional logic only if you run the aggregate taskChris Lee
08/23/2023, 8:44 PMMiles Peele
08/23/2023, 8:49 PMdependsOn... tasks if the aggregate one is skipped? Am I modeling this wrong?Chris Lee
08/23/2023, 8:51 PMMiles Peele
08/23/2023, 8:53 PMBuildService that does some file-path magic to tell me what tasks to run. This is populated by X
2. X runs first - I then want to schedule a bunch of tasks (multiple per module, which is why I have each module define an aggregate task) that should only run if they're in the list that X spits outChris Lee
08/23/2023, 8:54 PMMiles Peele
08/23/2023, 8:56 PMChris Lee
08/23/2023, 8:58 PMMiles Peele
08/23/2023, 9:03 PMaggregate workflow, does it still eventually call `some-project:someTask`(even if this is conditional) and in the adhoc workflow, does it also eventually call some-project:someTask (non-conditional)?Chris Lee
08/23/2023, 9:07 PMaggregate -> :some-project:someAggTask and :some-project:someTask (for ad-hoc use).Miles Peele
08/23/2023, 9:37 PMtarget.gradle.taskGraph.whenReady {
if (hasTask(rootTask)
}
It seems like you can configure whatever you want here!
So you can add some onlyIf {... conditional logic only if you run rootTaskChris Lee
08/23/2023, 9:38 PMMiles Peele
08/24/2023, 2:37 PMChris Lee
08/24/2023, 2:39 PMMiles Peele
08/24/2023, 3:11 PM