Attached is a patch which adds native Drush9 integration. The existing Drush integration is left in place, just renamed so that the file is not loaded by Drush9. This leads to a little but of code deplication but not much . I think its harmless.

The devel_generate drush integration has been refactored and cleaned a lot.

webprofiler should get Drush integration in addition to its current Console integration. Can be a follow-up.

@todo - change from existing services.yml to a drush dedicated services.yml

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

moshe weitzman created an issue. See original summary.

moshe weitzman’s picture

Status: Active » Needs review
willzyx’s picture

Not sure if it is the way to go.. registering drush commands as a services could intoduce an hidden dependency on drush; with this patch on a env where drush is not installed you obtain a fatal error

moshe weitzman’s picture

That makes sense. I see that Console uses a separate console.services.yml file. Anyone know how that gets loaded and used?

moshe weitzman’s picture

Status: Needs review » Needs work
moshe weitzman’s picture

Uses constructor injection for the Manager. Also uses class prperties instead of drupal_static() to persist the "instance and values". I still need to fix services delaration per #3.

Drush9 has deprecated drush_get_option() (options are passed into command method) and drush_set_error() (just use exceptions). Does anyone object if I change the devel_generate plugins to adapt to this model? I'm also OK with deferring this to Devel 9.

moshe weitzman’s picture

Issue summary: View changes
moshe weitzman’s picture

Now using own drush.services.yml files. If you are using Drush9, update to today's version or later.

moshe weitzman’s picture

Status: Needs work » Needs review
moshe weitzman’s picture

Status: Needs review » Fixed
willzyx’s picture

Looks like that with this commit we have lost (at least):
- phpstorm metadata drush integration
- test coverage for devel_generate drush commands

:(

moshe weitzman’s picture

1. I searched and couldn't find anyone talking about this on the internet. We havent received many bug reports AFAIK
2. Drush9 has no suggestion for how contrib commands should get tested. For now, suggest that the plugins get unit tested outside of drush.

Status: Fixed » Closed (fixed)

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