1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

bug 71511: Fixed scanner discovery for minGW

Trim line by scanner discovery console parsers
This commit is contained in:
Andrew Gvozdev 2012-03-22 17:53:03 -04:00
parent 32e726817d
commit 362cd87be0
5 changed files with 113 additions and 64 deletions

View file

@ -44,39 +44,56 @@ public class ScannerInfoConsoleParserFactory {
* Creates a ConsoleOutputStreamSniffer, make builder scanner info console parser * Creates a ConsoleOutputStreamSniffer, make builder scanner info console parser
* and a utility. * and a utility.
*/ */
public static ConsoleOutputSniffer getESIProviderOutputSniffer( public static ConsoleOutputSniffer getESIProviderOutputSniffer(OutputStream outputStream,
OutputStream outputStream,
OutputStream errorStream, OutputStream errorStream,
IProject currentProject, IProject project,
String providerId, String id,
IScannerConfigBuilderInfo2 scBuildInfo, IScannerConfigBuilderInfo2 info2,
IScannerInfoCollector collector, IScannerInfoCollector collector,
IMarkerGenerator markerGenerator) { IMarkerGenerator markerGenerator) {
return getESIProviderOutputSniffer(outputStream, errorStream, currentProject, new InfoContext(currentProject), providerId, scBuildInfo, collector, markerGenerator);
return getESIProviderOutputSniffer(outputStream, errorStream, project, new InfoContext(project), id, info2, collector, markerGenerator);
} }
/** /**
* Creates a ConsoleOutputStreamSniffer, make builder scanner info console parser * Creates a ConsoleOutputStreamSniffer, make builder scanner info console parser
* and a utility. * and a utility.
*/ */
public static ConsoleOutputSniffer getESIProviderOutputSniffer( public static ConsoleOutputSniffer getESIProviderOutputSniffer(OutputStream outputStream,
OutputStream outputStream,
OutputStream errorStream, OutputStream errorStream,
IProject currentProject, IProject project,
InfoContext context, InfoContext infoContext,
String providerId, String id,
IScannerConfigBuilderInfo2 scBuildInfo, IScannerConfigBuilderInfo2 info2,
IScannerInfoCollector collector, IScannerInfoCollector collector,
IMarkerGenerator markerGenerator) { IMarkerGenerator markerGenerator) {
if (scBuildInfo.isProviderOutputParserEnabled(providerId)) {
// get the ESIProvider console parser IScannerInfoConsoleParser parser = getESIConsoleParser(project, infoContext, id, info2, collector, markerGenerator);
if (parser != null) {
return new ConsoleOutputSniffer(outputStream, errorStream, new IScannerInfoConsoleParser[] { parser });
}
return null;
}
/**
/* Get the ESIProvider console parser.
*/
public static IScannerInfoConsoleParser getESIConsoleParser(IProject project,
InfoContext infoContext,
String id,
IScannerConfigBuilderInfo2 info2,
IScannerInfoCollector collector,
IMarkerGenerator markerGenerator) {
if (info2.isProviderOutputParserEnabled(id)) {
SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance(). SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
getSCProfileInstance(currentProject, context, scBuildInfo.getSelectedProfileId()); getSCProfileInstance(project, infoContext, info2.getSelectedProfileId());
IScannerInfoConsoleParser clParser = profileInstance.createExternalScannerInfoParser(providerId);
IPath buildDirectory = MakeBuilderUtil.getBuildDirectory(currentProject, MakeBuilder.BUILDER_ID); IScannerInfoConsoleParser parser = profileInstance.createExternalScannerInfoParser(id);
clParser.startup(currentProject, buildDirectory, collector, markerGenerator); IPath buildDirectory = MakeBuilderUtil.getBuildDirectory(project, MakeBuilder.BUILDER_ID);
// create an output stream sniffer
return new ConsoleOutputSniffer(outputStream, errorStream, new parser.startup(project, buildDirectory, collector, markerGenerator);
IScannerInfoConsoleParser[] {clParser}); return parser;
} }
return null; return null;
} }
@ -88,12 +105,13 @@ public class ScannerInfoConsoleParserFactory {
public static ConsoleOutputSniffer getMakeBuilderOutputSniffer( public static ConsoleOutputSniffer getMakeBuilderOutputSniffer(
OutputStream outputStream, OutputStream outputStream,
OutputStream errorStream, OutputStream errorStream,
IProject currentProject, IProject project,
IPath workingDirectory, IPath workingDirectory,
IScannerConfigBuilderInfo2 scBuildInfo, IScannerConfigBuilderInfo2 info2,
IMarkerGenerator markerGenerator, IMarkerGenerator markerGenerator,
IScannerInfoCollector collector) { IScannerInfoCollector collector) {
return getMakeBuilderOutputSniffer(outputStream, errorStream, currentProject, new InfoContext(currentProject), workingDirectory, scBuildInfo, markerGenerator, collector);
return getMakeBuilderOutputSniffer(outputStream, errorStream, project, new InfoContext(project), workingDirectory, info2, markerGenerator, collector);
} }
/** /**
@ -119,8 +137,12 @@ public class ScannerInfoConsoleParserFactory {
return null; return null;
} }
private static IScannerInfoConsoleParser getScannerInfoConsoleParserInternal(IProject project, InfoContext infoContext, IPath workingDirectory, private static IScannerInfoConsoleParser getScannerInfoConsoleParserInternal(IProject project,
IScannerConfigBuilderInfo2 info2, IMarkerGenerator markerGenerator, IScannerInfoCollector collector) { InfoContext infoContext,
IPath workingDirectory,
IScannerConfigBuilderInfo2 info2,
IMarkerGenerator markerGenerator,
IScannerInfoCollector collector) {
IScannerInfoConsoleParser parser = null; IScannerInfoConsoleParser parser = null;
// try { // try {
@ -166,8 +188,12 @@ public class ScannerInfoConsoleParserFactory {
} }
// TODO - perhaps this be unified with the other one? // TODO - perhaps this be unified with the other one?
public static IScannerInfoConsoleParser getScannerInfoConsoleParser(IProject project, InfoContext infoContext, IPath workingDirectory, public static IScannerInfoConsoleParser getScannerInfoConsoleParser(IProject project,
IScannerConfigBuilderInfo2 info2, IMarkerGenerator markerGenerator, IScannerInfoCollector collector) { InfoContext infoContext,
IPath workingDirectory,
IScannerConfigBuilderInfo2 info2,
IMarkerGenerator markerGenerator,
IScannerInfoCollector collector) {
IScannerInfoConsoleParser parser = null; IScannerInfoConsoleParser parser = null;
if (info2 != null && info2.isAutoDiscoveryEnabled() && info2.isBuildOutputParserEnabled()) { if (info2 != null && info2.isAutoDiscoveryEnabled() && info2.isBuildOutputParserEnabled()) {

View file

@ -94,6 +94,10 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole
*/ */
@Override @Override
public boolean processLine(String line) { public boolean processLine(String line) {
line= line.trim();
if (line.length() == 0) {
return false;
}
boolean rc = false; boolean rc = false;
int lineBreakPos = line.length()-1; int lineBreakPos = line.length()-1;
char[] lineChars = line.toCharArray(); char[] lineChars = line.toCharArray();

View file

@ -15,12 +15,14 @@ import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.List;
import java.util.Properties; import java.util.Properties;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.CommandLauncher; import org.eclipse.cdt.core.CommandLauncher;
import org.eclipse.cdt.core.ErrorParserManager; import org.eclipse.cdt.core.ErrorParserManager;
import org.eclipse.cdt.core.ICommandLauncher; import org.eclipse.cdt.core.ICommandLauncher;
import org.eclipse.cdt.core.IConsoleParser;
import org.eclipse.cdt.core.model.ILanguage; import org.eclipse.cdt.core.model.ILanguage;
import org.eclipse.cdt.core.resources.IConsole; import org.eclipse.cdt.core.resources.IConsole;
import org.eclipse.cdt.internal.core.BuildRunnerHelper; import org.eclipse.cdt.internal.core.BuildRunnerHelper;
@ -33,6 +35,7 @@ import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
import org.eclipse.cdt.make.core.scannerconfig.InfoContext; import org.eclipse.cdt.make.core.scannerconfig.InfoContext;
import org.eclipse.cdt.make.internal.core.MakeMessages; import org.eclipse.cdt.make.internal.core.MakeMessages;
import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigUtil; import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigUtil;
import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerInfoConsoleParserFactory;
import org.eclipse.cdt.utils.EFSExtensionManager; import org.eclipse.cdt.utils.EFSExtensionManager;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
@ -123,8 +126,14 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
ErrorParserManager epm = new ErrorParserManager(project, markerGenerator, new String[] {GMAKE_ERROR_PARSER_ID}); ErrorParserManager epm = new ErrorParserManager(project, markerGenerator, new String[] {GMAKE_ERROR_PARSER_ID});
List<IConsoleParser> parsers = new ArrayList<IConsoleParser>();
IConsoleParser parser = ScannerInfoConsoleParserFactory.getESIConsoleParser(project, context, providerId, buildInfo, collector, markerGenerator);
if (parser != null) {
parsers.add(parser);
}
buildRunnerHelper.setLaunchParameters(launcher, program, comandLineOptions, workingDirectoryURI, envp ); buildRunnerHelper.setLaunchParameters(launcher, program, comandLineOptions, workingDirectoryURI, envp );
buildRunnerHelper.prepareStreams(epm, null, console, new SubProgressMonitor(monitor, 1 * MONITOR_SCALE, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK)); buildRunnerHelper.prepareStreams(epm, parsers, console, new SubProgressMonitor(monitor, 1 * MONITOR_SCALE, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
buildRunnerHelper.greeting(MakeMessages.getFormattedString("ExternalScannerInfoProvider.Greeting", project.getName())); //$NON-NLS-1$ buildRunnerHelper.greeting(MakeMessages.getFormattedString("ExternalScannerInfoProvider.Greeting", project.getName())); //$NON-NLS-1$
buildRunnerHelper.build(new SubProgressMonitor(monitor, 1 * MONITOR_SCALE, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK)); buildRunnerHelper.build(new SubProgressMonitor(monitor, 1 * MONITOR_SCALE, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));

View file

@ -110,6 +110,11 @@ public abstract class AbstractXLCBuildOutputParser implements IScannerInfoConsol
*/ */
@Override @Override
public boolean processLine(String line) { public boolean processLine(String line) {
line= line.trim();
if (line.length() == 0) {
return false;
}
boolean rc = false; boolean rc = false;
int lineBreakPos = line.length() - 1; int lineBreakPos = line.length() - 1;
char[] lineChars = line.toCharArray(); char[] lineChars = line.toCharArray();

View file

@ -97,6 +97,11 @@ public class XlCSpecsConsoleParser implements IScannerInfoConsoleParser {
TraceUtil.outputTrace( TraceUtil.outputTrace(
"XLCSpecsConsoleParser parsing line: [", line, "]"); //$NON-NLS-1$ //$NON-NLS-2$ "XLCSpecsConsoleParser parsing line: [", line, "]"); //$NON-NLS-1$ //$NON-NLS-2$
line= line.trim();
if (line.length() == 0) {
return false;
}
// testing the output line against the pattern of interest // testing the output line against the pattern of interest
Matcher lineMatcher = linePattern.matcher(line); Matcher lineMatcher = linePattern.matcher(line);
if (lineMatcher.matches()) { if (lineMatcher.matches()) {