Porting build to gradle. Prepatcher currently completely broken.

Signed-off-by: Ross Allan <rallanpcl@gmail.com>