Skip to content

Use real composer-patches format #47

@szeidler

Description

@szeidler

At first thank you all for the great effort. I enjoy using drupal_tests.

I created a custom module now, that required to patch a contrib module. For this I'm using composer-patches with the following format in its composer.json

"extra": {
    "patches": {
      "drupal/profile": {
        "PrivateTempStoreFactory is scheduled for removal in Drupal 9.0.0": "https://www.drupal.org/files/issues/2018-08-16/profile-fix_private_tempstore-2993092-2.patch"
      }
    }
  }

In some cases we define our patches also with an external patch file like

"extra": {
        "enable-patching": true,
        "patches-file": "composer.patches.json"
    }

with the format

{
    "patches": {
      "drupal/profile": {
        "Make profile label work with tokens and expose them in the UI": "https://www.drupal.org/files/issues/2018-03-11/2900573-17.patch",
        "PrivateTempStoreFactory is scheduled for removal in Drupal 9.0.0": "https://www.drupal.org/files/issues/2018-08-16/profile-fix_private_tempstore-2993092-2.patch"
      }
    }
  }

Using drupal_tests both strategies are not applied by default. The first definition in composer.json not, because inline patch definitions are not processed in drupal_tests and second not because of the file name. But even changing the file name to patches.json does not help, because it requires a slightly different json nesting format to make it working with drupal_tests.

The following patches.json would work.

{
  "drupal/profile": {
    "PrivateTempStoreFactory is scheduled for removal in Drupal 9.0.0": "https://www.drupal.org/files/issues/2018-08-16/profile-fix_private_tempstore-2993092-2.patch"
  }
}

That means I currently would need to define the same patches twice, one for automatically being applied by composer-patches and one separate for drupal_tests. Is this a bug, or have I done a mistake in my setup?

If it is a bug, I think we should work on the RoboFile, so that it fetches either inline composer.json patches or loading in the patch-file defined in patches-file to streamline the process.

Thank you in advance for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions