xcodebuild 仅打印错误

xcodebuild print errors only

我在 SO How to filter the xcodebuild command line output?

中看到了这个命令

当我们执行 xcodebuild 时,它仅显示错误和警告,否则 xcodebuild 命令会将有关其正在执行的操作的所有内容打印到控制台。

有没有办法在 ant 任务中使用 grep 和 xcodebuild?

 <exec executable="xcodebuild" failonerror="true">
                <arg value="| grep error" />
                <arg value="clean" />
                <arg value="build" />
  </exec> 

上面的 exec 任务在尝试执行 ant 任务时抛出错误。

This 问题可能会有帮助。我还假设您需要先调用操作,然后再调用 grep。也许这会奏效:

<exec dir="${projectPath}/" executable="bash" failonerror="true">
   <arg value="-c"/>
   <arg value="xcodebuild clean build | grep error"/>
</exec>

-quiet 不打印除警告和错误之外的任何输出

xcodebuild clean build -quiet

有效。