Friday, July 22, 2005

Don't shit where you eat

I made a recent change to the set of build scripts used by Tapestry and by HiveMind; it no longer builds inside my workspace. Let me explain why this is a good thing.

Your workspace is supposed to be a local image of the files stored in your source code repository, so that you can make changes to those files, then follow a compile/test/fix cycle, and eventually check the source files back in.

A common problem in many projects is when derived files, .class files, or .jar files, get accidentally checked in to a project repository. This can cause a lot of confusion, and may be difficult to clean up.

But more importantly, I've noticed when using Eclipse is that the number of files (not source files, but file system files) in my workspace affects the performance of the IDE. Somewhere, in the background, it is constanty checking for changes and re-indexing files using Lucene. Builds of Tapestry and HiveMind create a huge amount of documentation ... Javadoc, HiveDoc, test reports, clover code coverage and so forth. Thousands upon thousands of files ... none of which are interesting to me as a developer.

In the old scheme, all the output classes and jars and instrumented Clover source files, and everything else, were in target directories inside the workspace.

That's whay I mean about shitting and eating; it's better to stay clean.

What I did was change my Ant build files to create the target directories under ${java.io.tmpdir}. That is, a shadow project structure is created there, directories like C:\WINDOWS\TEMP\jakarta-tapestry\workbench\target. Just about everything goes there, except for a handful of output jar files (as a convienience) and some Forrest files (out of necessity).

My builds and my IDE run better and faster now. I think this is a model that should be followed by other build tools, such as Maven.

4 comments:

  1. I generally turn off automatic workspace refresh because I use smartcvs along with eclipse. When doing an update with smartcvs eclipse would thrash big time. You can change this in Preferences->Workspace.

    However, when you do decide manually update workspace, it may still take a long time.

    ReplyDelete
  2. Howard,
    In IDEA, you can exclude certain directories such that they won't be indexed. My common build system excludes the "build" and "dist" directories.

    Patrick

    ReplyDelete
  3. Interesting topic... gross headline.

    I was under the impression Eclipse had a similar setting to IDEA as patrick mentioned.

    That's probably a better alternative as you don't have issues with clashing with other users on the same system. Also, on some systems /tmp is in swap space which would degrade performance far worse than Eclipse's syncing :)

    Certainly worth a FAQ entry though.

    ReplyDelete
  4. Yep. Building in your workspace is generally a "bad thing". Sort of makes you wonder why that's the default way of doing things . . .

    ReplyDelete

Please note that this is not a support forum for Tapestry. Requests for help will be deleted. Please subscribe to the Tapestry user mailing list if you are in need of support, or contact me directly for professional (for pay) support.

Spammers: Don't bother. I delete your comments and it's a waste of time for both of us. 垃圾邮件发送者:不要打扰。我删除您的评论和它的时间对我们双方的浪费