Problem/Motivation
One of the changes in #3214186: Scan for snippets of process plugins is
--- a/src/Plugin/MigrationPluginManager.php
+++ b/src/Plugin/MigrationPluginManager.php
@@ -23,7 +23,7 @@ class MigrationPluginManager extends DefaultMigrationPluginManager {
}, $this->moduleHandler->getModuleDirectories());
// Retrieves **/*.yml files but gets rid of /migrations/state/*.yml files.
- $yaml_discovery = new YamlRecursiveDirectoryDiscovery($directories, 'migrate', 'id', '#/migrations/state/#');
+ $yaml_discovery = new YamlRecursiveDirectoryDiscovery($directories, 'migrate', 'id', '#/migrations/(process|state)/#');
That does not scale well. I think we need an easy way for a developer to set exclude rules while working on a custom migration.
It might be useful to allow include rules as well as exclude rules. For example, a developer working on several related sites might want a single module (perhaps including some custom plugins) and migrations in migrations/site1/, migrations/site2/, ...
Proposed resolution
Either add an alter hook or trigger an event so that other modules can modify the paths to be scanned.
I think we should optimize for simplicity, not flexibility. Instead of giving other modules the list of directories and letting them manipulate it, just let them add include/exclude patterns.
Remaining tasks
User interface changes
API changes
This feature will add to the public API of this module.
Data model changes
Issue fork migrate_scanner-3214464
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:
Comments
Comment #2
matroskeenSounds interesting, let me try :)
Comment #4
matroskeenI think it would be a nice feature and it perfectly fits within the module scope.
I prefer hooks for such alterations, I find them easier to use.
The merge request is ready for review.
Comment #5
benjifisherComment #6
matroskeen@benjifisher, thanks for the review!
Can you have another look?
Comment #7
benjifisherI am sorry it has been more than a week since I last looked at this. I made some further suggestions on the MR.
Comment #8
matroskeenApplied requested changes. I think we're getting close :)
Comment #9
benjifisher@matroskeen:
Thanks, I think the new version of the alter hook is a big improvement. I made a few more suggestions on the MR. Back to NW.
Comment #10
matroskeen@benjifisher, thanks for the extensive review!
We can keep going, this is ready for review again ;)
Comment #11
benjifisherOK, the review looks good.
For a realistic test, I added a custom module and
migrations/process/clean_whitespace.ymlcopied from #3214186: Scan for snippets of process plugins. Then I got an error message:Then I added
and cleared all caches, and
drush msdoes not produce any errors.Test passed! RTBC
Comment #13
matroskeenTada! 🥳 Merged into 1.0.x.
@benjifisher, thanks!
Comment #15
sivakarthik229 commentedHi All,
I am getting similar error mentioned in #11 even after adding the migrate_scanner hook.
Please help me to fix the error.