Build Scripts Need Maintenance Too: A Study on Refactoring and Technical Debt in Build Systems
In modern software engineering, build systems play the crucial role of facilitating the conversion of source code into software artifacts. Recent research has explored high-level causes of build failures but has largely overlooked the structural properties of build files. Akin to source code, build systems face technical debt challenges that hinder maintenance and optimization. While refactoring is often seen as a key tool for addressing technical debt in source code, there is a significant research gap regarding the specific refactoring changes developers apply to build code and whether these refactorings effectively address technical debt. In this paper, we address this gap by examining refactorings applied to build scripts in open-source projects, covering the widely used build systems of Gradle, Ant, and Maven. Addition- ally, we investigate whether these refactorings are used to tackle technical debts in build systems. Our analysis was conducted on 715 examined build-file-related commits. We identified 24 build-related refactorings, which we divided into 6 main categories. These refactorings are organized into the first empirically derived taxonomy of build system-related refactorings. Furthermore, we investigate how developers employ the identified refactoring types to address technical debts. In this context, we identified 6 technical debts addressed by these identified refactorings and discussed the correlation among the different types of refactorings. Finally, we introduce BuildRefMiner, an LLM-powered tool leveraging GPT-4 to automate the detection of refactorings within build systems. We evaluated its performance and found that it achieves an F1 score of 0.75 across all build systems. This study will serve as a foundational building block for guiding future research and practice in the maintenance and optimization of build systems. BuildRefMiner and the replication package for this study are available at [1].