Chapter 20. Building From Code Repositories

Often, a software project will have one or more central repositories, directory trees that contain source code, or derived files, or both. You can eliminate additional unnecessary rebuilds of files by having SCons use files from one or more code repositories to build files in your local build tree.

20.1. The Repository Method

It's often useful to allow multiple programmers working on a project to build software from source files and/or derived files that are stored in a centrally-accessible repository, a directory copy of the source code tree. (Note that this is not the sort of repository maintained by a source code management system like BitKeeper, CVS, or Subversion.) You use the Repository method to tell SCons to search one or more central code repositories (in order) for any source files and derived files that are not present in the local build tree:


       env = Environment()
       env.Program('hello.c')
       Repository('/usr/repository1', '/usr/repository2')
    

Multiple calls to the Repository method will simply add repositories to the global list that SCons maintains, with the exception that SCons will automatically eliminate the current directory and any non-existent directories from the list.