Send Errors to stderr - Script Builder in Visual Studio WinXP to build Solutions Files

To display an Error Summary for erroneous builds in bamboo build summary is not available for the Script Builder - going through the build logs seems tedious.
There is a section named "Error summary" which collects all errors during the build process that are printed to stderr. For example a build script


#!/bin/bash
echo "ERROR build xyz failed" >&2

would print this message into the build summary section. It is up to you to insert the appropriate messages into your build script.

問題

The actual problem is devenv.com/msbuild
not being very helpful: both build tools only append to stdout stream,
even in the case of warnings/errors during the build.

ソリューション

I solved the issue by writing a simple Ruby script that invokes the build tool and filters the stdout stream for any
warnings and errors via regexp; the matching warning/error lines are
then echoed to stderr and Bamboo picks them up nicely.

build script.ry

pipe = IO.popen("devenv.com #{$*[0]} /Rebuild ")
errors = 0
warnings = 0
while line = pipe.gets
if line =~ /^.* : .* error .*$/
$stderr.puts line
errors += 1
elsif line =~ /^.* : warning .*$/
$stderr.puts line
warnings += 1
else
$stdout.puts line
end
end
exit errors > 0 ? 1 : 0

Related Pages

Knowledge Base - (BSP-1381) Script Builder Display build errors in Error Summary

最終更新日 2021 年 8 月 10 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.