gradle: improve the custom build setup

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>