您可以使用 ANT 构建文件作为 Phing 构建文件吗?

发布于 2024-12-18 19:25:25 字数 342 浏览 4 评论 0原文

我刚刚开始使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

樱花坊 2024-12-25 19:25:25

有一些细微的差别。我建议使用 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.

玩套路吗 2024-12-25 19:25:25

我最近遇到了同样的问题,我发现了一些差异:

  • antcall 将是 phingcall
  • 标签似乎仅适用于 PHING (或添加 Ant-contribs 库
  • 标签似乎仅适用于 ANT

也许还有其他一些标签。

解决方案

对我来说最好的解决方案是使用 adhocTask。如果可能的话,基于现有的 PhingTask。

例如,为了使 正常工作,我只需扩展 PhingCallTask​​ 即可,如下所示:

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

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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文