Support from Acquia helps fund testing for Drupal Acquia logo

Comments

timmillwood’s picture

timmillwood’s picture

Status: Active » Needs review
anavarre’s picture

Status: Needs review » Needs work
+++ b/composer.json
@@ -0,0 +1,6 @@
+  "license": "GPL-2.0+",

To have valid JSON, you need to drop the comma.

timmillwood’s picture

Status: Needs work » Needs review
FileSize
350 bytes
335 bytes

@anavarre - Thanks for the typo spotting!

$ composer validate
./composer.json is valid
anavarre’s picture

Thanks, looks good to me now.

anavarre’s picture

Status: Needs review » Reviewed & tested by the community
anavarre’s picture

Version: 8.x-2.x-dev » 8.x-1.x-dev
Shawn DeArmond’s picture

Bump!

Can we get this committed please? Without this composer.json file, composer automatically adds modules I don't need/want in my codebase, such as search_api and search_api_solr. I know those are needed for Acquia Search, but we're not using it, so we don't want the modules.

timwood’s picture

Looks like a composer.json was already added in https://cgit.drupalcode.org/acquia_connector/commit/?id=2ee12a8&h=8.x-1.x. This is when the unnecessary(?) drupal/search_api and drupal/search_api_solr modules were added as composer requirements.

Are the maintainers open to removing these requirements from composer.json? Why are they included? Are they actually needed for the connector module, or perhaps for the acquia_search sub module?

timwood’s picture

Here is a patch that should apply to 8.x-1.x as well as 8.x-1.16 (current 8.x release as of this comment).

timwood’s picture

Adding empty require in composer.json.

timwood’s picture

For some reason, composer wouldn't exclude the dependencies, even after applying my patch via composer.json using cweagans/composer-patches.

Mark Trapp’s picture

Status: Needs review » Fixed

Hi, thanks for the report and the suggested patch. We've committed a separate composer.json for acquia_search, and removed the search dependencies from the main module.

This has been committed to the 8.x-1.x branch: https://cgit.drupalcode.org/acquia_connector/commit/?id=744a539 and will be part of the next release.

timwood’s picture

Thank you!

Mark Trapp’s picture

Status: Fixed » Needs work

Unfortunately, Composer doesn't see the submodule composer.json, so the dependencies required for acquia_search are never resolved. I've reverted this for the time being.

gapple’s picture

Title: Add composer.json » Required packages in composer.json

For some reason, composer wouldn't exclude the dependencies, even after applying my patch via composer.json using cweagans/composer-patches.

Dependency resolution happens against the data retrieved from the package repository, before the packages are downloaded to your project, so you can't use a patch to change package dependencies.

Unfortunately, Composer doesn't see the submodule composer.json, so the dependencies required for acquia_search are never resolved. I've reverted this for the time being.

Composer.json is for projects, not modules, so there should only be one root composer.json file. (...unless you're doing package splitting like Symfony components / Drupal core's components, but that's not the case here...)


For those that would like to not include a sub-requirement, you can use the replace parameter in your project's composer.json, and composer will not download those modules.

    "replace": {
        "drupal/search_api": "*",
        "drupal/search_api_solr": "*"
    },
gapple’s picture

Alternately, if Acquia Connector would like assume by default that sites are not using Acquia Search, it could use suggest and conflict to tell users that they need to require additional packages for Acquia Search, and retrieve the correct versions.

  "conflict": {
    "drupal/search_api_solr" : ">=2.0"
  }
  "suggest": {
    "drupal/search_api_solr": "Required for Acquia Search"
  }

search_api_solr requires search_api, so both don't need to be added.

Dane Powell’s picture

Status: Needs work » Fixed

I think this is resolved in the latest release. We've moved the search dependencies to Acquia Search's composer.json. If you are using Acquia Search, you should composer require drupal/acquia_search in addition to Acquia Connector to get these dependencies, but other users of Connector won't get them.

Status: Fixed » Closed (fixed)

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