Removed the exist-samples directory, and confirmed that it's not needed; both Mariage and the eXist client work, and so do the admin interface features of the web interface. I've added that deletion into our script. I've also revised the script so that it saves a backup of the core eXist folder from SVN, and allows you to choose to use that if you'd prefer it, rather than a completely fresh checkout. That'll save time when the build process is being run many times, and might get aborted because of problems further down in the script.
Then went on to remove all the Cocoon samples which aren't needed, but replacing the file structure, the sitemaps, and the eXist block structure. That gives us the usual eXist admin pages, which are sometimes handy to have. The result is a total size of 100MB before a project is deployed in it. That's pretty darned good, I think. There may be other places I can trim, but the size of the project code is going to be a more significant factor than this in many cases, so I think this is a good basis to start with. Tested the new build script, and it works fine. Now I'm going to look at providing a test case for the XQuery Generator bug.