mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 01:06:01 +02:00
External code commit from Leo Treggiari from Intel that adds support for adding and removing error psarser on a managed build project
This commit is contained in:
parent
1a5788e0dc
commit
b66bb2d4b7
8 changed files with 173 additions and 6 deletions
|
@ -465,6 +465,13 @@ Additional special types exist to flag options of special relevance to the build
|
|||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="errorParsers" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Specifies the default list of error parsers to be used by projects created from this target. It is an ordered, semi-colon separated list of parser IDs. The order specifies the order in which the error parsers are invoked during a build.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
|
|
|
@ -238,4 +238,20 @@ public interface IManagedBuildInfo {
|
|||
* @param target
|
||||
*/
|
||||
public void setDefaultTarget(ITarget target);
|
||||
|
||||
/**
|
||||
* Set the currently selected target. This is used while the project
|
||||
* property pages are displayed
|
||||
*
|
||||
* @param target
|
||||
*/
|
||||
public void setSelectedTarget(ITarget target);
|
||||
|
||||
/**
|
||||
* Get the currently selected target. This is used while the project
|
||||
* property pages are displayed
|
||||
*
|
||||
* @return target
|
||||
*/
|
||||
public ITarget getSelectedTarget();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ public interface ITarget extends IBuildObject {
|
|||
public static final String TARGET_ELEMENT_NAME = "target"; //$NON-NLS-1$
|
||||
public static final String ARTIFACT_NAME = "artifactName"; //$NON-NLS-1$
|
||||
public static final String BINARY_PARSER = "binaryParser"; //$NON-NLS-1$
|
||||
public static final String ERROR_PARSERS = "errorParsers"; //$NON-NLS-1$
|
||||
public static final String CLEAN_COMMAND = "cleanCommand"; //$NON-NLS-1$
|
||||
public static final String DEFAULT_EXTENSION = "defaultExtension"; //$NON-NLS-1$
|
||||
public static final String EXTENSION = "extension"; //$NON-NLS-1$
|
||||
|
@ -77,6 +78,20 @@ public interface ITarget extends IBuildObject {
|
|||
* @return String
|
||||
*/
|
||||
public String getBinaryParserId();
|
||||
|
||||
/**
|
||||
* Answers the semicolon separated list of unique IDs of the error parsers associated with the target.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public String getErrorParserIds();
|
||||
|
||||
/**
|
||||
* Answers the ordered list of unique IDs of the error parsers associated with the target.
|
||||
*
|
||||
* @return String[]
|
||||
*/
|
||||
public String[] getErrorParserList();
|
||||
|
||||
/**
|
||||
* Answers the OS-specific command to remove files created by the build
|
||||
|
@ -239,6 +254,14 @@ public interface ITarget extends IBuildObject {
|
|||
*/
|
||||
public void setMakeCommand(String command);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the semicolon separated list of error parser ids
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
public void setErrorParserIds(String ids);
|
||||
|
||||
/**
|
||||
* Sets the resource that owns the receiver.
|
||||
*
|
||||
|
|
|
@ -218,6 +218,43 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the currently selected target. This is used while the project
|
||||
* property pages are displayed
|
||||
*
|
||||
* @param project
|
||||
* @param target
|
||||
*/
|
||||
public static void setSelectedTarget(IProject project, ITarget target) {
|
||||
if (project == null || target == null) {
|
||||
return;
|
||||
}
|
||||
// Set the default in build information for the project
|
||||
IManagedBuildInfo info = getBuildInfo(project);
|
||||
if (info != null) {
|
||||
info.setSelectedTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the currently selected target. This is used while the project
|
||||
* property pages are displayed
|
||||
*
|
||||
* @param project
|
||||
* @return target
|
||||
*/
|
||||
public static ITarget getSelectedTarget(IProject project) {
|
||||
if (project == null) {
|
||||
return null;
|
||||
}
|
||||
// Set the default in build information for the project
|
||||
IManagedBuildInfo info = getBuildInfo(project);
|
||||
if (info != null) {
|
||||
return info.getSelectedTarget();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
*
|
||||
* @param config
|
||||
|
|
|
@ -390,8 +390,9 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
|||
env = (String[]) envList.toArray(new String[envList.size()]);
|
||||
}
|
||||
|
||||
// Hook up an error parser
|
||||
ErrorParserManager epm = new ErrorParserManager(this);
|
||||
// Hook up an error parser manager
|
||||
String[] errorParsers = info.getDefaultTarget().getErrorParserList();
|
||||
ErrorParserManager epm = new ErrorParserManager(getProject(), this, errorParsers);
|
||||
epm.setOutputStream(consoleOutStream);
|
||||
OutputStream stdout = epm.getOutputStream();
|
||||
OutputStream stderr = epm.getOutputStream();
|
||||
|
|
|
@ -49,6 +49,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
|||
private Map defaultConfigMap;
|
||||
private ITarget defaultTarget;
|
||||
private String defaultTargetId;
|
||||
private ITarget selectedTarget;
|
||||
private boolean isDirty;
|
||||
private IResource owner;
|
||||
private Map targetMap;
|
||||
|
@ -996,6 +997,20 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
|||
persistDefaultTarget();
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#setSelectedTarget(org.eclipse.cdt.core.build.managed.ITarget)
|
||||
*/
|
||||
public void setSelectedTarget(ITarget target) {
|
||||
selectedTarget = target;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getSelectedTarget()
|
||||
*/
|
||||
public ITarget getSelectedTarget() {
|
||||
return selectedTarget;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#setDirty(boolean)
|
||||
|
|
|
@ -19,6 +19,7 @@ import java.util.Map;
|
|||
import java.util.Random;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
||||
|
@ -36,6 +37,7 @@ public class Target extends BuildObject implements ITarget {
|
|||
// Build model elements that come from the plugin or project files
|
||||
private String artifactName;
|
||||
private String binaryParserId;
|
||||
private String errorParserIds;
|
||||
private String cleanCommand;
|
||||
private List configList;
|
||||
private Map configMap;
|
||||
|
@ -89,6 +91,7 @@ public class Target extends BuildObject implements ITarget {
|
|||
setName(parent.getName());
|
||||
setArtifactName(parent.getArtifactName());
|
||||
this.binaryParserId = parent.getBinaryParserId();
|
||||
this.errorParserIds = parent.getErrorParserIds();
|
||||
this.defaultExtension = parent.getArtifactExtension();
|
||||
this.isTest = parent.isTestTarget();
|
||||
this.cleanCommand = parent.getCleanCommand();
|
||||
|
@ -124,6 +127,9 @@ public class Target extends BuildObject implements ITarget {
|
|||
|
||||
// Get the ID of the binary parser
|
||||
binaryParserId = element.getAttribute(BINARY_PARSER);
|
||||
|
||||
// Get the semicolon separated list of IDs of the error parsers
|
||||
errorParserIds = element.getAttribute(ERROR_PARSERS);
|
||||
|
||||
// Get the default extension
|
||||
defaultExtension = element.getAttribute(DEFAULT_EXTENSION);
|
||||
|
@ -209,6 +215,11 @@ public class Target extends BuildObject implements ITarget {
|
|||
// Get the clean command
|
||||
cleanCommand = element.getAttribute(CLEAN_COMMAND);
|
||||
|
||||
// Get the semicolon separated list of IDs of the error parsers
|
||||
if (element.hasAttribute(ERROR_PARSERS)) {
|
||||
errorParserIds = element.getAttribute(ERROR_PARSERS);
|
||||
}
|
||||
|
||||
// Get the make command and arguments
|
||||
if (element.hasAttribute(MAKE_COMMAND)) {
|
||||
makeCommand = element.getAttribute(MAKE_COMMAND);
|
||||
|
@ -317,6 +328,9 @@ public class Target extends BuildObject implements ITarget {
|
|||
if (makeArguments != null) {
|
||||
element.setAttribute(MAKE_ARGS, makeArguments);
|
||||
}
|
||||
if (errorParserIds != null) {
|
||||
element.setAttribute(ERROR_PARSERS, errorParserIds);
|
||||
}
|
||||
|
||||
// Serialize the configuration settings
|
||||
Iterator iter = getConfigurationList().listIterator();
|
||||
|
@ -693,6 +707,46 @@ public class Target extends BuildObject implements ITarget {
|
|||
return binaryParserId;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getErrorParserIds()
|
||||
*/
|
||||
public String getErrorParserIds() {
|
||||
if (errorParserIds == null) {
|
||||
// If I have a parent, ask it
|
||||
if (parent != null) {
|
||||
return parent.getErrorParserIds();
|
||||
}
|
||||
}
|
||||
return errorParserIds;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getErrorParserList()
|
||||
*/
|
||||
public String[] getErrorParserList() {
|
||||
String parserIDs = getErrorParserIds();
|
||||
String[] errorParsers = null;
|
||||
if (parserIDs != null) {
|
||||
// Check for an empty string
|
||||
if (parserIDs.length() == 0) {
|
||||
errorParsers = new String[0];
|
||||
} else {
|
||||
StringTokenizer tok = new StringTokenizer(parserIDs, ";"); //$NON-NLS-1$
|
||||
List list = new ArrayList(tok.countTokens());
|
||||
while (tok.hasMoreElements()) {
|
||||
list.add(tok.nextToken());
|
||||
}
|
||||
String[] strArr = {""};
|
||||
errorParsers = (String[]) list.toArray(strArr);
|
||||
}
|
||||
} else {
|
||||
// If no error parsers are specified by the target, the default is
|
||||
// all error parsers
|
||||
errorParsers = CCorePlugin.getDefault().getAllErrorParsersIDs();
|
||||
}
|
||||
return errorParsers;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.ITarget#getConfiguration()
|
||||
*/
|
||||
|
@ -819,6 +873,18 @@ public class Target extends BuildObject implements ITarget {
|
|||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.ITarget#setErrorParserIds()
|
||||
*/
|
||||
public void setErrorParserIds(String ids) {
|
||||
if (ids == null) return;
|
||||
String currentIds = getErrorParserIds();
|
||||
if (currentIds == null || !(currentIds.equals(ids))) {
|
||||
errorParserIds = ids;
|
||||
isDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.ITarget#updateOwner(org.eclipse.core.resources.IResource)
|
||||
*/
|
||||
|
|
|
@ -424,10 +424,12 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
|||
resolved = true;
|
||||
// IManagedConfigElement element = ManagedBuildManager.getConfigElement(this);
|
||||
// Tool doesn't have any references, but children might
|
||||
Iterator optionIter = options.iterator();
|
||||
while (optionIter.hasNext()) {
|
||||
Option current = (Option)optionIter.next();
|
||||
current.resolveReferences();
|
||||
if (options != null) {
|
||||
Iterator optionIter = options.iterator();
|
||||
while (optionIter.hasNext()) {
|
||||
Option current = (Option)optionIter.next();
|
||||
current.resolveReferences();
|
||||
}
|
||||
}
|
||||
Iterator catIter = categoryMap.values().iterator();
|
||||
while (catIter.hasNext()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue