gradle plugin: Build in a separate project (part 1)

Plus some other general fixes to the build.