Iterate over all sourceSets instead of hardcoding them.

* Fix bug where classpath directory was incomplete, buildDir.name was used
instead of the buildDir.path
* Improve logging by moving log messages to closure for inputs.