Instrument Java classes via doLast - Possible to access InputChanges?


I need to create a Gradle task that instruments Java classes. I tried to do it using a separate task (that creates a separate classes output directory) and got it to work but ran into issues for large multi-module projects. Trying to make subsequent tasks (that originally depended on the Java compile output) to automatically depend on my task as well caused issues.

It looks like another option is to use doLast - see also Allow to run bytecode instrumentation after all compilation tasks · Issue #2137 · gradle/gradle · GitHub

However, is there a way to somehow get the InputChanges from the compileJava task and “inject” it into my custom task? I seem to have an issue to simply inject it or to get it from the ObjectFactory.

Thanks a million for any pointers!