Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best Practices for Source Control Dependencies

How do you handle source control setup of a non-compiled project that has dependency on a separate framework or library? For example, Project A uses Framework B. Should Project A also include the code from Framework B in its repository? Is there a way for it to be included automatically from a different repository or would I have to updated it manually? What are the general approaches are usually taken for this scenario? Assume that I control the repositories for both Project A and Framework B and that the source code for both is not compiled.

Any resources or suggestions would be greatly appreciated. I'm currently using Subversion (on a very basic level), but I would like to switch to Mercurial so that I can try out Kiln with Fogbugz.

Edit: In Mercurial, would you use parent repositories for this function?

like image 220
VirtuosiMedia Avatar asked Mar 07 '10 21:03

VirtuosiMedia


3 Answers

If you want to use subversion and need to include code from a different repository, Subversion Externals might be an option.

However, if you're dealing with compilable code it might be better to setup a build process that just fetches the required binaries. Build tools like Maven can help you with that.

like image 87
Josef Pfleger Avatar answered Sep 28 '22 06:09

Josef Pfleger


Most of the time I try to include everything necessary to build the project in subversion. This is using C# and Visual Studio, so most of my dependencies are dlls. Conventions might vary a bit in other environments.

This is usually how I lay out a new project:

  • ref
    • SomeOpenSourceProject.dll
    • SomePurchasedComponent.dll
  • MyProjectA
    • MyProjectA.csproj (references ..\ref\SomeOpenSourceProject.dll)
  • MyProjectB
  • MyWeb (references ..\ref\SomePurchasedComponent.dll)
  • MyApplication.sln

This way it can be checked out and built by a new developer without much hassle. In the past they used to use a network share for the dlls, but that got annoying as different projects used different versions and if you wanted to go back in subversion or branch or anything, it got hard to keep track of. This structure solved those problems nicely.

like image 34
David Hogue Avatar answered Sep 28 '22 06:09

David Hogue


I do something very similar to David Hogue, except that it looks like this:

- lib (anything used IN the software)
    - purchased_component.dll
    - internal_library.dll
    - icon_set
        - icon1.ico...
- tools (anything used to BUILD the software)
    - nunit.framework.dll
    - settings.stylecop
    - settings.fxcop
- src (the software itself)
    - myapp.sln

Most of the inspiration for this setup came from tree surgeon (fairly out of date by now though)

like image 29
Steven Evers Avatar answered Sep 28 '22 07:09

Steven Evers