Add gradle library support, move ant library stuff into core