You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fetch tasks from a service locator instead of the service container (v5 step of #114) #275
every task service must be public (public: true on all bundle tasks, public FQCN aliases in the bridge bundles, _instanceof blocks in applications): this is Tasks services should not be public #114, planned for v6.0;
injecting service_container is discouraged in bundles;
a typo in a task service is only detected when the process runs.
This ticket is the v5 preparation step of #114, without breaking change.
Proposed fix
The process configurations are known at compile time (clever_age_process.configurations, first argument of cleverage_process.registry.process_configuration), so the referenced services are known too:
A compiler pass collects the service of every task (with or without the @ prefix) and builds a ServiceLocator containing exactly these services (only ids that exist; unknown ids keep failing at runtime with the current message). Non-shared tasks stay non-shared (ServiceLocator::get() calls the factory each time).
A small TaskRegistry (cleverage_process.registry.task, getTask(TaskConfiguration): TaskInterface) wraps the locator and holds the code currently duplicated in ProcessManager and ProcessHelpCommand (@ prefix, TaskInterface check, error messages).
ProcessManager and ProcessHelpCommand get this registry as a new optional constructor argument (added last, the $container argument is kept). When it is not provided (subclass or custom definition), they fall back to the container and trigger a deprecation.
If a service is not in the locator but exists in the container (e.g. configuration added at runtime by a ProcessConfigurationRegistry subclass), fall back to the container with a deprecation.
Follow-up in v6.0 (#114): remove the container argument and the fallbacks, make bundle tasks private, make the FQCN aliases of the bridge bundle tasks private.
Requirements
Documentation updates
Reference
Cookbooks
Changelog
Unit tests
Breaking changes
None: same constructor signatures (new optional last argument), tasks stay public, same runtime errors. Deprecations only on the fallback paths.
Activity
#275 - Document the service references of the tasks, task services no…
Merge pull request #290 from cleverage/275