diff options
author | Vladimir Hirsl | 2004-10-19 21:08:25 +0000 |
---|---|---|
committer | Vladimir Hirsl | 2004-10-19 21:08:25 +0000 |
commit | 5fd1105acd1181916529e372cd5a5e8471d303e6 (patch) | |
tree | e91dec989a9da873ba0d7171b9122d6e7647f885 /build | |
parent | 22aaaf84bc5e11ba2816326cd895e815a497c443 (diff) | |
download | org.eclipse.cdt-5fd1105acd1181916529e372cd5a5e8471d303e6.tar.gz org.eclipse.cdt-5fd1105acd1181916529e372cd5a5e8471d303e6.tar.xz org.eclipse.cdt-5fd1105acd1181916529e372cd5a5e8471d303e6.zip |
Changes in the parser and utility interaction.
Ready for the first test.
Diffstat (limited to 'build')
8 files changed, 71 insertions, 49 deletions
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoConsoleParser.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoConsoleParser.java index ba0512f5897..f53099ed7d9 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoConsoleParser.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoConsoleParser.java @@ -19,13 +19,17 @@ import org.eclipse.core.resources.IProject; */ 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, IScannerInfoConsoleParserUtility util, IScannerInfoCollector collector); + public void startup(IProject project, IScannerInfoCollector collector); /** * Parse one line of output. diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoConsoleParserUtility.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoConsoleParserUtility.java index 3426dc3f35b..f9f63ffd34f 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoConsoleParserUtility.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoConsoleParserUtility.java @@ -10,10 +10,9 @@ **********************************************************************/ package org.eclipse.cdt.make.core.scannerconfig; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; +import org.eclipse.cdt.core.IMarkerGenerator; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IPath; /** * Common work required by the scanner info console parsers @@ -21,12 +20,5 @@ import org.eclipse.core.resources.IResource; * @author vhirsl */ public interface IScannerInfoConsoleParserUtility { - // 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); + public void initialize(IProject project, IPath workingDirectory, IMarkerGenerator markerGenerator); } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerInfoConsoleParserFactory.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerInfoConsoleParserFactory.java index 33637507888..0913925a0f1 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerInfoConsoleParserFactory.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerInfoConsoleParserFactory.java @@ -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,9 +51,12 @@ public class ScannerInfoConsoleParserFactory { // get the ESIProvider console parser IScannerInfoConsoleParser clParser = MakeCorePlugin.getDefault(). getScannerInfoConsoleParser(scBuildInfo.getESIProviderConsoleParserId()); - // initialize it with the utility - clParser.startup(currentProject, null /*new ScannerInfoConsoleParserUtility( - currentProject, null, markerGenerator)*/, collector); + // initialize the utility object + IScannerInfoConsoleParserUtility util = clParser.getUtility(); + if (util != null) { + util.initialize(currentProject, currentProject.getLocation(), null); + } + clParser.startup(currentProject, collector); // create an output stream sniffer return new ConsoleOutputStreamSniffer(outputStream, new IScannerInfoConsoleParser[] {clParser}); @@ -93,11 +96,14 @@ public class ScannerInfoConsoleParserFactory { // get the make builder console parser IScannerInfoConsoleParser clParser = MakeCorePlugin.getDefault(). getScannerInfoConsoleParser(scBuildInfo.getMakeBuilderConsoleParserId()); - // initialize it with the utility - clParser.startup(currentProject, new ScannerInfoConsoleParserUtility( - currentProject, workingDirectory, - scBuildInfo.isSIProblemGenerationEnabled() ? markerGenerator : null), - ScannerInfoCollector.getInstance()); + // initialize the utility object + IScannerInfoConsoleParserUtility util = clParser.getUtility(); + if (util != null) { + util.initialize(currentProject, workingDirectory, + scBuildInfo.isSIProblemGenerationEnabled() ? + markerGenerator : null); + } + clParser.startup(currentProject, ScannerInfoCollector.getInstance()); // create an output stream sniffer return new ConsoleOutputStreamSniffer(outputStream, new IScannerInfoConsoleParser[] {clParser}); diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCScannerInfoConsoleParser.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCScannerInfoConsoleParser.java index 6cd1f733449..e290d000101 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCScannerInfoConsoleParser.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCScannerInfoConsoleParser.java @@ -17,6 +17,7 @@ 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; @@ -36,18 +37,24 @@ public class GCCScannerInfoConsoleParser implements IScannerInfoConsoleParser { private final static String DOUBLE_QUOTE_STRING = "\""; //$NON-NLS-1$ private IProject fProject = null; - private IScannerInfoConsoleParserUtility fUtil = null; + private ScannerInfoConsoleParserUtility fUtil = new ScannerInfoConsoleParserUtility(); 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, IScannerInfoConsoleParserUtility util, IScannerInfoCollector collector) { + public void startup(IProject project, IScannerInfoCollector collector) { fProject = project; - fUtil = util; fCollector = collector; } @@ -314,4 +321,5 @@ public class GCCScannerInfoConsoleParser implements IScannerInfoConsoleParser { } return num; } + } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCSpecsConsoleParser.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCSpecsConsoleParser.java index 42cedc64c1e..6035b30ef5a 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCSpecsConsoleParser.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCSpecsConsoleParser.java @@ -42,14 +42,20 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser { private List includes = new ArrayList(); /* (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#getUtility() */ - public void startup(IProject project, IScannerInfoConsoleParserUtility util, IScannerInfoCollector collector) { + 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) { this.fProject = project; - this.fUtil = util; this.fCollector = collector; } - + /* (non-Javadoc) * @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParser#processLine(java.lang.String) */ @@ -109,8 +115,5 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser { * @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParser#shutdown() */ public void shutdown() { - if (fUtil != null) { - fUtil.reportProblems(); - } } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/ScannerInfoConsoleParserUtility.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/ScannerInfoConsoleParserUtility.java index 76cdfe5f97a..b240d1fb882 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/ScannerInfoConsoleParserUtility.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/ScannerInfoConsoleParserUtility.java @@ -52,7 +52,10 @@ public class ScannerInfoConsoleParserUtility implements IScannerInfoConsoleParse private List fNameConflicts; private Vector fDirectoryStack; - public ScannerInfoConsoleParserUtility(IProject project, IPath workingDirectory, IMarkerGenerator markerGenerator) { + /* (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) { fProject = project; fMarkerGenerator = markerGenerator; fBaseDirectory = fProject.getLocation(); @@ -77,9 +80,6 @@ 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()); } - protected IPath getWorkingDirectory() { + public IPath getWorkingDirectory() { if (fDirectoryStack.size() != 0) { return (IPath) fDirectoryStack.lastElement(); } @@ -300,9 +300,6 @@ 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 @@ -319,9 +316,6 @@ 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(); ) { @@ -376,9 +370,6 @@ 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) { diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/TraceUtil.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/TraceUtil.java index 789245d3b0b..7dd8d2215bc 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/TraceUtil.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/TraceUtil.java @@ -12,6 +12,7 @@ package org.eclipse.cdt.make.internal.core.scannerconfig.util; import java.util.Iterator; import java.util.List; +import java.util.Map; /** * Tracebility related utility functions @@ -77,4 +78,21 @@ public class TraceUtil { System.out.println("Error: " + string + line); //$NON-NLS-1$ } } + + /** + * @param string + * @param string2 + * @param string3 + * @param map - map of + */ + public static void metricsTrace(String title, String subtitlePrefix, String subtitlePostfix, Map map) { + System.out.println(); + System.out.println(title); + for (Iterator i = map.keySet().iterator(); i.hasNext(); ) { + String dir = (String) i.next(); + System.out.println(subtitlePrefix + dir + subtitlePostfix); + List directoryCommandList = (List) map.get(dir); + } + } + }
\ No newline at end of file diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/standardbuilder/core/tests/ScannerConfigConsoleParserTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/standardbuilder/core/tests/ScannerConfigConsoleParserTests.java index a07087c8a85..e0163e10304 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/standardbuilder/core/tests/ScannerConfigConsoleParserTests.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/standardbuilder/core/tests/ScannerConfigConsoleParserTests.java @@ -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, null, new IScannerInfoCollector() { + clParser.startup(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, null, new IScannerInfoCollector() { + clParser.startup(null, new IScannerInfoCollector() { public void contributeToScannerConfig(IResource resource, List includes, List symbols, Map extraInfo) { sumSymbols.addAll(symbols); } |