I am trying to figure out a way to perform some actions whenever a particular task is requested by the build command, regardless of any “short circuit” checks on that task (e.g. UP_TO_DATE).
I have tried adding a doLast
action, but that is not triggered if the task is not executed for whatever reason.
My specific use-case is that I am writing a plugin that “augments” a file in the project’s src/test/resources
based on a setting. Concretely, this is for the Hibernate build and the setting is the “database profile” to run the tests against. To implement this, we “augment” the ${buildDir}/resources/test/hibernate.properties
to apply the profile’s settings (as well as other stuff like expand the testRuntime config). In the optimal case, its like the processTestResources
task would be marked dirty whenever this extension (DatabaseProfilesExtension#selectedProfileName
) property is changed - almost like adding a new @Input
on processTestResources
- but I do not know a way to do that.
Any ideas?