Problem/Motivation
package_manager needs the symfony/config package, because:
Composer Stager uses automatic service loading, where (almost) the only entry in its services.yml is to point its namespace to its src directory, and all the classes within there automatically get corresponding service definitions. Composer Stager is designed to not know anything about Drupal, and is not a Drupal module, so does not itself register these services in Drupal's service container.
Package Manager is the Drupal module that interfaces with Composer Stager. It needs to use Composer Stager's services, so it brings them in via PackageManagerServiceProvider. However, the code to discover and register services for all classes within a namespace/directory relies on the symfony/config package.
Proposed resolution
composer require symfony/config ^6.2
If for some reason we don't want to add this dependency, we could try to implement the needed functionality in #3021899: Support resource key in services.yml without it, but then that would be more custom code for Drupal to maintain.
Remaining tasks
In #1632930: Add Symfony/Component/Config despite Symfony potentially releasing BC-breaking updates after 2.3. we had rejected adding symfony/config, partly out of performance concerns, but that was a long time ago. Still, if we want to add it now, we should profile/benchmark the impact it would have to the time it takes to do a container rebuild. If we only use it in a few isolated places, like in PackageManagerServiceProvider, it probably wouldn't add much cost. But once it's in core, there might be a temptation to use it in more places.
User interface changes
None.
API changes
symfony/config is now a dependency of Drupal core. (It already was a dev dependency for Drupal core!)
It is required for the experimental Package Manager module, but it will also be used for improved service container/dependency injection DX in #3111008: Use native Symfony YamlLoader + Config.
Data model changes
None.
Release notes snippet
TBD
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | symfony-config-3326246-4.patch | 10.84 KB | wim leers |
Comments
Comment #2
longwaveThis would also close off #3111008: Use native Symfony YamlLoader + Config and fix #3331324: Service autowiring depends on symfony/config that is missing from composer (at least dev)
Comment #3
wim leers#2: That's great news!
Now that the number of remaining core alpha experimental blockers for Package Manager has fewer than 10 issues remaining: time to really get this going! 😄
Attached patch is the result of doing:
… and it turns out that
symfony/configdepends onsymfony/filesystem, so that's brought in as a dependency too.Comment #4
wim leersAha!
ComposerIntegrationTestis failing and points to https://www.drupal.org/about/core/policies/core-dependency-policies/mana..., which is the documentation I spent 20 minutes searching for but not finding 👍Comment #6
effulgentsia commentedUpdated the issue summary to be more explicit about why Package Manager needs symfony/config.
Comment #7
longwaveWould #3021899: Support resource key in services.yml solve the issue in PackageManagerServiceProvider without needing
symfony/config? (assuming that that issue does not needsymfony/configitself...)Also, it is not already a dev dependency (but
symfony/filesystemis)Comment #8
andypostOne more reason to add it is #3111008: Use native Symfony YamlLoader + Config because except addition it also starts using it
Comment #9
effulgentsia commentedRe #7, yes I think it would, but I don't see why we'd want to write our own custom code for supporting a 'resource' key vs. using
symfony/config. Re-reading #1632930: Add Symfony/Component/Config despite Symfony potentially releasing BC-breaking updates after 2.3., I think we rejected using symfony/config at that time, because:Comment #10
effulgentsia commentedAdding #3021899: Support resource key in services.yml as a related issue per #7/#9.
Comment #11
effulgentsia commentedAdding the need to profile/benchmark as a remaining task.
Comment #12
effulgentsia commentedMeanwhile, I opened #3345039: Remove dependency on symfony/config.
Comment #13
phenaproximaSo I was able to implement #3345039: Remove dependency on symfony/config without much difficulty at all. This means Package Manager no longer needs symfony/config. IMHO we should close this issue.
Comment #14
effulgentsia commentedClosing this as a duplicate of #3111008: Use native Symfony YamlLoader + Config. I think that issue is still worth doing if whatever the remaining challenges are there can be resolved.