Add license header

According to GPL instructions, each source file should have
license header.

Headers on individual files were added automatically by
running `gradle licenseFormat`.

Also, this commit adds license checking to build.gradle.