Transient Dependencies - How do I point all instances of a dependency to one branch/tag for a CI build?

So, we have a dependency tree something like :

 Package A
   ├ Package B
   │   └ Package C
   └ Package C

A depends on B & C
B depends on C

On my local machine, I just use path dependencies so both C's basically point to the same directory.
This works perfectly for development.

But when running the CI process, we need to specify which branch/tag C needs to point to. Can this be done in 1 spot, or do we HAVE to change the manifest in both A & B to point to the same branch/tag of C ?

(In cocoapods, we can just define the dependency of C in A, and then B will also use the same version of C as A does.)

1 Like

I found a solution.

  1. I created a dotenv file containing variables that holds the branch names I want to use in the dependency tree. For example export package_branch=feature/userstory1234
  2. I source the dotenv file on the build environment, so the variables end up on the environment.
  3. The manifest files (including the manifests of the dependencies) reads the variables from the environment and uses the branch names for the .package(url: url, branch: branch).
    • This is done using ProcessInfo.processInfo.environment["package_branch"]