Print the inputs and outputs for a task?

Continuing the discussion from How to print the inputs and outputs for a task?:

Anyone have a working solution for this?

I tried Justin’s original suggestion, which runs, but as stated doesn’t generate much useful information.
I can’t get Rene’s solution to run. It’s a bit beyond my gradle skills.