您可以使用 ANT 构建文件作为 Phing 构建文件吗?
我刚刚开始使用 Phing 构建脚本(使用 PHP 构建)。据我所知,Phing 基于 Apache Ant (用 Java 构建)。
两者都使用 XML 构建文件并且具有相似的语法,所以我问有经验的人,如果我在 Github 或其他地方找到 Ant 构建文件,是否可以在不改变其语法的情况下在 Phing 脚本中使用它?就像可以与 Ant 或 Phing 一起使用的嵌入式 XML 文件吗?还是有差异?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有一些细微的差别。我建议使用 ant 构建文件,对于每个目标,在 phing 文档中查找目标名称,以确保它是否相同。我一时记不起,但你不能直接把它放进去。还有一些你可以做的与 php 相关的 phing only 事情,比如 phpdoc 目标等。
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.
我最近遇到了同样的问题,我发现了一些差异:
antcall
将是phingcall
标签似乎仅适用于 PHING (或添加 Ant-contribs 库)
标签似乎仅适用于 ANT也许还有其他一些标签。
解决方案
对我来说最好的解决方案是使用 adhocTask。如果可能的话,基于现有的 PhingTask。
例如,为了使
正常工作,我只需扩展PhingCallTask
即可,如下所示:I were recently facing the same issue and I found some diff :
antcall
would bephingcall
<if>
tag only appear to be working on PHING (or with Ant-contribs library added)<fixcrlf>
tag only appear to be working on ANTMaybe 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 extendsPhingCallTask
like this :