如何对使用 Ant javac 任务编译的文件进行后处理?

发布于 2024-07-25 07:00:24 字数 621 浏览 4 评论 0原文

我需要在此运行期间编译的文件列表。 我想将此列表提供给后续的后处理步骤。

我找到了一个选项来列出(请参阅listfiles选项)在这个运行,但它似乎只适合在控制台上显示列表。

任何想法?

编辑:我正在谈论增量编译,因此获取构建文件夹的文件集不是一个选项。

编辑:一个想法似乎是自定义记录器 但我仍在寻找更简单的东西

编辑: 另一个想法是使用 在 javac 之前使用 FileSet 选择器 并以某种方式将列表保留在内存中,以便在 javac 执行后使用

I need the list of files that were compiled during this run. I want to feed this list to a subsequent post-processing step.

I have found an option to list (see listfiles option) the files compiled during this run, but it seems only good for displaying the list on console.

Any idea?

Edit: I am talking about incremental compiles, so taking a fileset of the build folder is not an option.

Edit: One idea seems to be custom logger but I am still looking for something simpler

Edit: Another idea is to use depend selector with FileSet before javac and somehow keep the list in memory, to be used after javac has executed

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

药祭#氼 2024-08-01 07:00:24

您只需在 javac 的目标目录中形成有关所有类文件的文件集。

编辑:澄清后我必须调整我的答案。 我还没有这样的事情,但我会尝试使用 选择器 。 修改的选择器看起来像您想要的那样 - 目录中所有类文件的文件集,自上次运行以来已更改。 这是一个代码片段:

<fileset dir="${build}">
   <filename name="**/*.class"/>
   <modified/>
</fileset>

它不会直接对 javac-task 的输出进行后处理,但应该可以解决您的问题。

You simply can form a fileset about all class-files in the target-directory of the javac.

Edit: After the clarification I have to adjust my answer. I didn't such thing yet, but I would try my luck with selectors. The modified-selector looks like the one you want - a fileset of all class-files in a directory, that have changed since the last run. Here is a code-snippet:

<fileset dir="${build}">
   <filename name="**/*.class"/>
   <modified/>
</fileset>

It does not directly post-process the output of the javac-task, but should solve your problem.

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