At Uppercase, we leveraged the Phing project to manage build/publish scripts for various projects using XML. Code was pruned locally prior to publication so that only the appropriate namespaces would be published. The recursive project requirements allowed us to ensure that all of the necessary code gets published out. The pruning process also allowed for arbitrary processing, including sprites, compiled JS/CSS, and automatic optimization of PHP code (including the suppression of debug code).
Publication targets followed the same namespace principles as the other UDI code, and the system worked reliably throughout the expansion.
However, reliable is not necessarily good enough. Although we continued to use phing, we created custom functions that leveraged system functions rather than the built-in system functions to improve the speed. For instance, a recursive copy with a filter was very slow with phing's implementation, but it was very fast when we tied into the local system's rsync commands.
As with many projects, after many hours spent optimizing it, it is distinctly possible that a simple custom script and custom configuration file syntax might have been faster and easier to train people on than the far more powerful and complex build system. However, there was never a build challenge that it could not address -- and that is hard to beat.