Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

If I use an existing open source project that is hosted for example on github within one of my projects, should I check in the code from the other project into my public repo or not? I have mixed feelings about this, #1 I want to give proper credit and attribution to the original developer, and if appropriate I will contribute back any changes I need to make. However given that I have developed / tested against a specific revision of the other projects code, that is the version that I want to distribute to users of my project.

Here is the specific use case to illustrate my point. I am looking for a more generalized answer than this specific case. I am developing simple framework using rabbitmq and python for outbound messages that will allow for sending sms, twitter, email, and is extensible to support additional messaging buses as well. There is a project on github that will make the creation and sending of SMS messages developed by another person. When I create my own repo how do I account for the code that I am including from the other project?

share|improve this question
    
Have you tried contacting the author of the open source project you are utilizing for your own project? What license does this other open source project utilize? –  Bernard Jun 28 '12 at 2:47
    
Good question @Bernard, but there is not a specific license listed on the project or in the code. I may not have phrased it well, but the question is not about licensing, it is about keeping my code in sync with the developers code. One model I could choose is to give in the installation instructions a note that the user must also install this other package, but if they install a different version than the one I had developed against, there could be bugs introduced. Does that make more sense? –  Bryan Kemp Jun 28 '12 at 2:52

2 Answers 2

Absolutely, unequivocally, if you are legally able to do so check the code into your repo.

  1. You want your builds to be hermetic, meaning that you can just type "build" in the command line and not require any additional tools, libraries, SDKs, etc.
  2. You want to insulate your build from random breaks.
  3. You want things to keep working tomorrow like they do today. This is the same as #2 but more sinister.

The best way I have seen this done is to create a third_party folder in the root of your repo, and have all references go to that. Give each third party project its own folder, and inside of it put a LICENSE and README file explaining where you got it and what you can do with it.

For example:

/third_party/
    /WidgetLibrary1/
        README
        LICENSE
        /v1.0/
            ... all of its source

    /SuperAwesomeFramework/
        README
        LICENSE
        /v3.0/
        /v3.1/
            ... all of its source
/src/
    ... all of your source
share|improve this answer
    
Pretty sure I can type mvn install and not have to check in and track 100 open source libraries in my own repository and the build will still work. This would be horrible if I checked out a repository and it had 100 directories under third_party with all the source for each the libraries. Sure, downloading and storing the source somewhere is nice but checking it in to the main repository? That seems like an awful idea and a problem to manage. –  Andrew Finnell Jun 28 '12 at 7:17
    
@AndrewFinnell If you're going to use Maven, you're already in dependency hell, so there's no reason to keep copies of other projects' code. But I'd never build a serious project with Maven handling the dependencies unless I also had a Maven repository under my own control. –  Ross Patterson Jun 29 '12 at 22:36
    
@RossPatterson Which I do. Nexus is open source and amazing. –  Andrew Finnell Jun 30 '12 at 9:33
    
this is great advice! +1 –  qodeninja Feb 24 '13 at 4:33

From a technical point of view, Git has a feature called submodules that lets you incorporate a specific version of some external project into your repository. Other people who clone your repository will also get a copy of the correct version of the external project.

share|improve this answer
    
+1 for the link. I've been wondering about GitHub Submodules. –  ClintNash Jun 28 '12 at 4:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.