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