Move gradle configuration to one place. Fix for library build.