mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Reverting back to previous version. Not ready to commit yet.
This commit is contained in:
parent
5fd1105acd
commit
45c33ef2aa
7 changed files with 49 additions and 53 deletions
|
@ -18,18 +18,14 @@ import org.eclipse.core.resources.IProject;
|
|||
* @author vhirsl
|
||||
*/
|
||||
public interface IScannerInfoConsoleParser {
|
||||
/**
|
||||
* Get a utility object to be initialized
|
||||
*/
|
||||
public IScannerInfoConsoleParserUtility getUtility();
|
||||
|
||||
/**
|
||||
* Optional one time initialization of a console parser.
|
||||
*
|
||||
* @param project
|
||||
* @param util - utility functions for file and path management
|
||||
* @param collector - scanner info collector
|
||||
*/
|
||||
public void startup(IProject project, IScannerInfoCollector collector);
|
||||
public void startup(IProject project, IScannerInfoConsoleParserUtility util, IScannerInfoCollector collector);
|
||||
|
||||
/**
|
||||
* Parse one line of output.
|
||||
|
|
|
@ -10,9 +10,10 @@
|
|||
**********************************************************************/
|
||||
package org.eclipse.cdt.make.core.scannerconfig;
|
||||
|
||||
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
||||
/**
|
||||
* Common work required by the scanner info console parsers
|
||||
|
@ -20,5 +21,12 @@ import org.eclipse.core.runtime.IPath;
|
|||
* @author vhirsl
|
||||
*/
|
||||
public interface IScannerInfoConsoleParserUtility {
|
||||
public void initialize(IProject project, IPath workingDirectory, IMarkerGenerator markerGenerator);
|
||||
// Problem marker related
|
||||
public void generateMarker(IResource file, int lineNumber, String desc, int severity, String varName);
|
||||
public boolean reportProblems();
|
||||
// File path management
|
||||
public void changeMakeDirectory(String dir, int dirLevel, boolean enterDir);
|
||||
public IFile findFile(String fileName);
|
||||
public List translateRelativePaths(IFile file, String fileName, List includes);
|
||||
public String normalizePath(String path);
|
||||
}
|
||||
|
|
|
@ -17,9 +17,9 @@ import org.eclipse.cdt.make.core.MakeCorePlugin;
|
|||
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParserUtility;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigBuilder;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigNature;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.util.ScannerInfoConsoleParserUtility;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
@ -51,12 +51,9 @@ public class ScannerInfoConsoleParserFactory {
|
|||
// get the ESIProvider console parser
|
||||
IScannerInfoConsoleParser clParser = MakeCorePlugin.getDefault().
|
||||
getScannerInfoConsoleParser(scBuildInfo.getESIProviderConsoleParserId());
|
||||
// initialize the utility object
|
||||
IScannerInfoConsoleParserUtility util = clParser.getUtility();
|
||||
if (util != null) {
|
||||
util.initialize(currentProject, currentProject.getLocation(), null);
|
||||
}
|
||||
clParser.startup(currentProject, collector);
|
||||
// initialize it with the utility
|
||||
clParser.startup(currentProject, null /*new ScannerInfoConsoleParserUtility(
|
||||
currentProject, null, markerGenerator)*/, collector);
|
||||
// create an output stream sniffer
|
||||
return new ConsoleOutputStreamSniffer(outputStream, new
|
||||
IScannerInfoConsoleParser[] {clParser});
|
||||
|
@ -96,14 +93,11 @@ public class ScannerInfoConsoleParserFactory {
|
|||
// get the make builder console parser
|
||||
IScannerInfoConsoleParser clParser = MakeCorePlugin.getDefault().
|
||||
getScannerInfoConsoleParser(scBuildInfo.getMakeBuilderConsoleParserId());
|
||||
// initialize the utility object
|
||||
IScannerInfoConsoleParserUtility util = clParser.getUtility();
|
||||
if (util != null) {
|
||||
util.initialize(currentProject, workingDirectory,
|
||||
scBuildInfo.isSIProblemGenerationEnabled() ?
|
||||
markerGenerator : null);
|
||||
}
|
||||
clParser.startup(currentProject, ScannerInfoCollector.getInstance());
|
||||
// initialize it with the utility
|
||||
clParser.startup(currentProject, new ScannerInfoConsoleParserUtility(
|
||||
currentProject, workingDirectory,
|
||||
scBuildInfo.isSIProblemGenerationEnabled() ? markerGenerator : null),
|
||||
ScannerInfoCollector.getInstance());
|
||||
// create an output stream sniffer
|
||||
return new ConsoleOutputStreamSniffer(outputStream, new
|
||||
IScannerInfoConsoleParser[] {clParser});
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
|
|||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParserUtility;
|
||||
import org.eclipse.cdt.make.internal.core.MakeMessages;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.util.ScannerInfoConsoleParserUtility;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -37,24 +36,18 @@ public class GCCScannerInfoConsoleParser implements IScannerInfoConsoleParser {
|
|||
private final static String DOUBLE_QUOTE_STRING = "\""; //$NON-NLS-1$
|
||||
|
||||
private IProject fProject = null;
|
||||
private ScannerInfoConsoleParserUtility fUtil = new ScannerInfoConsoleParserUtility();
|
||||
private IScannerInfoConsoleParserUtility fUtil = null;
|
||||
private IScannerInfoCollector fCollector = null;
|
||||
|
||||
private boolean bMultiline = false;
|
||||
private String sMultiline = ""; //$NON-NLS-1$
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#getUtility()
|
||||
*/
|
||||
public IScannerInfoConsoleParserUtility getUtility() {
|
||||
return fUtil;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject, org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParserUtility, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector)
|
||||
*/
|
||||
public void startup(IProject project, IScannerInfoCollector collector) {
|
||||
public void startup(IProject project, IScannerInfoConsoleParserUtility util, IScannerInfoCollector collector) {
|
||||
fProject = project;
|
||||
fUtil = util;
|
||||
fCollector = collector;
|
||||
}
|
||||
|
||||
|
@ -321,5 +314,4 @@ public class GCCScannerInfoConsoleParser implements IScannerInfoConsoleParser {
|
|||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,20 +42,14 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
|||
private List includes = new ArrayList();
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#getUtility()
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject, org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParserUtility, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector)
|
||||
*/
|
||||
public IScannerInfoConsoleParserUtility getUtility() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector)
|
||||
*/
|
||||
public void startup(IProject project, IScannerInfoCollector collector) {
|
||||
public void startup(IProject project, IScannerInfoConsoleParserUtility util, IScannerInfoCollector collector) {
|
||||
this.fProject = project;
|
||||
this.fUtil = util;
|
||||
this.fCollector = collector;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParser#processLine(java.lang.String)
|
||||
*/
|
||||
|
@ -115,5 +109,8 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
|||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParser#shutdown()
|
||||
*/
|
||||
public void shutdown() {
|
||||
if (fUtil != null) {
|
||||
fUtil.reportProblems();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,10 +52,7 @@ public class ScannerInfoConsoleParserUtility implements IScannerInfoConsoleParse
|
|||
private List fNameConflicts;
|
||||
private Vector fDirectoryStack;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParserUtility#initialize(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IPath, org.eclipse.cdt.core.IMarkerGenerator)
|
||||
*/
|
||||
public void initialize(IProject project, IPath workingDirectory, IMarkerGenerator markerGenerator) {
|
||||
public ScannerInfoConsoleParserUtility(IProject project, IPath workingDirectory, IMarkerGenerator markerGenerator) {
|
||||
fProject = project;
|
||||
fMarkerGenerator = markerGenerator;
|
||||
fBaseDirectory = fProject.getLocation();
|
||||
|
@ -80,6 +77,9 @@ public class ScannerInfoConsoleParserUtility implements IScannerInfoConsoleParse
|
|||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParserUtility#reportProblems()
|
||||
*/
|
||||
public boolean reportProblems() {
|
||||
boolean reset = false;
|
||||
for (Iterator iter = fErrors.iterator(); iter.hasNext(); ) {
|
||||
|
@ -251,7 +251,7 @@ public class ScannerInfoConsoleParserUtility implements IScannerInfoConsoleParse
|
|||
return fNameConflicts.contains(path.lastSegment());
|
||||
}
|
||||
|
||||
public IPath getWorkingDirectory() {
|
||||
protected IPath getWorkingDirectory() {
|
||||
if (fDirectoryStack.size() != 0) {
|
||||
return (IPath) fDirectoryStack.lastElement();
|
||||
}
|
||||
|
@ -300,6 +300,9 @@ public class ScannerInfoConsoleParserUtility implements IScannerInfoConsoleParse
|
|||
return fDirectoryStack.size();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParserUtility#changeMakeDirectory(java.lang.String, int, boolean)
|
||||
*/
|
||||
public void changeMakeDirectory(String dir, int dirLevel, boolean enterDir) {
|
||||
if (enterDir) {
|
||||
/* Sometimes make screws up the output, so
|
||||
|
@ -316,6 +319,9 @@ public class ScannerInfoConsoleParserUtility implements IScannerInfoConsoleParse
|
|||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParserUtility#translateRelativePaths(org.eclipse.core.resources.IFile, java.lang.String, java.util.List)
|
||||
*/
|
||||
public List translateRelativePaths(IFile file, String fileName, List includes) {
|
||||
List translatedIncludes = new ArrayList(includes.size());
|
||||
for (Iterator i = includes.iterator(); i.hasNext(); ) {
|
||||
|
@ -370,6 +376,9 @@ public class ScannerInfoConsoleParserUtility implements IScannerInfoConsoleParse
|
|||
return translatedIncludes;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParserUtility#normalizePath(java.lang.String)
|
||||
*/
|
||||
public String normalizePath(String path) {
|
||||
int column = path.indexOf(':');
|
||||
if (column > 0) {
|
||||
|
|
|
@ -71,7 +71,7 @@ public class ScannerConfigConsoleParserTests extends TestCase {
|
|||
public void testParsingIncludePaths() {
|
||||
final ArrayList sumIncludes = new ArrayList();
|
||||
// initialize it with the utility
|
||||
clParser.startup(null, new IScannerInfoCollector() {
|
||||
clParser.startup(null, null, new IScannerInfoCollector() {
|
||||
public void contributeToScannerConfig(IResource resource, List includes, List symbols, Map extraInfo) {
|
||||
sumIncludes.addAll(includes);
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ public class ScannerConfigConsoleParserTests extends TestCase {
|
|||
public void testParsingSymbolDefinitions() {
|
||||
final ArrayList sumSymbols = new ArrayList();
|
||||
// initialize it with the utility
|
||||
clParser.startup(null, new IScannerInfoCollector() {
|
||||
clParser.startup(null, null, new IScannerInfoCollector() {
|
||||
public void contributeToScannerConfig(IResource resource, List includes, List symbols, Map extraInfo) {
|
||||
sumSymbols.addAll(symbols);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue