Symplify: [MonorepoBuilder] Invalid classmap entries in the merged composer file

Created on 12 Jan 2019  路  4Comments  路  Source: symplify/symplify

I've been using composer-monorepo-plugin for a long time now, but it looks like abandoned considering that some issues opened years ago are still waiting for feedback. So I decided to give a try on this plugin after your suggestion. However, I'm facing some issues trying to use the plugin with a pretty simple project structure like the following:

root
  packages
    acme
      package-a
      package-b
      package-c
      package-d

For some reason that I wasn't able to figure out, when I merge the composer files the plugin includes an extra classpath property (twice) that does not exist in any of the packages composer files:

{
     "autoload": {
        "classmap": [
            "packages/acme/package-d/src/",
            "packages/acme/package-d/src/"
        ]
     }
}

What is more intriguing is that it is the last package in lexicographic order. After spending a few hours trying to understand the source of this problem without success, I decided to open this issue.

bug

All 4 comments

Hi, thanks for detailed description.

What is expected output? I assume this

{
     "autoload": {
        "classmap": [
            "packages/acme/package-d/src/"
        ]
     }
}

I investigated more in-depth and discovered the bug is a bit more general. Any classmap in the packages composer files will generate a classmap entry in the merged file with the package path of the last merged composer file, even though it does not contain such property:

package-a/composer.json

{
     "autoload": {
        "classmap": [
            "src/"
        ]
     }
}

package-b/composer.json

{
     "autoload": {
        "classmap": [
            "src/"
        ]
     }
}

Generated composer.json

{
     "autoload": {
        "classmap": [
            "packages/acme/package-d/src/",
            "packages/acme/package-d/src/"
        ]
     }
}

Thanks for examples!

Thank you!

Was this page helpful?
0 / 5 - 0 ratings