Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ant构建目标列出自己的构建目标_Ant - Fatal编程技术网

Ant构建目标列出自己的构建目标

Ant构建目标列出自己的构建目标,ant,Ant,我对蚂蚁是全新的。我希望有以下资料: <target name="targets" description "Lists Targets"> [some Ant code/tasks] </target 和输出 [echo] all - Complete Build - Depends on: doc, sca, compile, test [echo] doc - Builds documentation [echo] compile - Compiles files

我对蚂蚁是全新的。我希望有以下资料:

<target name="targets" description "Lists Targets">
  [some Ant code/tasks]
</target
和输出

[echo] all - Complete Build - Depends on: doc, sca, compile, test
[echo] doc - Builds documentation
[echo] compile - Compiles files
[echo] sca - Performs static code analysis
[echo] test - Runs unit tests - Depends on: compile
[echo] clean - Cleans a build
[echo] install - Performs an installation
[echo] targets - Lists Targets
Bash
Make
中,我只需要执行
grep
正则表达式。以下在
Make
中列出了Make目标:

noop: ;
targets:
    @$(MAKE) --print-data-base --question noop | \
     grep -v "[A-Z]:/" | \
     awk '/^[Mm]akefile:/           { next } \
         /^targets:/            { next } \
         /^noop:/           { next } \
         /^[^.%!][-A-Za-z0-9_]*:/   { print substr($$1, 1, length($$1)-1) }' | \
     sort | \
     pr --omit-pagination --width=80 --columns=4
输出:

[matt@office burning-boots-website]$ make -C ~/workspace/packages/ targets
all         diagnose        install         vca_core
clean           doc         platforms       vca_counting_line
compile         help        utils           vca_rules

在我的Ant构建脚本中有一些类似的东西会很好!如果Ant可以像
pr
那样进行很好的对齐,甚至可以为输出着色,那就更棒了!Ant可以跨平台更改终端颜色吗?

您可以使用
Ant-p
(或
Ant-p-v
获取更多信息)。这不会列出目标依赖项,但我不认为这是一个问题:依赖项对最终用户并不重要(它们只是告诉目标如何工作)。重要的是目标所做的事情,这应该是它的描述。

如果ant-p不够,这个命令行选项将列出所有目标?完美的可能复制品。我假设Ant有一种打印目标的方法,但仍然在处理文档。
[matt@office burning-boots-website]$ make -C ~/workspace/packages/ targets
all         diagnose        install         vca_core
clean           doc         platforms       vca_counting_line
compile         help        utils           vca_rules