drupal_tests icon indicating copy to clipboard operation
drupal_tests copied to clipboard

Use real composer-patches format

Open szeidler opened this issue 5 years ago • 1 comments

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.

szeidler avatar Aug 17 '18 10:08 szeidler

It's totally a bug given our readme says we're following the composer-patches format. Now that an 8.6 RC is out I will be working on that, and I will take a look at this at the same time, unless you feel like taking this on.

deviantintegral avatar Aug 20 '18 15:08 deviantintegral