Add Gradle files.

Not yet 100% finished, but already has the most things.
Add missing license headers in the source code.