Provide a hook after startParameters are resolved but before the task graph is built


(Adrian Abraham) #1

There are times that I’d like to modify the behavior of my build based on what tasks have been provided on the commandline.

I know I have access to gradle.startParameter.taskNames - the problem is that this gives me exactly what the user entered on the commandline. Given Gradle’s excellent support for guessing what the user meant (e.g. cTJ means compileTestJava), I have some rather nasty regular expressions, and they don’t always work - I have to tell my users “run it THIS way.”

I’d love to have a hook that executes once Gradle figures out what tasks it’s been passed, but where it hasn’t yet built the task graph. Hand me an array of Tasks and let me modify it (or return a different array).