Support from Acquia helps fund testing for Drupal Acquia logo

Comments

effulgentsia’s picture

Status: Needs review » Needs work

The last submitted patch, annotations_10.patch, failed testing.

effulgentsia’s picture

Status: Needs work » Needs review
FileSize
179.1 KB

How about this? Don't let the size scare you. It's 99% global search/replace. Only the two AnnotatedClassDiscovery classes contain substantive changes.

Status: Needs review » Needs work

The last submitted patch, plugin-annotatedclassdiscovery.patch, failed testing.

effulgentsia’s picture

Status: Needs work » Needs review
FileSize
179.96 KB

Added Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery::getPluginNamespaces(), because setting it only in the constructor was causing the test failures for reasons stated in the PHPDoc for it.

effulgentsia’s picture

Chasing HEAD.

effulgentsia’s picture

In case #6 is too big to get in quickly, here's a version that retains Drupal\Core\Annotation\Plugin with a @todo to remove it from the 300 classes that use it later.

effulgentsia’s picture

+++ b/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php
@@ -26,75 +20,29 @@ class AnnotatedClassDiscovery implements DiscoveryInterface {
+    foreach (drupal_classloader()->getNamespaces() as $namespace => $dirs) {
+      $plugin_namespaces["$namespace\\Plugin\\{$this->owner}\\{$this->type}"] = $dirs;
     }

I discussed #7 with EclipseGc, and he suggested making the drupal_classloader()->getNamespaces() above overridable with an optional constructor param, so here's that. Interdiff is failing me on this one, so here's a regular "diff" of the 2 patch files instead.

EclipseGc’s picture

if that passes I'm 100% ++

tim.plunkett’s picture

This doesn't conflict at all with what I tried to do in #1847002: Move entity type classes from Drupal\$provider\Plugin\Core\Entity to Drupal\$provider\Entity (move the hardcoded Plugin\$owner\$type namespace into a method) since it still has getPluginNamespaces() to override, so I'm okay with this.

Berdir’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
1.83 KB
14.59 KB

Attached re-roll just contains a bunch of Definition of vs. Contains fixes and one namespace reference fix.

This has the sign-off from EclipseGC and tim.plunkett and it looks great to me as well. RTBC.

Do we want to open a follow-up issue to convert the use definitions from Core to Component?

EclipseGc’s picture

No I don't think we do, the whole point of having core/component here is so that we have a more injectable approach that still has core assumptions for when we're not injecting. This shouldn't require any sort of large scale updating of existing managers, and actually should give a few new abilities to people who've been asking for them.

Berdir’s picture

+++ b/core/lib/Drupal/Core/Annotation/Plugin.phpundefined
@@ -7,68 +7,15 @@
+ *
+ * @todo Remove after globally replacing all plugin classes to "use" the
+ *   Component one instead of this one: http://drupal.org/node/1849752.
  */
+class Plugin extends ComponentPlugin {

@EclipseGc: What you are saying probably makes perfect sense, I don't know that much about the plugin/discovery system yet.

But it does seem to conflict with this @todo? Do we maybe need some more documentation here then to tell people when they should use which annotation class?

EclipseGc’s picture

That's a fair point. Who wrote that todo? is it still valid? if so, why?

Eclipse

catch’s picture

Status: Reviewed & tested by the community » Needs work

Looks like the @todo needs clarification (I'm also confused by it).

effulgentsia’s picture

There's no reason for D8 to ship with a Drupal\Core\Annotation\Plugin class that extends Drupal\Component\Annotation\Plugin, but does nothing extra or different. The only reason for it in #11 is to avoid people having to review and reroll a 200kb patch that's 90% global search/replace (see #6). My thought was we could commit #11, and then follow up with the global search/replace and removal of the stub Drupal\Core\Annotation\Plugin class right here in this issue within a day or so of when the initial patch is committed.

Note: this is not about AnnotatedClassDiscovery: it's about the class that defines the @Plugin annotation itself.

Given the above, any thoughts on how to reword the @todo to make that clear?

catch’s picture

Oh I see. If that's the case, l think we could just add a follow up issue to remove it. No point fussing over a @todo that's supposed to only live for 2 days.

effulgentsia’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
14.26 KB

Removed the two @todos related to that.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Looks sensible. Committed/pushed to 8.x.

effulgentsia’s picture

Status: Fixed » Needs review
FileSize
171.5 KB

And here's the follow up per #16.

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

catch’s picture

Status: Reviewed & tested by the community » Needs work

The last submitted patch, plugin-annotatedclassdiscovery-followup-20.patch, failed testing.

jibran’s picture

Status: Needs work » Needs review
FileSize
171.55 KB

Reroll

Status: Needs review » Needs work

The last submitted patch, plugin-annotatedclassdiscovery-followup-24.patch, failed testing.

effulgentsia’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
199.93 KB

New global search/replace. This was already RTBC'd in #21; this is just updated for the new plugins added since then, so straight to RTBC.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, plugin-annotatedclassdiscovery-followup-26.patch, failed testing.

neclimdul’s picture

Status: Needs work » Needs review
FileSize
230.33 KB

reroll

Berdir’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. I scrolled through the complete patch, I think that gives me the right to RTBC this :)

RobLoach’s picture

+1

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.x, thanks!

podarok’s picture

Priority: Normal » Critical
Status: Fixed » Needs work
Issue tags: +Needs change record

this one needs change records due to
before

use Drupal\Core\Annotation\Plugin;

after

use Drupal\Component\Annotation\Plugin;

namespace resolving change

tim.plunkett’s picture

Priority: Critical » Normal
Status: Needs work » Fixed
Issue tags: -Needs change record

Updated http://drupal.org/node/1704454. As this is a HEAD2HEAD only change, this doesn't need its own change notice.

Status: Fixed » Closed (fixed)

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