Finalising custom task type configuration


Is there a way of running logic to finalise the configuration for custom task types? I can explain what I mean with a use case.

I’m writing a custom task type with two not-strictly-mandatory configuration properties, foo and bar. I want to add some validation and configuration logic depending on these values. In particular, I want to be able to do things like:

  1. If the user specifies bar, s/he must also specify foo, but s/he can specify foo without specifying bar. I think the build should fail during configuration/evaluation if the user specifies bar but not foo.
  2. Add a task inputs or outputs condition depending on the value of both foo and bar. (In particular, I’d like to add a task.outputs.upToDateWhen condition that depends on the value of both foo and bar, so I can’t just use an annotation.)

I’m currently doing the first (the validation) by doing a check in the task type’s TaskAction before doing actual work. I’m doing the second by calling a method finishSetup() at the end of the configuration properties’ setter methods that looks like this:

protected void finishSetup() {
	if(!foo || !bar) {

	outputs.upToDateWhen { magic(foo, bar) }