But there's a catch: the Perforce Eclipse plugin doesn't work, because the Perforce client spec specifies the root of the actual source tree on disk, but the Eclipse Perforce plugin thinks the source tree is rooted at the directory that contains the Eclipse projects.
For example, if we start with this client spec:
Client: originalclientand use links to create this Eclipse structure:
Root: C:\
View:
//trunk/src/... //originalclient/src/...
C:\projects\then the Perforce root is C:, but the Eclipse Perforce plugin thinks the root is C:\projects.
Child1\
.classpath
.project
src\
com\
parent\
child1 → linked to
C:\src\com\parent\child1
Child2\
.classpath
.project
src\
com\
parent\
child2 → linked to
C:\src\com\parent\child2
To fix this, we updated our link-generation script to generate a second client spec, where the client spec's root is the directory that contains the Eclipse projects, and the client spec maps individual sub-roots to their counterparts in the Eclipse projects (a one-for-one mapping between Perforce and the links):
Client: myclientNote that although we have three different "views" of the source tree (two in Perforce and one in Eclipse), there is only one actual occurrence of each source file on disk, which means changes are kept in sync among all three views.
Root: C:\projects
View:
//trunk/src/com/parent/child1/... //myclient/Child1/src/com/parent/child1/...
//trunk/src/com/parent/child2/... //myclient/Child2/src/com/parent/child1/...
So if Perforce can do this mapping, why do we need the links at all? In many cases, you might not. In our case, though, the file layout in Perforce is really complicated, and it would be painful to create a client spec that maps all of the files to the file system. For example, there are sixty or so files at the very root of the Perforce tree, and these would have to be mapped to a directory on disk while using client-view exclusions to prevent mapping everything else in the root to that same directory. For us, it's easier to use the second client spec to map only the files we need in Eclipse--and to map them to directories that are actually links into the full tree.
0 comments:
Post a Comment