build: fail build (ditasite task) on invalid link
@@ -21,10 +21,16 @@ task ditasite() {
doLast {
ByteArrayOutputStream stdOut = new ByteArrayOutputStream()
+ ByteArrayOutputStream stdError = new ByteArrayOutputStream()
exec {
commandLine 'dita', '-v', '--input=detect.ditamap', '--format=sig-webhelp', '-o', '../ditasite'
workingDir "docs/generated"
standardOutput = stdOut
+ errorOutput = stdError
+ }
+ for (String outputLine: stdError.toString().split('\n')) {
+ if (outputLine.matches(".*File.*file:.*not found.*"))
+ throw new Exception("dita error: invalid link: " + outputLine)
}
for (String outputLine: stdOut.toString().split('\n')) {
if (outputLine.matches(".*\\[DOT.*\\].*\\[ERROR\\].*"))
