Okay… so I do the whenReady stuff to replace the Jar with the obfuscated version, and that seems to work. But in my multi-project build I have a project that does some integration tests with JNI methods that depends on the output of my java project and a native project. It seems now that it doesn’t run the obfuscate step on the java project before trying to run those tests. That in turn leads to the main output artifact of that project not being present when it tries to compile the test code and so it fails.
It seems that when the task graph is ready it is too late to replace the artifact because the ‘test’ task in my IntegrationTest project thinks that the output of the ‘jar’ task is the artifact and that it doesn’t need to run the obfuscate step on my java library. By the time it runs though the artifact has been replaced with the obfucated jar… but that hasn’t been built yet because the task graph was already determined!
I have temporarily worked around this by making my integration tests explicitly declare the need to run the obfuscation step in the other project, like this:
The down side is that I’m not able to test without obfuscating.
Am I missing something or is there a way to get around this?