flxbl-io / sfp

A build system for modular development in Salesforce
https://docs.flxbl.io/sfp/
MIT License
31 stars 18 forks source link

dependency expand (and so build) failed to resolve transitivity #97

Closed alanjaouen closed 3 months ago

alanjaouen commented 4 months ago

Describe the bug With a certain order of unlocket package in sfdx-project.json, package dependencies failed to be resolved

To Reproduce with a sfdx-project.json, have package C depedency resolved as

flowchart LR
    C --> B --> A --> Base

having package in this order result on package C dependency resolved as only B and A (missing Base)

    {
      "package": "base",
      "type": "unlocked",
      "path": "./src/base",
      "versionNumber": "1.0.0.NEXT"
    },
    {
      "package": "A",
      "type": "unlocked",
      "path": "./src/A",
      "versionNumber": "1.0.0.NEXT",
      "dependencies": [
        {
          "package": "base",
          "versionNumber": "1.0.0.LATEST"
        }
      ]
    },
     {
      "package": "C",
      "type": "unlocked",
      "path": "./src/C",
      "versionNumber": "1.0.0.NEXT",
      "dependencies": [
        {
          "package": "B",
          "versionNumber": "1.0.0.LATEST"
        }
      ]
    },
    {
      "package": "B",
      "type": "unlocked",
      "path": "./src/B",
      "versionNumber": "1.0.0.NEXT",
      "dependencies": [
        {
          "package": "A",
          "versionNumber": "1.0.0.LATEST"
        }
      ]
    }

a workdaround was to reorder package like this:

    {
      "package": "base",
      "type": "unlocked",
      "path": "./src/base",
      "versionNumber": "1.0.0.NEXT"
    },
    {
      "package": "A",
      "type": "unlocked",
      "path": "./src/A",
      "versionNumber": "1.0.0.NEXT",
      "dependencies": [
        {
          "package": "base",
          "versionNumber": "1.0.0.LATEST"
        }
      ]
    },
-     {
-      "package": "C",
-      "type": "unlocked",
-      "path": "./src/C",
-      "versionNumber": "1.0.0.NEXT",
-      "dependencies": [
-        {
-          "package": "B",
-          "versionNumber": "1.0.0.LATEST"
-        }
-      ]
-    },
    {
      "package": "B",
      "type": "unlocked",
      "path": "./src/B",
      "versionNumber": "1.0.0.NEXT",
      "dependencies": [
        {
          "package": "A",
          "versionNumber": "1.0.0.LATEST"
        }
      ]
    },
+     {
+      "package": "C",
+      "type": "unlocked",
+      "path": "./src/C",
+      "versionNumber": "1.0.0.NEXT",
+      "dependencies": [
+        {
+          "package": "B",
+          "versionNumber": "1.0.0.LATEST"
+        }
+      ]
+    },

Expected behavior package definition order must not impact transitive dependency resolotion

Platform Details (please complete the following information):

azlam-abdulsalam commented 4 months ago

@alanjaouen Thanks for the detailed write up.. yep, it should. not impact definition order