Viewpath
Feature Description
The viewpath defines a virtual directory structure, which allows multiple,
parallel trees to be viewed as a single tree. Only the topmost node is
writable, other nodes are read only. The viewpath allows developers to
share code and object files and reference a common base while maintaining
private development areas that contain only the files being modified.
It allows projects to easily scale to hundreds of users with minimal
overhead - each user can have their own viewpath.
The viewpath is often used to separate generated files from
source files. This is useful for building on multiple platforms, for
working with more then one compiler and for building with different
compiler options (eg. -g/-p) while distributing
existing generated targets.
Unlike other SCM tools, viewpathing is implemented completely
at application level and uses unmodified native file systems.
Impact
- Assists in avoiding redundant builds of pre-existing object files.
- Based on project size, resultant disk savings can be upwards of 50%
or more.
- Allows instantaneous sharing of entire project build area (including
generated objects), without need to copy or retrieve entire tree.
This eliminates possibly huge file retrieval/file copy times.
- Allows code and objects to be shared among developers and product
builders - leads to huge reduction in developer build time.
- Viewpathing through multiple nodes can represent various revision
levels of a product, thus simplifying build management.
- By modifying the viewpath, developers can build against previous
releases for patches and bug fixes, or against the most recent
changes for new development.
- Developers use a common, "blessed" base and only have personal
copies of the files being modified. The code base can be updated
on a regular basis, such as every night with "submitted" code, so
developers always reference the latest versions of files, which reduces
the risk of integration problems later in the development cycle.
- Consistency of shared nodes is guaranteed, unlike copied files which
inevitably get out of sync.
Consequence of Not Having the Feature
- Developers will use a private copy of the entire code base
of their product, which often leads to errors from not testing with the
latest changes from other developers.
- More disk space is required for each developer to have
a copy of the entire build (code and objects.) This can multiply
if developers need to work with multiple product versions, multiple
compilation options or multiple platforms.
- Time needed to copy entire build tree (possibly including
generated objects) to private area and reconfigure developer node could
be substantial.
Examples
The viewpath is defined by the VPATH environment variable,
which contains a colon separated list of nodes. Each node is the root
of a parallel tree structure. In the following example the current
working directory is under the first node (as it must be for the viewpath
to be in affect) and all the source code is in the second node. The
current directory is initially empty. We copy hello.c
from the second node to our work node, make a change, and then rebuild it.
hello.c is compiled from our work node but main.o
is reused from the second node. The viewpathing is completely automatic
after defining the VPATH variable. The Makefile author need
not do anything special.
$ pwd
/home/richb/work/src
$ export VPATH=/home/richb/work:/build/official
$ ls -l
total 0
$ ls -l /build/official/src
total 44
-rw-r--r-- 1 richb richb 24 Aug 19 15:07 Makefile
-rw-r--r-- 1 richb richb 5911 Aug 19 15:25 Makefile.mo
-rw-r--r-- 1 richb richb 14324 Aug 19 15:25 Makefile.ms
-rwxr-xr-x 1 richb richb 7180 Aug 19 15:25 hello
-rw-r--r-- 1 richb richb 79 Aug 19 15:07 hello.c
-rw-r--r-- 1 richb richb 1280 Aug 19 15:25 hello.o
-rw-r--r-- 1 richb richb 42 Aug 19 15:06 main.c
-rw-r--r-- 1 richb richb 1128 Aug 19 15:25 main.o
$ cat /build/official/src/Makefile
hello :: main.c hello.c
$ cp /build/official/src/hello.c .
$ vi hello.c
$ nmake
+ cc -O -I- -c hello.c
+ cc -O -o hello /build/official/src/main.o hello.o
Example using standard make tool
Standard make tools do not have the notion of the viewpath. Note, the GNU
make VPATH is quite different since it specifies a list of
regular directories to search for prerequisite files, where nmake
specifies a list of parallel trees to treat as a single virtual tree.
Last Update: Wednesday,20-Dec-06 13:22:02 CST
|