Netflix TechBlog | Medium
Follow
Scaling ArchUnit with Nebula ArchRules
Netflix uses a polyrepo strategy with thousands of Java repositories, requiring efficient build logic sharing. They built the Nebula suite of Gradle plugins, including ArchRules, to manage dependencies and enforce code standards. This initiative arose from a need to improve Java library lifecycle management following a backwards-incompatible change incident. Netflix utilizes API lifecycle annotations (@Deprecated, @Public, @Experimental) to identify potential issues with deprecated code. ArchUnit, a popular library for enforcing architectural rules, was chosen to detect the misuse of these annotations and other technical debt issues. Nebula ArchRules plugins enable sharing and applying ArchUnit rules across many repositories, providing enhanced capabilities. ArchRules uses bytecode analysis (ASM) for cross-language support and an easy to use builder pattern simplifying rule creation. Rules can be bundled with libraries or defined in standalone rule libraries, automatically detected and run by the plugin. The ArchRules Runner plugin evaluates rules against source sets and generates JSON and console reports, enabling better reporting capabilities. By using ArchRules, Netflix provides a platform for library authors to track API usage and detect deprecated API usage.