[p4] perforce "svn:externals" equivalent

Johan Nilsson r.johan.nilsson at gmail.com
Thu Aug 26 00:17:21 PDT 2010

Johan Nilsson wrote:
> Chuck Karish wrote:


>>>> So, is it possible to solve it on VCS layer?
>>> I tend to use branching for this purpose, e.g.:
>>> p4 integrate //myDepo/myLibraries/...
>>> //myDepo/myProject/myLibraries/...
>>> It is a bit heavier than using workspace mapping (can create quite a
>>> bit of metadata depending on complexity of "myLibrary") but is
>>> easier to maintain, IMHO of course. Single-line workspace/client
>>> definitions are a Good Thing(tm).
>> This requires recurring work to keep all the instances of the library
>> up to date.  If many products use the library other problems of scale
>> will arise; this solution uses a lot of server resources.
> Normally applications should depend on a specific/released version of
> a library (e.g. under //depot/.../myLib/1.0/...) and not on a branch
> in flux, so that should not be a big problem in terms of "keep all
> instances ... up to date".

But still, yeah, I admit it's heavyweight. Especially when the dependencies 
have dependencies.

For one specific project I instead retrieved the desired dependencies as 
part of the automated build, in a sort of "bootstrapping" step. One could 
still set up the workspace with a one-liner, but then one needed to e.g.:

# Sync the workspace
>p4 sync

# Download and build dependencies from other parts of the
# depot (or external like svn). This needs to be performed
# only once after initial sync unless the dependency
# specifications are updated.
>bjam --build-dependencies

# Normal build. Used from this point on.

You'll just have to weigh in the complexities and requirements of the 
project(s) in question when determining how to handle dependencies. In some 
cases you might instead decide to include ("p4 add") the dependencies 
straight into the project, perhaps even precompiled if applicable.

The main thing, IMHO, is to be able to reproduce the build with a minimum of 
effort (i.e. manual steps) in setting up the workspace for the project. If 
too many steps are required, you will sooner or later get it wrong.

Regards / Johan

/ Johan

More information about the perforce-user mailing list