views:

22

answers:

1

I have the following git repositories:

  • ReusableA
  • ReusableB
  • ReusableC
  • Application1

ReusableB and C both depends on ReusableA. Therefore both repositories include ReusableA as a git submodule. Application1 depends on ReusableB and ReusableC, so it includes both as git submodules. However, this should cause the Application1 repository to contain two instances (of possibly different versions) of ReusableA. So my question is basically, is this something I should avoid, or can I just make a build script in Application1 that simply ignores one of the ReusableA instances (and preferably I wouldn't want to initialize it either)?

Can you give me some advice? If this really is a scenario to avoid, how could I accomplish that? Best practices?

+2  A: 

In this case, it is best to also include ReusableA as a direct submodule of Application1.
Application1 would build by using only its own specified version of ReleaseA, effectively "overriding" the versions used by ReusableB and ReusableC.

  • This is quite common in development phase, where you cannot expect all modules to respect the same dependencies.
  • However, in integration or assembly phase, you need to detect and report those situations (where ReusableA is used with different version between Application1, ReusableB, and ReusableC)
  • The goal is to build the final release which will go into production with one and only one version of ReusableA.
VonC