1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fix for a problem where SC was not being discovered for Managed projects.

This commit is contained in:
Vladimir Hirsl 2005-01-26 20:44:23 +00:00
parent fa5ac845bb
commit c5183b1756
5 changed files with 39 additions and 22 deletions

View file

@ -50,13 +50,13 @@ public class ScannerInfoConsoleParserFactory {
IProject currentProject, IProject currentProject,
String providerId, String providerId,
IScannerConfigBuilderInfo2 scBuildInfo, IScannerConfigBuilderInfo2 scBuildInfo,
IScannerInfoCollector collector,
IMarkerGenerator markerGenerator) { IMarkerGenerator markerGenerator) {
if (scBuildInfo.isProviderOutputParserEnabled(providerId)) { if (scBuildInfo.isProviderOutputParserEnabled(providerId)) {
// get the ESIProvider console parser // get the ESIProvider console parser
SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance(). SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
getSCProfileInstance(currentProject, scBuildInfo.getSelectedProfileId()); getSCProfileInstance(currentProject, scBuildInfo.getSelectedProfileId());
IScannerInfoConsoleParser clParser = profileInstance.createExternalScannerInfoParser(providerId); IScannerInfoConsoleParser clParser = profileInstance.createExternalScannerInfoParser(providerId);
IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
clParser.startup(currentProject, currentProject.getLocation(), collector, markerGenerator); clParser.startup(currentProject, currentProject.getLocation(), collector, markerGenerator);
// create an output stream sniffer // create an output stream sniffer
return new ConsoleOutputSniffer(outputStream, errorStream, new return new ConsoleOutputSniffer(outputStream, errorStream, new

View file

@ -108,7 +108,7 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
cos = new StreamMonitor(new SubProgressMonitor(monitor, 70), cos, 100); cos = new StreamMonitor(new SubProgressMonitor(monitor, 70), cos, 100);
ConsoleOutputSniffer sniffer = ScannerInfoConsoleParserFactory.getESIProviderOutputSniffer( ConsoleOutputSniffer sniffer = ScannerInfoConsoleParserFactory.getESIProviderOutputSniffer(
cos, cos, currentProject, providerId, buildInfo, markerGenerator); cos, cos, currentProject, providerId, buildInfo, collector, markerGenerator);
OutputStream consoleOut = (sniffer == null ? cos : sniffer.getOutputStream()); OutputStream consoleOut = (sniffer == null ? cos : sniffer.getOutputStream());
OutputStream consoleErr = (sniffer == null ? cos : sniffer.getErrorStream()); OutputStream consoleErr = (sniffer == null ? cos : sniffer.getErrorStream());
TraceUtil.outputTrace("Default provider is executing command:", fCompileCommand.toString() + ca, ""); //$NON-NLS-1$ //$NON-NLS-2$ TraceUtil.outputTrace("Default provider is executing command:", fCompileCommand.toString() + ca, ""); //$NON-NLS-1$ //$NON-NLS-2$

View file

@ -10,12 +10,16 @@
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.make.internal.core.scannerconfig2; package org.eclipse.cdt.make.internal.core.scannerconfig2;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.scannerconfig.IExternalScannerInfoProvider; import org.eclipse.cdt.make.core.scannerconfig.IExternalScannerInfoProvider;
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector; import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2;
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser; import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser;
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfile.Action; import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfile.Action;
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfile.BuildOutputProvider; import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfile.BuildOutputProvider;
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfile.ScannerInfoCollector;
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfile.ScannerInfoConsoleParser; import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfile.ScannerInfoConsoleParser;
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfile.ScannerInfoProvider; import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfile.ScannerInfoProvider;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
@ -35,16 +39,27 @@ public class SCProfileInstance {
public SCProfileInstance(IProject project, ScannerConfigProfile profile) { public SCProfileInstance(IProject project, ScannerConfigProfile profile) {
this.project = project; this.project = project;
this.profile = profile; this.profile = profile;
instantiate();
} }
/** /**
* *
*/ */
private void instantiate() { private void instantiateCollector() {
// create collector object // create collector object
collector = (IScannerInfoCollector) profile.getScannerInfoCollectorElement().createScannerInfoCollector(); collector = createScannerInfoCollector();
if (collector instanceof IScannerInfoCollector2) { if (collector != null) {
((IScannerInfoCollector2) collector).setProject(project); // call collector.setProject(project) if class supports it
Class clazz = (Class) collector.getClass();
try {
Method setProjectMethod = clazz.getMethod("setProject", new Class[] {IProject.class});//$NON-NLS-1$
setProjectMethod.invoke(collector, new Object[] {project});
} catch (SecurityException e) {
MakeCorePlugin.log(e);
} catch (NoSuchMethodException e) {
} catch (IllegalArgumentException e) {
} catch (IllegalAccessException e) {
} catch (InvocationTargetException e) {
MakeCorePlugin.log(e.getCause());
}
} }
// all other objects are created on request // all other objects are created on request
} }
@ -60,8 +75,20 @@ public class SCProfileInstance {
* @return a single scannerInfoCollector object * @return a single scannerInfoCollector object
*/ */
public IScannerInfoCollector getScannerInfoCollector() { public IScannerInfoCollector getScannerInfoCollector() {
if (collector == null) {
instantiateCollector();
}
return collector; return collector;
} }
public IScannerInfoCollector createScannerInfoCollector() {
ScannerInfoCollector collector = profile.getScannerInfoCollectorElement();
if (collector != null) {
return (IScannerInfoCollector) collector.createScannerInfoCollector();
}
return null;
}
/** /**
* @return Creates new buildOutputProvider user object. * @return Creates new buildOutputProvider user object.
*/ */

View file

@ -16,13 +16,11 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2;
import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes; import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil; import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
import org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
/** /**
* Implementation class for gathering the built-in compiler settings for * Implementation class for gathering the built-in compiler settings for
@ -32,7 +30,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
* *
* @since 2.0 * @since 2.0
*/ */
public class DefaultGCCScannerInfoCollector implements IScannerInfoCollector2 { public class DefaultGCCScannerInfoCollector implements IManagedScannerInfoCollector {
protected Map definedSymbols; protected Map definedSymbols;
protected static final String EQUALS = "="; //$NON-NLS-1$ protected static final String EQUALS = "="; //$NON-NLS-1$
protected List includePaths; protected List includePaths;
@ -99,15 +97,6 @@ public class DefaultGCCScannerInfoCollector implements IScannerInfoCollector2 {
*/ */
public void setProject(IProject project) { public void setProject(IProject project) {
this.project = project; this.project = project;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#updateScannerConfiguration(org.eclipse.core.runtime.IProgressMonitor)
*/
public void updateScannerConfiguration(IProgressMonitor monitor) throws CoreException {
// TODO Auto-generated method stub
} }
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -214,10 +214,11 @@ public class ManagedBuildCPathEntryContainer implements IPathEntryContainer {
// See if we can load a dynamic resolver // See if we can load a dynamic resolver
SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance(). SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
getSCProfileInstance(project, MM_PP_DISCOVERY_PROFILE_ID); getSCProfileInstance(project, MM_PP_DISCOVERY_PROFILE_ID);
IScannerInfoCollector collector = profileInstance.getScannerInfoCollector(); IScannerInfoCollector collector = profileInstance.createScannerInfoCollector();
if (collector instanceof IManagedScannerInfoCollector) { if (collector instanceof IManagedScannerInfoCollector) {
IManagedScannerInfoCollector mCollector = (IManagedScannerInfoCollector) collector; IManagedScannerInfoCollector mCollector = (IManagedScannerInfoCollector) collector;
mCollector.setProject(project);
ManagedBuildCPathEntryContainer.outputTrace(project.getName(), "Path entries collected dynamically"); //$NON-NLS-1$ ManagedBuildCPathEntryContainer.outputTrace(project.getName(), "Path entries collected dynamically"); //$NON-NLS-1$
calculateEntriesDynamically((IProject)info.getOwner(), profileInstance, collector); calculateEntriesDynamically((IProject)info.getOwner(), profileInstance, collector);
addIncludePaths(mCollector.getIncludePaths()); addIncludePaths(mCollector.getIncludePaths());