# HG changeset patch # User Ed Swartz # Date 1276016379 18000 # Node ID c5fe7852bd348b84129a26b06446c4c2d50c1599 # Parent 809f579bf32cdb8c2ffbe5ebb45706e13364f0ba Detect SBSv2 error/warning messages which do not start and end on one line (only show first line though) diff -r 809f579bf32c -r c5fe7852bd34 builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/sbsv2.errors.input.txt --- a/builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/sbsv2.errors.input.txt Fri May 28 14:29:31 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/sbsv2.errors.input.txt Tue Jun 08 11:59:39 2010 -0500 @@ -8,6 +8,14 @@ Regression for bug 9091. Don't report info lines with SBSv2 error checker Could not write toolcheck cache: [Errno 2] No such file or directory: u'R:\\\\epoc32\\build\\toolcheck_cache__armv5_udeb.tmp' +tool 'SBS_JAVATC' from config 'none' did not return version 'version \"1\.[5-9]' as required. +Command 'D:/sources/trk/tcf/tcftrk/group/[undefined] -version' returned: +(this line excised to avoid false positive) + +Check your environment and configuration. + + + Executing 'make -r -f "J:/epoc32/build/Cone/makefile.default" -j 4 DESCRAMBLE="C:/Symbian/SITK/sbs/bin/sbs_descramble.exe sbs2631027042"' diff -r 809f579bf32c -r c5fe7852bd34 builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/sbsv2.errors.regression.xml --- a/builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/sbsv2.errors.regression.xml Fri May 28 14:29:31 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder.test/data/errorpatterns/sbsv2.errors.regression.xml Tue Jun 08 11:59:39 2010 -0500 @@ -1,6 +1,8 @@ + + - + \ No newline at end of file diff -r 809f579bf32c -r c5fe7852bd34 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/error/parsers/SBSv2ErrorParser.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/error/parsers/SBSv2ErrorParser.java Fri May 28 14:29:31 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/error/parsers/SBSv2ErrorParser.java Tue Jun 08 11:59:39 2010 -0500 @@ -16,18 +16,11 @@ */ package com.nokia.carbide.cdt.internal.builder.error.parsers; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import org.eclipse.cdt.core.ErrorParserManager; import org.eclipse.cdt.core.IMarkerGenerator; public class SBSv2ErrorParser extends CarbideBaseErrorParser { - private static final Pattern warningPattern = Pattern.compile("(.*)"); //$NON-NLS-1$ - private static final Pattern errorPattern = Pattern.compile("(.*)"); //$NON-NLS-1$ - private static final Pattern infoPattern = Pattern.compile("(.*)"); //$NON-NLS-1$ - public SBSv2ErrorParser() { } @@ -35,51 +28,50 @@ initialise(); - Matcher matcher = infoPattern.matcher(line); - if (matcher.matches()) { + if (line.startsWith("")) return true; // just ignore info messages - } - matcher = warningPattern.matcher(line); - if (matcher.matches()) { + + // full message detected + if (findMessage(errorParserManager, line, "", "", IMarkerGenerator.SEVERITY_ERROR_BUILD)) + return true; + if (findMessage(errorParserManager, line, "", "", IMarkerGenerator.SEVERITY_WARNING)) + return true; + + // some messages are split across multiple lines, so for now, at least show the first line (where , etc. are) + if (findMessage(errorParserManager, line, "", "", IMarkerGenerator.SEVERITY_ERROR_BUILD)) + return true; + if (findMessage(errorParserManager, line, "", "", IMarkerGenerator.SEVERITY_WARNING)) + return true; + + return false; + } + + protected boolean findMessage(ErrorParserManager errorParserManager, String line, + String startStrip, String endStrip, int severity) { + int idx = line.indexOf(startStrip); + int endIdx = line.indexOf(endStrip); + if (idx >= 0 && endIdx >= 0) { // strip the tags - String text = line.substring("".length(), line.length() - "".length()); //$NON-NLS-1$ //$NON-NLS-2$ + int descStart = idx + startStrip.length(); + int descEnd = line.length() - endStrip.length(); + + String text = line.substring(descStart, descEnd); if (setFirstColon(text)) { if (setFileNameAndLineNumber(text)) { setFile(errorParserManager); setDescription(text); - errorParserManager.generateExternalMarker(msgIFile, msgLineNumber, msgDescription, IMarkerGenerator.SEVERITY_WARNING, null, externalFilePath); + errorParserManager.generateExternalMarker(msgIFile, msgLineNumber, msgDescription, severity, null, externalFilePath); return true; } } msgFileName = ""; //$NON-NLS-1$ - msgDescription = matcher.group(1); + msgDescription = text; setFile(errorParserManager); - errorParserManager.generateExternalMarker(msgIFile, msgLineNumber, msgDescription, IMarkerGenerator.SEVERITY_WARNING, null, externalFilePath); + errorParserManager.generateExternalMarker(msgIFile, msgLineNumber, msgDescription, severity, null, externalFilePath); return true; } - - matcher = errorPattern.matcher(line); - if (matcher.matches()) { - // strip the tags - String text = line.substring("".length(), line.length() - "".length()); //$NON-NLS-1$ //$NON-NLS-2$ - if (setFirstColon(text)) { - if (setFileNameAndLineNumber(text)) { - setFile(errorParserManager); - setDescription(text); - errorParserManager.generateExternalMarker(msgIFile, msgLineNumber, msgDescription, IMarkerGenerator.SEVERITY_ERROR_BUILD, null, externalFilePath); - return true; - } - } - msgFileName = ""; //$NON-NLS-1$ - msgDescription = matcher.group(1); - setFile(errorParserManager); - errorParserManager.generateExternalMarker(msgIFile, msgLineNumber, msgDescription, IMarkerGenerator.SEVERITY_ERROR_BUILD, null, externalFilePath); - return true; - } - return false; } - public void setDescription(String line) { // Get the iDescription msgDescription = line.substring(msgFirstColon + 1).trim();