Use Gradle's built in dependency model to figure out what needs to be built

Uses both runtime and compile time dependencies. Tested by running  `$ gradle bCM`.