JasonDavis
JasonDavis

Reputation: 48973

Can you use an ANT build file as a Phing build file?

I just started playing around with Phing build scripts (built with PHP). From what I have read is that Phing is based on Apache Ant (built with Java).

Both use XML build files and have similar syntax, so I am asking someone with experience, if I find an Ant build file on Github or elsewhere, can it be used in a Phing script without changing the syntax of it any? Like a drop-in XML file that would work with Ant or Phing? Or are there differences?

Upvotes: 5

Views: 988

Answers (2)

JoDev
JoDev

Reputation: 6873

I were recently facing the same issue and I found some diff :

  • antcall would be phingcall
  • <if> tag only appear to be working on PHING (or with Ant-contribs library added)
  • <fixcrlf> tag only appear to be working on ANT

Maybe there are some others.

SOLUTION

The best solution for me was to rewrite missing tasks using adhocTask. And if it is possible, based on an existing PhingTask.

For example to make <antcall> to work, I simply extends PhingCallTask like this :

<adhoc-task name="antcall"><![CDATA[
  class AntCall extends PhingCallTask {}
]]></adhoc-task>

Upvotes: 0

Kelly Milligan
Kelly Milligan

Reputation: 588

There are some slight differences. I would recommend taking the ant build file, and for each target, look up the target name in the phing documentation to make sure it's the same or not. I can't remember off the top of my head, but you can't just drop it in. There are also some phing only things you can do that are php related, like a phpdoc target, etc.

Upvotes: 6

Related Questions