Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using source controlled libraries in source controlled projects [closed]

I have several projects that build reusable libraries. All these projects are under source control.

When I use these libraries in a project I simply link to the same ONE version on my local drive. However as you can imagine, this can cause problems when I commit back, and a different developer tries to clone the repository.

What is the best practice when using components also under source control? Should I include the "library projects" in the "main project" source control? Will this cause problems?

NB: The libraries take quite a few compiler directives so its almost impossible to just compile a static version and link to that. Plus I'm still developing them in parallel.

like image 421
Richard Stelling Avatar asked Jul 03 '10 10:07

Richard Stelling


1 Answers

You have two main kind of dependencies:

  • source dependencies (you need to include, within the sources of your project, source from another project),
  • binary dependencies (you need to include a packaged set of files, like the ones found in a shared library).

If, when you say "I use these libraries in a project", you mean you need the binaries in order for your project to compile, then you could store said binaries in an external repository (i.e. not a (D)VCS like Mercurial, but an artifact repository like Nexus)

But if you mean you need to include sources, because you are also making some evolutions to those libraries while using them to develop your project, then Mercurial subrepos are a better fit.

like image 191
VonC Avatar answered Oct 21 '22 08:10

VonC