Problem/Motivation

symfony/finder is currently a dev-dependency of Drupal core, which allows its use during the development of core, but not during actual site development. The component is not included in either the tarball or composer versions of Drupal

This issue aims to promote the dependency out of dev status, making those components available to parts of core Drupal developers may use in their projects.

Issues/Projects Impacted

#3364885: Allow themes to use a starterkit.yml file so it is easier to use the theme generator aims to use symfony/finder to locate files using the starterkit theme's machine name or label in their filename or contents, rather than creating our own solution to recursively scan theme directories

The automatic updates initiative recently removed finder as a dependency in #3321933: Remove dependency on symfony/finder, but @phenaproxima said they would surely use it if were a core dependency (slack link).


Background

In slack, @catch says:

The main thing with both is that they've got overlap, but not interchangeable, with subsystems we've already got in core, so ideally we'd identify where that overlap is and isn't, and what should and shouldn't be converted etc. - it doesn't need to be fully done but it'd be good to have a start considering the last time this was looked at was ten years ago for finder.

Also that's probably the only thing, the normal dependency evaluation stuff is covered by 'it's another Symfony component' so it's just making sure we know where the lines are between it and existing code. We have the same overlap issues with the translation component (which we've been careful to avoid dependencies on) and other code.

#1451320: Evaluate Symfony2's Finder Component to simplify file handling is 13 years old but would be somewhere to start.

If the answer is 'no we shouldn't use any of it', that's fine too but it should go in a change record or something.

Next Steps

  1. Need someone with PHP expertise evaluate symfony/finder for additional potential usage outside of its use for starterkit
  2. If there are no additional potential usages, we need to make sure that's reflected in the change record

Comments

andy-blum created an issue. See original summary.

andy-blum’s picture

Issue summary: View changes
catch’s picture

Is there any other core code we'd be able to replace with this?

andy-blum’s picture

There are certainly other instances in core that could be replaced by finder. The following are a few places that seem like potential benefactors:

andy-blum’s picture

Another potential spot is adding it to the core filesystem service to expand the capabilities of that service

longwave’s picture

#1451320: Evaluate Symfony2's Finder Component to simplify file handling already discussed this a bit, although a lot of the findings there are likely outdated by now.

andy-blum’s picture

andy-blum’s picture

Issue summary: View changes
Issue tags: +Needs change record

Updated issue summary

andypost’s picture

Core already using custom iterators so not sure this component makes sense to use - there's only 3 places to apply it according #4

Would be great to provide examples hot this component will improve DX

PS: drush already depends on it

wim leers’s picture

Category: Feature request » Task
Priority: Normal » Major
Issue tags: +blocker

This is blocking #3364885: Allow themes to use a starterkit.yml file so it is easier to use the theme generator, so matching issue metadata.

@andy-blum Why a new issue? The existing issues have many more followers, and are likely to proceed faster. 😅

dave reid’s picture

Personally, as a module and distribution profile maintainer who maintains a lot of scaffolding tools, I've had to add symfony/finder and symfony/filesystem as not-dev dependencies myself to the projects I work on. In fact, I found it odd that Drupal Core didn't provide these as dependencies already.

I would support adding the dependency for all, and then separately follow-up for D11 to see how we could reduce and switch more things over to the Symfony version. But I don't think the latter should be a hard blocker to solving this for the starterkit generator, which we desperately need as an install profile with a "starterkit" base theme.

We do not want drupal/core-dev as a dependency for anything, we have encountered issues bringing that into consumer sites because of the composer/composer dependency.

andy-blum’s picture

Opened #3395586: Add Symfony's Filesystem and Finder components to core for the work following this dependency evaluation.

alexpott’s picture

Status: Active » Fixed
Issue tags: -Needs release manager review, -Needs change record

We discussed this in Lille and @catch and @longwave agreed to add the components as regular dependencies.

alexpott’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.