$ show bazelbuild/rules_android
This repository provides the Bazel build rules and tooling for building Android applications (APKs, AABs, libraries) using Bazel. It includes Starlark rules for android_binary, android_library, android_local_test, etc., along with a suite of Go and Java tools for resource processing, dexing, R8 optimization, manifest merging, and mobile-install deployment. The codebase is production-grade, used internally at Google, and supports both WORKSPACE and Bzlmod. It features a well-architected processing pipeline pattern, a reusable flag system, and extensive test infrastructure. The repository is actively maintained with regular commits and CI, though it carries some technical debt from internal migration and legacy feature flags.
The LLM identified 5 files worth highlighting for reuse:
A drop-in replacement for Go's encoding/xml encoder that properly handles XML namespaces and maintains namespace state across nested encoders. This is reusable in any Go project needing robust XML marshaling with namespace support, and demonstrates non-obvious skill in XML processing.
Implements a channel-based streaming pipeline for resource processing with context cancellation, error handling, and merging of multiple streams. The pattern is cleanly separated from the business logic and can be extracted for any data processing pipeline in Go, showcasing high craftsmanship in concurrent programming.
A composable pipeline pattern in Starlark that allows chaining, prepending, appending, and replacing processors. Used by android_binary and android_library to compose build stages (manifest, resources, JVM, dexing). This is a reusable architectural pattern for any complex build or analysis pipeline in Bazel, demonstrating clean abstraction and extensibility.
A factory pattern for creating adapters that provide aspect attributes and an 'adapt' function for different rule types. Each adapter is self-contained and registered via a central registry. This pattern is reusable for any Bazel aspect that needs to handle multiple rule types, demonstrating clean separation of concerns.
Provides helpers for Bazel analysis testing, including fake file/executable creation, provider assertion utilities, and failure test wrappers. These are reusable across any Bazel ruleset for writing analysis tests, demonstrating practical testing infrastructure.