In an effort to remove the dependency on Ant, the Java-based build tool we have been using to build, test, and produce distribution packages of MODX Revolution, I spent the last week learning Phing, refactoring the xPDO and MODX Revolution build processes to use it, and writing a custom Phing Task to handle our YUICompressor requirements.

No more Ant required to build MODX Revolution (or xPDO)

I’ve been wanting to make the jump to Phing with both xPDO and MODX for a while and finally got around to it. It wasn’t all that difficult, though there were some painful differences in the way Ant and Phing interpret include and exclude patterns in FileSet Types. Regardless, the pain is over, and the develop branches of both the revolution and xpdo repositories have the changes if you want to play around.

If you’ve never used Phing before, I encourage you to install it using PEAR. But you can also install it standalone if you have moral reservations with using PEAR. Once you get that installed and you have pulled the latest changes from the develop branch of revolution, you will be able to minify and concat the js and css files in Revolution, generate the core transport, generate the phpdocs, build distribution packages (traditional, advanced, and sdk) with date stamps as suffixes (for nightly builds, coming soon) from any ref in the repo, and more. Look for automated unit testing and other features coming soon.

Until then, here are some sample commands to build some packages. Note that all of the examples below assume you are in the _build directory of your git clone.

  • To build your local working copy:

    user@host:/path/to/revo/_build$ phing
    
  • To build a nightly set of distrib packages from the develop branch with a timestamp suffix:

    user@host:/path/to/revo/_build$ phing -Dbuild.distrib=true -Dbuild.src.tree=develop
    
  • To build a set of distrib packages from your current HEAD with a timestamp suffix:

    user@host:/path/to/revo/_build$ phing -Dbuild.distrib=true -Dbuild.src.tree=HEAD
    
  • To build a set of distrib packages from a release tag without a timestamp suffix:

    user@host:/path/to/revo/_build$ phing -Dbuild.distrib=true -Dbuild.src.tree=v2.0.4-pl -Dbuild.timestamp=false