mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 22:22:11 +02:00
bug 71511: Fixed scanner discovery for minGW
Trim line by scanner discovery console parsers
This commit is contained in:
parent
32e726817d
commit
362cd87be0
5 changed files with 113 additions and 64 deletions
|
@ -40,60 +40,62 @@ import org.eclipse.core.runtime.Path;
|
||||||
*/
|
*/
|
||||||
public class ScannerInfoConsoleParserFactory {
|
public class ScannerInfoConsoleParserFactory {
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a ConsoleOutputStreamSniffer, make builder scanner info console parser
|
|
||||||
* and a utility.
|
|
||||||
*/
|
|
||||||
public static ConsoleOutputSniffer getESIProviderOutputSniffer(
|
|
||||||
OutputStream outputStream,
|
|
||||||
OutputStream errorStream,
|
|
||||||
IProject currentProject,
|
|
||||||
String providerId,
|
|
||||||
IScannerConfigBuilderInfo2 scBuildInfo,
|
|
||||||
IScannerInfoCollector collector,
|
|
||||||
IMarkerGenerator markerGenerator) {
|
|
||||||
return getESIProviderOutputSniffer(outputStream, errorStream, currentProject, new InfoContext(currentProject), providerId, scBuildInfo, collector, markerGenerator);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Creates a ConsoleOutputStreamSniffer, make builder scanner info console parser
|
|
||||||
* and a utility.
|
|
||||||
*/
|
|
||||||
public static ConsoleOutputSniffer getESIProviderOutputSniffer(
|
|
||||||
OutputStream outputStream,
|
|
||||||
OutputStream errorStream,
|
|
||||||
IProject currentProject,
|
|
||||||
InfoContext context,
|
|
||||||
String providerId,
|
|
||||||
IScannerConfigBuilderInfo2 scBuildInfo,
|
|
||||||
IScannerInfoCollector collector,
|
|
||||||
IMarkerGenerator markerGenerator) {
|
|
||||||
if (scBuildInfo.isProviderOutputParserEnabled(providerId)) {
|
|
||||||
// get the ESIProvider console parser
|
|
||||||
SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
|
|
||||||
getSCProfileInstance(currentProject, context, scBuildInfo.getSelectedProfileId());
|
|
||||||
IScannerInfoConsoleParser clParser = profileInstance.createExternalScannerInfoParser(providerId);
|
|
||||||
IPath buildDirectory = MakeBuilderUtil.getBuildDirectory(currentProject, MakeBuilder.BUILDER_ID);
|
|
||||||
clParser.startup(currentProject, buildDirectory, collector, markerGenerator);
|
|
||||||
// create an output stream sniffer
|
|
||||||
return new ConsoleOutputSniffer(outputStream, errorStream, new
|
|
||||||
IScannerInfoConsoleParser[] {clParser});
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a ConsoleOutputStreamSniffer, ESI provider scanner info console parser
|
* Creates a ConsoleOutputStreamSniffer, make builder scanner info console parser
|
||||||
* and a utility.
|
* and a utility.
|
||||||
*/
|
*/
|
||||||
public static ConsoleOutputSniffer getMakeBuilderOutputSniffer(
|
public static ConsoleOutputSniffer getESIProviderOutputSniffer(OutputStream outputStream,
|
||||||
OutputStream outputStream,
|
OutputStream errorStream,
|
||||||
OutputStream errorStream,
|
IProject project,
|
||||||
IProject currentProject,
|
String id,
|
||||||
IPath workingDirectory,
|
IScannerConfigBuilderInfo2 info2,
|
||||||
IScannerConfigBuilderInfo2 scBuildInfo,
|
IScannerInfoCollector collector,
|
||||||
IMarkerGenerator markerGenerator,
|
IMarkerGenerator markerGenerator) {
|
||||||
IScannerInfoCollector collector) {
|
|
||||||
return getMakeBuilderOutputSniffer(outputStream, errorStream, currentProject, new InfoContext(currentProject), workingDirectory, scBuildInfo, markerGenerator, collector);
|
return getESIProviderOutputSniffer(outputStream, errorStream, project, new InfoContext(project), id, info2, collector, markerGenerator);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a ConsoleOutputStreamSniffer, make builder scanner info console parser
|
||||||
|
* and a utility.
|
||||||
|
*/
|
||||||
|
public static ConsoleOutputSniffer getESIProviderOutputSniffer(OutputStream outputStream,
|
||||||
|
OutputStream errorStream,
|
||||||
|
IProject project,
|
||||||
|
InfoContext infoContext,
|
||||||
|
String id,
|
||||||
|
IScannerConfigBuilderInfo2 info2,
|
||||||
|
IScannerInfoCollector collector,
|
||||||
|
IMarkerGenerator markerGenerator) {
|
||||||
|
|
||||||
|
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().
|
||||||
|
getSCProfileInstance(project, infoContext, info2.getSelectedProfileId());
|
||||||
|
|
||||||
|
IScannerInfoConsoleParser parser = profileInstance.createExternalScannerInfoParser(id);
|
||||||
|
IPath buildDirectory = MakeBuilderUtil.getBuildDirectory(project, MakeBuilder.BUILDER_ID);
|
||||||
|
|
||||||
|
parser.startup(project, buildDirectory, collector, markerGenerator);
|
||||||
|
return parser;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -101,14 +103,30 @@ public class ScannerInfoConsoleParserFactory {
|
||||||
* and a utility.
|
* and a utility.
|
||||||
*/
|
*/
|
||||||
public static ConsoleOutputSniffer getMakeBuilderOutputSniffer(
|
public static ConsoleOutputSniffer getMakeBuilderOutputSniffer(
|
||||||
OutputStream outputStream,
|
OutputStream outputStream,
|
||||||
OutputStream errorStream,
|
OutputStream errorStream,
|
||||||
IProject project,
|
IProject project,
|
||||||
InfoContext infoContext,
|
IPath workingDirectory,
|
||||||
IPath workingDirectory,
|
IScannerConfigBuilderInfo2 info2,
|
||||||
IScannerConfigBuilderInfo2 info2,
|
IMarkerGenerator markerGenerator,
|
||||||
IMarkerGenerator markerGenerator,
|
IScannerInfoCollector collector) {
|
||||||
IScannerInfoCollector collector) {
|
|
||||||
|
return getMakeBuilderOutputSniffer(outputStream, errorStream, project, new InfoContext(project), workingDirectory, info2, markerGenerator, collector);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a ConsoleOutputStreamSniffer, ESI provider scanner info console parser
|
||||||
|
* and a utility.
|
||||||
|
*/
|
||||||
|
public static ConsoleOutputSniffer getMakeBuilderOutputSniffer(
|
||||||
|
OutputStream outputStream,
|
||||||
|
OutputStream errorStream,
|
||||||
|
IProject project,
|
||||||
|
InfoContext infoContext,
|
||||||
|
IPath workingDirectory,
|
||||||
|
IScannerConfigBuilderInfo2 info2,
|
||||||
|
IMarkerGenerator markerGenerator,
|
||||||
|
IScannerInfoCollector collector) {
|
||||||
|
|
||||||
IScannerInfoConsoleParser parser = getScannerInfoConsoleParserInternal(project, infoContext, workingDirectory, info2, markerGenerator, collector);
|
IScannerInfoConsoleParser parser = getScannerInfoConsoleParserInternal(project, infoContext, workingDirectory, info2, markerGenerator, collector);
|
||||||
if (parser != null) {
|
if (parser != null) {
|
||||||
|
@ -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()) {
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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));
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue