$ show dekorateio/dekorate
Dekorate is a Java annotation-processing framework that generates Kubernetes, OpenShift, Knative, and other container orchestration manifests at compile time. It is primarily a library consumed by Java applications, especially those built with Spring Boot, Quarkus, Thorntail, or plain Java. The architecture centers around a `Session` that coordinates `ConfigurationGenerator`s, `ManifestGenerator`s, and a graph of `Decorator`s to produce deployment descriptors. It supports multiple platforms via separate annotation modules (e.g., kubernetes-annotations, openshift-annotations, knative-annotations) and integrates with build tools like Docker, Jib, S2I, and Tekton for CI/CD pipelines. The codebase is well-structured with clean abstractions (Decorator, Configurator, SPI factories) and extensive testing, though it suffers from a high module count and some outdated dependencies (e.g., Java 1.8 baseline, old Spring Boot versions in examples). Overall, it is a mature and capable tool for generating Kubernetes manifests from Java annotations.
The LLM identified 4 files worth highlighting for reuse:
Base class for all resource decorators. Defines a `before()`/`after()` ordering mechanism and a `visit()` method that modifies Kubernetes resource builders. This pattern allows incremental, composable modifications to generated manifests and is reused across all platform-specific modules. The ordering is resolved via `TopologicalSort`, making it safe for complex decoration chains.
A generic topological sort utility that resolves ordering constraints between decorators. It handles cycle detection and can be extracted and reused in any project requiring dependency-based ordering. The implementation is self-contained and demonstrates clean algorithm design.
A serialization utility for JSON and YAML using Jackson. It includes a critical workaround for classloader conflicts when running in Gradle's annotation processing context (sets thread context classloader). This isolated, reusable component solves a common issue in Java annotation processors and can be extracted for any project needing robust serialization in mixed classloader environments.
SPI interface for detecting project build information (name, version, packaging). Implementations exist for Maven, Gradle, SBT, Bazel, Leiningen, and Node.js. This pattern allows dekorate to adapt to different build systems without hardcoding, and the interface itself is reusable for any tool needing to extract project metadata from build files.