void generateReport() { TraceUtil.metricsTrace( "Stats for directory ", //$NON-NLS-1$ "Generic command: '", "' applicable for:", //$NON-NLS-1$ //$NON-NLS-2$ directoryCommandListMap); TraceUtil.summaryTrace("Discovery summary", workingDirsN, commandsN, filesN); // $NON-NLS-1$ }
/* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#processLine(java.lang.String) */ @Override public boolean processLine(String line) { boolean rc = false; int lineBreakPos = line.length() - 1; char[] lineChars = line.toCharArray(); while (lineBreakPos >= 0 && Character.isWhitespace(lineChars[lineBreakPos])) { lineBreakPos--; } if (lineBreakPos >= 0) { if (lineChars[lineBreakPos] != '\\' || (lineBreakPos > 0 && lineChars[lineBreakPos - 1] == '\\')) { lineBreakPos = -1; } } // check for multiline commands (ends with '\') if (lineBreakPos >= 0) { sMultiline += line.substring(0, lineBreakPos); bMultiline = true; return rc; } if (bMultiline) { line = sMultiline + line; bMultiline = false; sMultiline = ""; // $NON-NLS-1$ } line = line.trim(); TraceUtil.outputTrace( "AbstractGCCBOPConsoleParser parsing line: [", line, "]"); // $NON-NLS-1$ //$NON-NLS-2$ // make\[[0-9]*\]: error_desc int firstColon = line.indexOf(':'); String make = line.substring(0, firstColon + 1); if (firstColon != -1 && make.indexOf("make") != -1) { // $NON-NLS-1$ boolean enter = false; String msg = line.substring(firstColon + 1).trim(); if ((enter = msg.startsWith( MakeMessages.getString("AbstractGCCBOPConsoleParser_EnteringDirectory"))) || //$NON-NLS-1$ (msg.startsWith( MakeMessages.getString( "AbstractGCCBOPConsoleParser_LeavingDirectory")))) { //$NON-NLS-1$ int s = msg.indexOf('`'); int e = msg.indexOf('\''); if (s != -1 && e != -1) { String dir = msg.substring(s + 1, e); if (getUtility() != null) { getUtility().changeMakeDirectory(dir, getDirectoryLevel(line), enter); } return rc; } } } // call sublclass to process a single line return processSingleLine(line.trim()); }
/** * Called by the console line parsers to find a file with a given name. * * @param fileName * @return IFile or null */ public IFile findFile(String fileName) { IFile file = findFilePath(fileName); if (file == null) { // Try the project's map. file = findFileName(fileName); if (file != null) { // If there is a conflict then try all files in the project. if (isConflictingName(fileName)) { file = null; // Create a problem marker final String error = MakeMessages.getString( "ConsoleParser.Ambiguous_Filepath_Error_Message"); //$NON-NLS-1$ TraceUtil.outputError(error, fileName); generateMarker( getProject(), -1, error + fileName, IMarkerGenerator.SEVERITY_WARNING, null); } } } return file; }
public List translateRelativePaths(IFile file, String fileName, List includes) { List translatedIncludes = new ArrayList(includes.size()); for (Iterator i = includes.iterator(); i.hasNext(); ) { String include = (String) i.next(); IPath includePath = new Path(include); if (!includePath.isAbsolute() && !includePath.isUNC()) { // do not translate UNC paths // First try the current working directory IPath cwd = getWorkingDirectory(); if (!cwd.isAbsolute()) { cwd = getBaseDirectory().append(cwd); } IPath filePath = new Path(fileName); if (!filePath.isAbsolute()) { // check if the cwd is the right one // appending fileName to cwd should yield file path filePath = cwd.append(fileName); } if (!filePath.toString().equalsIgnoreCase(file.getLocation().toString())) { // must be the cwd is wrong // check if file name starts with ".." if (fileName.startsWith("..")) { // $NON-NLS-1$ // probably multiple choices for cwd, hopeless final String error = MakeMessages.getString( "ConsoleParser.Working_Directory_Error_Message"); //$NON-NLS-1$ TraceUtil.outputError(error, fileName); generateMarker(file, -1, error, IMarkerGenerator.SEVERITY_WARNING, fileName); break; } else { // remove common segments at the end IPath tPath = new Path(fileName); if (fileName.startsWith(".")) { // $NON-NLS-1$ tPath = tPath.removeFirstSegments(1); } // get the file path from the file filePath = file.getLocation(); IPath lastFileSegment = filePath.removeFirstSegments(filePath.segmentCount() - tPath.segmentCount()); if (lastFileSegment.matchingFirstSegments(tPath) == tPath.segmentCount()) { cwd = filePath.removeLastSegments(tPath.segmentCount()); } } } IPath candidatePath = cwd.append(includePath); File dir = candidatePath.toFile(); include = candidatePath.toString(); if (!dir.exists()) { final String error = MakeMessages.getString( "ConsoleParser.Nonexistent_Include_Path_Error_Message"); //$NON-NLS-1$ TraceUtil.outputError(error, include); // generateMarker(file, -1, error+include, IMarkerGenerator.SEVERITY_WARNING, // fileName); } } // TODO VMIR for now add unresolved paths as well translatedIncludes.add(include); } return translatedIncludes; }