0

I have this following scenario:

  • a core lib, let's call it A.
  • a features lib, we'll call B. B depends on A.
  • a tool, called C, depending on A and B.

A is shared across many projects. B is shared across 3-4.

So, the layout is as follows:

  • Project C has a submodule with A inside.
  • Project C has a submodule with B inside and, in turn, B has a submodule with A inside.

This works well in git, although it fails quickly on the project side.

The first implication is that C and B could use different revisions of A, but that's just up to us to not mess that up.

The main issue is that it is not be possible to have a project including 'A' twice in the IDE.

Is it possible to have B as a submodule, but B wouldn't its own submodule? so we woudln't have two copies of A?

Additionally, I'm sure there are others with the same problem. Is there a common / accepted way to deal with that issue?

Thomas
  • 10,933
  • 14
  • 65
  • 136
  • Does [this](https://stackoverflow.com/questions/27379818/git-possible-to-use-same-submodule-working-copy-by-multiple-projects/27384763#27384763) help? – jthill Oct 21 '19 at 14:52
  • it's good info, thanks; but it doesn't totally solve the issue because there is a problem on the .net side related to this. I'm looking at ideas right now – Thomas Oct 21 '19 at 17:05

1 Answers1

0

The common/accepted way to deal with that issue is not to use git submodules. Once things get too complicated, there are too many things that can go wrong.

Use a package manager instead, like NuGet or Paket. Those will also help with ensuring that only a single revision is used across all the projects, help to resolve the revision that can be used for all the dependencies and provide tools to update the packages.

With NuGet you will have to create packages out of A and B, Paket allows git dependecies, so you will only have to update build/project/solutions in B and C.

filhit
  • 2,084
  • 1
  • 21
  • 34