Change build tool scripts to reduce code duplication