Problem/Motivation
In #2880237: [meta] Refactor system/base library, #3432183: Move system/base component CSS to respective libraries where they exist and #2484623: Move all JS in modules to a js/ folder we're moving files between library definitions and/or to different locations in the filesystem.
This is allowable under the bc policy (file locations and data structures aren't an API), but it also definitely will break library-overrides when we do it.
Steps to reproduce
Proposed resolution
Add a 'moved_files' key to library definitions. This is specified in the library that the file as moved to or within, not the file that it has moved from.
The moved_files key has entries for css and js, those entries are the old filename, and the location of the new filename in the same format as they would be specified. Examples in the MR.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3432601
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3432601-deprecation-support-library-overrides
changes, plain diff MR !7132
Comments
Comment #2
catchComment #3
catchGot something working.
The main drawback is that the deprecation versions apply by library rather than file. However, moving more than one file to the same library in different versions doesn't seem that likely - and the removal version ought to be the same in those cases. Trying to do the deprecation version per-file would make the already complex YAML format even more complex.
Comment #5
catchHoping to get a nice deprecation failure on a test somewhere so we can just add more expectDeprecation() rather than a whole new test case.
Updated the issue summary a bit. Will need docs and change record but would like reviews before that in case the format ends up changing.
Comment #6
catchDeprecation support is in with test coverage now.
The one limitation of the deprecation support is you can only have one version/change record per library that you've moved files from - however moving multiple files to and from the same libraries in different releases seems like an extreme edge case. If you move multiple files from the same library (like system/base) to lots of different libraries in different versions, it will support that fine because it's the libraries you move files to that determine the messages.
Comment #7
smustgrave commentedSo not sure I fully follow
"moved_to" is the new library
Then are we saying we are moving files from "theme_test/moved_from"
Should the deprecation links be on "theme_test/moved_from" though? The deprecated key makes it sound like we are removing these files from the library.
But moving to NW for the change record as that might help clear it up.
Comment #8
catchWe only get library info for libraries that are requested during the request, when 'moved_from' is requested (if that ever happens), it doesn't matter that some code used to override a file in it, because the file is no longer there to be overridden.
However when the 'moved_to' library is requested, that includes the file that the theme is trying to override - so we need to warn the theme then.
Filled out the change record a bit.
Comment #9
smustgrave commentedThanks, reading the CR and that does help clear things up.
Comment #10
quietone commentedI left some comments in the MR.
Comment #11
catchReworked the deprecation messages, I was trying to keep the maximum amount of information, but having them readable by a human is more important.
Comment #12
smustgrave commentedDoes the CR need to be updated with new message?
Comment #13
catchNo the wording isn't in the change record.
Comment #14
smustgrave commentedGotcha!
Comment #15
catchAdded the
moved_filesentries on #3432183: Move system/base component CSS to respective libraries where they exist.Comment #16
quietone commented@catch, thanks for adjusting the deprecation message.
There were conflicts so I did a rebase. There was one conflict in LibraryDiscoveryParser in the use statements. It was a simple fix so I leaving this at RTBC.
Comment #20
nod_Committed 5254c77 and pushed to 11.x. Thanks!
Backported to 10.3.x