Thoughts and Notes Ideas that stay with me long enough to get written down

23Oct/090

Filterchains – just another reason to love ant

One of the projects I'm working on is conditional publishing of DITA content using ant. Basically what I want to do is, given a list of files, build the output that is affected when those files change. We manage our files using Perforce, so the workflow is something like this:

  1. Check out files
  2. Edit/modify content
  3. Run conditional build
  4. Review output
  5. Check-in files

When you check files out of Perforce, they get put into a changelist, so, to get my file list, I need to ask Perforce what files are in the changelist. Perforce has a nice way to do that. The command is,

p4 opened -c

The problem is the output includes a bunch of information I don't want.  I get lines like this:

//doc/main/core/build/build.xml#164 - edit change 1075456 (text) by sanderson@docbuild

what I want is

//doc/main/core/build/build.xml

or, even better,

files-in-changelist=/home/sanderson/doc/main/core/build/build.xml

That format is the format ant expects for a property files. Property files are nice, because you can load them up and use that property in ant.

What to do, what to do? In my case, I turn to ant. If I have a build issue, someone else has probably run into it, so, I look there first.

Sure enough, ant has a task called filterchain for exactly these kinds of uses. Here's what I wound up with:



  
      
          
          
          
      
      
          
             
             
             

          
      

Just another reason to love ant.

Tagged as: , No Comments