Problem/Motivation

The dependencies in *.info.yml files as a best practice should have the project specified https://www.drupal.org/node/2299747.

Currently Drupal core has a dependency on the Link project. This is because it specifies the link module as a dependency and projects with the same name as the module are preferred.

Currently the automated testing infrastructure (Project Dependency) assumes that Drupal core has no dependencies so the erroneous dependency on the Link project is ignored.

It is important for Drupal core to use best practices because contributed projects will follow the example set by core and specifying dependencies in an ambiguous manner may cause problems with automated testing. Also, if in the future Drupal core uses external dependencies it may not always be the case that Drupal core does not have dependencies.

Proposed resolution

Replace all dependencies that are not namespaced with their namespaced versions.

Remaining tasks

User interface changes

None.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

trobey created an issue. See original summary.

trobey’s picture

Status: Active » Needs review
FileSize
53.79 KB

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

borisson_’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs reroll

Patch doesn't apply anymore for these files.

  1. core/modules/hal/hal.info.yml
  2. core/modules/block_place/block_place.info.yml
  3. core/modules/content_moderation/tests/modules/content_moderation_test_views/content_moderation_test_views.info.yml...

I do think that this is a great idea, so it would be awesome to get this rerolled.

tstoeckler’s picture

Issue tags: +Novice
ankitjain28may’s picture

Status: Needs work » Needs review
FileSize
69.33 KB

Re-rolled

TR’s picture

Status: Needs review » Needs work
Issue tags: -Needs reroll

+1 for getting this done.

I applied the patch then examined all the .info.yml files in the Drupal distribution (using find, xargs, grep). It's almost entirely correct. However, I found a few problems:

1)

diff --git a/core/modules/views/tests/modules/views_test_formatter/views_test_formatter.info.yml b/core/modules/views/tests/modules/views_test_formatter/views_test_formatter.info.yml
index 91658d8..cd5e527 100644
--- a/core/modules/views/tests/modules/views_test_formatter/views_test_formatter.info.yml
+++ b/core/modules/views/tests/modules/views_test_formatter/views_test_formatter.info.yml
@@ -5,4 +5,4 @@ package: Testing
 version: VERSION
 core: 8.x
 dependencies:
-  - views
+  - druapl:views

Should be drupal:views, not druapl:views (spelling).

2) None of the profiles in core/profiles were fixed, they all still need namespaces in their .info.yml files.

3) core/modules/system/tests/modules/module_handler_test_multiple/module_handler_test_multiple_child/module_handler_test_multiple_child.info.yml was not fixed.

ankitjain28may’s picture

@TR Thanks for the feedback, I will make all the necessary changes.

ankitjain28may’s picture

Status: Needs work » Needs review
FileSize
77.49 KB

Made the changes as per comment #9

Status: Needs review » Needs work

The last submitted patch, 11: Add-namespaces-2798891-11.patch, failed testing. View results

TR’s picture

Hi @ankitjain28may:

Please create an interdiff to show the differences between #8 and #11. See https://www.drupal.org/documentation/git/interdiff

This is especially important with big patches like yours - I don't want to have to review the entire patch again, I just want to review the changes you made, and I can't do that without an interdiff.

TR’s picture

Ah, it seems I may have led you astray. See #2855026: Installation profiles do not support project:module format for dependencies. I guess profiles should NOT have namespaces yet, after all.

ankitjain28may’s picture

@TR I will remove the namespace in profiles and make a new patch with interdiff.

ankitjain28may’s picture

Status: Needs work » Needs review
FileSize
70.09 KB
1.25 KB

Added interdiff and patch, Please review.

TR’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. Patch in #16 addresses all the concerns I raised in #9. And the tests pass!

catch’s picture

Title: Add project namespaces to Drupal core » Define project dependencies in core module .info files

Re-titling because this looks like a feature addition when it's really clean-up.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed d90ac78 and pushed to 8.6.x. Thanks!

  • catch committed d90ac78 on 8.6.x
    Issue #2798891 by ankitjain28may, trobey, TR: Define project...
alexpott’s picture

Here are some follow ups:

TR’s picture

this change missed lots of test modules

@alexpott: Specifically, what's missing? The only .info.yml files that were left out were those that were under core/profiles, and those weren't
"missed" they were deliberately excluded because of #2855026: Installation profiles do not support project:module format for dependencies. After that goes in the profiles can be cleaned up all at once, rather than doing some parts of them now and some later.

Status: Fixed » Closed (fixed)

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

geerlingguy’s picture

Coming over from #3011936: Apply new format for dependencies... and this feels so... weird.

When I define a module dependency with composer, it's:

drupal/modulename

And now when I define a module dependency in my module's .info.yml file, it's:

modulename:modulename

But if I define a module dependency for one of the modules in the core/ directory, it's:

drupal:modulename

I am questioning my sanity; was there any CR about why this is the case, or what it's useful for? Especially as we start sticking this into Drupal's default coding standards review, I think it would be nice to know why this is done, and why are introducing another Drupalism here :/

trobey’s picture

@geerlingguy: You should be questioning your sanity or at least doing a bit more research. First there is a link to a CR posted right at the top in the Problem/Motivation section. That would be a good place to start. You should not be using

modulename:modulename

anywhere. It should be

project:module

everywhere and the project is optional. In many cases the name of the project is the same as the name of the module. We often refer to installing a "module" when we are installing a project. Projects can contain multiple modules and the lax terminology leads to confusion such as yours. For Project Dependency it makes a huge difference when these terms are used incorrectly. The last line of code is really just the above line of code applied to Drupal core. There is nothing special about this for Drupal core.

The last thing is ":" is often used for scope and this was implemented before Drupal started using Composer. It is not another Drupalism. PHP uses "::" but this has been criticized for not following a simpler one character for scope. I chose to use what is commonly used in many computer languages. Composer uses a forward slash which is more a symbol associated with directories than with scope. Some people may prefer one over the other but they are both acceptable and I do not think it is worthwhile starting an issue over them when we have a lot more important things to address.

trobey’s picture

One additional point. Composer does not use

drupal/modulename

It uses

drupal/project