#service-registry
Posts
-
Digging into Gradle's Source 2: The Big Picture — Client and Daemon, Service Scopes, and the Three Build Phases
A map of the Gradle source for intermediate developers opening it for the first time. We check against the real source and examples we ran ourselves which four processes take part in one gradle command, how the daemon's state is layered (process, session, build tree, build, project) and matched one-to-one with service scopes, which class and which state the initialization, configuration and execution phases really are, and how the model (Gradle, Settings, Project, Task) and the execution side (execution plan, nodes, execution engine) fit together — then lay out which part of this map each of parts 3 to 12 reads.
-
Digging into Gradle's Source 4: The Service Registry — the DI Container Inside Gradle
Who puts a FileSystemOperations into your task when you mark its constructor with @Inject? This post reads DefaultServiceRegistry, one per scope, which looks services up through its parents; the rules for declaring services with @Provides methods and decorators; lazy singletons created on first lookup; ServiceScopeValidator, which keeps services in their proper scope; GradleModuleServices, through which 57 modules add services to every scope; and the _Decorated classes that fill in abstract getters. We use the registry directly outside a build and print the stack of a task being created to check it all against the source.