Hi, I'm new to monorepos and have a question about...
# general
w
Hi, I'm new to monorepos and have a question about versioning individual projects in a monorepo generally, and also in pants. Let me explain what I'm thinking about on an example. Say we have a monorepo composed of a library (or more broadly shared code) and two independent services using the library. The development on the two services happens independently and one service needs to make a breaking change to the library. What are the best practice in monorepo setups generally and also in pants to handle this situation? Are the developers making the breaking change responsible for handling this in any code inside the monorepo that depends on the code they made a breaking change to? Or can individual projects inside the monorepo depend on a specific version of the library (or shared code)? If this is the case, is it possible in the pants build system?
r
Best practice is the person changing the library makes sure their change doesn't break anything. So, yes, they are responsible. There isn't a notion of version for anything inside the monorepo; everything must be depended on at HEAD.
👆 1
h
Yeah, one big advantage of a monorepo is that if you make a breaking change you can see everything you've broken and fix it, all at HEAD. I would argue that anyone making a change is responsible for fixing everything downstream from that change. A monorepo makes it easy to find those downstream dependents.
The alternative (versioning) introduces a "JAR hell" problem into your first party code. It's bad enough that those are unavoidable in 3rd party code...
For example, say I need to consume an update to Library A, but the updated version of A now depends on a different version of Library B than the one I also depend on, so now I have to upgrade B as well. And I may not have a good idea of how to even upgrade! The person that made the breaking change may have done so months ago. They may not work at the company any more!
Now, you can do the versioned dependencies thing at deploy time, if you build multiple distributions out of the monorepo and they depend on each other at deploy time via publishing and consuming requirements. But the entire monorepo still needs to pass all tests. At test time all code dependencies are source dependencies at HEAD.
w
Thank you so much for quick answers guys!