- Issue created by @abramm
- πͺπΈSpain fjgarlin
Shouldn't module dependencies be defined in the "require" section of the "composer.json" file within the module?
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
I'd expect them to be in
require-dev
. - πͺπΈSpain fjgarlin
Test dependencies should be in the
require-dev
section.
Module dependencies should be in therequire
section.The
composer
step just builds the code according to what it says in thecomposer.json
file. - πΊπ¦Ukraine abramm Lutsk
I meant the explicit module dependency, i.e. something required for module to run.
That dependency would be included in
require
section ofcomposer.json
file generated for module release; however, if the module does not include the file (which is ok, contrib modules currently doesn't require to have it), it won't be generated during CI run (which runs on a git ref) and thus the dependency won't be installed.Probably the CI should generate the
composer.json
if it's not included in module repository. - πΊπ¦Ukraine abramm Lutsk
Updated issue summary to clearly state that this issue is happening if there's no
composer.json
file committed in a module repository. - π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
#6: Ahhh, now that makes more sense!
You're right that the Drupal.org composer facade has been generating
composer.json
for years. You've only needed to define one if and only if your depending on nondrupal/*
packages. (Also see @mixologic's comment at https://www.drupal.org/drupalorg/blog/drupalorgs-composer-endpoints-are-... β β it's the 4th comment.)Relevant issue: #2551703: Store composer.json if present β .
I think it makes sense that with the switch from
DrupalCI
toGitLab CI
, we start requiringcomposer.json
instead of providing dark magic to have it happen automatically. And in fact β¦ that would very much pave the path for β¨ Replace .info.yml with composer.json for extensions Postponed (which is postponed on #3250765: [meta] Clean up .info.yml files β ). - Status changed to Closed: won't fix
about 1 year ago 2:52am 5 November 2023 - πΊπΈUnited States moshe weitzman Boston, MA
Agree with #8. This is Wont Fix or By Design.
- π§πͺBelgium dieterholvoet Brussels
I don't think it's a good idea to require having module dependencies defined in both composer.json and info.yml. I have seen enough times that people updated a version constraint in one file but not the other, leading to confusing situations. As long as having module dependencies in info.yml is required, we shouldn't also make it required in composer.json, to make sure contrib modules maintain a single source of truth for their dependencies. And if we do decide to make both required, this should probably be communicated in a change record or in some form of documentation, instead of being hidden in some comment in a core issue.