1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-02 13:55:39 +02:00

Fix for bug 53856: "Option reference not reporting built-in includes paths to scanner". Changed the constructor for the OptionReference so it only creates a list if it finds built-in path or symbol definitions in the manifest or project file. The getter method for built-ins also concatenates the definitions it contains with those of its parent.

Undid the changes to the geenrated makefile builder since bug 53253 has been corrected.
	
Fix for bug 53861: "Cannot reset tool command back to default". Changed the way the configuration sets the tool command when the value is the same as the default.
This commit is contained in:
Sean Evoy 2004-03-05 16:13:28 +00:00
parent 463db40e82
commit 762808825e
4 changed files with 73 additions and 36 deletions

View file

@ -1,5 +1,21 @@
2004-03-05 Sean Evoy
Fix for bug 53856: "Option reference not reporting built-in includes
paths to scanner"
Changed the constructor for the OptionReference so it only creates a
list if it finds built-in path or symbol definitions in the manifest
or project file. The getter method for built-ins also concatenates the
definitions it contains with those of its parent.
Undid the changes to the geenrated makefile builder since bug 53253 has
been corrected.
Fix for bug 53861: "Cannot reset tool command back to default"
Changed the way the configuration sets the tool command when the value
is the same as the default.
2004-03-02 Sean Evoy 2004-03-02 Sean Evoy
A change in VCErrorParser to fix PR 53253 causes an IndexOutOfBounds A change in VCErrorParser to fix bug 53253 causes an IndexOutOfBounds
exception when echoing a build command on Win32 if the absolute path exception when echoing a build command on Win32 if the absolute path
to the make utility is specified, i.e. C:\<path>\make.exe to the make utility is specified, i.e. C:\<path>\make.exe

View file

@ -461,7 +461,7 @@ public class Configuration extends BuildObject implements IConfiguration {
*/ */
public void setToolCommand(ITool tool, String command) { public void setToolCommand(ITool tool, String command) {
// Make sure the command is different // Make sure the command is different
if (command != null && !tool.getToolCommand().equals(command)) { if (command != null) {
// Does this config have a ref to the tool // Does this config have a ref to the tool
ToolReference ref = getToolReference(tool); ToolReference ref = getToolReference(tool);
if (ref == null) { if (ref == null) {

View file

@ -348,7 +348,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
// Get a launcher for the make command // Get a launcher for the make command
String errMsg = null; String errMsg = null;
CommandLauncher launcher = new CommandLauncher(); CommandLauncher launcher = new CommandLauncher();
launcher.showCommand(false); launcher.showCommand(true);
// Set the environmennt, some scripts may need the CWD var to be set. // Set the environmennt, some scripts may need the CWD var to be set.
Properties props = launcher.getEnvironment(); Properties props = launcher.getEnvironment();
@ -372,15 +372,6 @@ public class GeneratedMakefileBuilder extends ACBuilder {
OutputStream stderr = epm.getOutputStream(); OutputStream stderr = epm.getOutputStream();
// Launch make // Launch make
StringBuffer cmd = new StringBuffer();
cmd.append(makeCommand.toOSString());
for (int index = 0; index < makeTargets.length; ++index) {
cmd.append(' ');
cmd.append(makeTargets[index]);
}
cmd.append(System.getProperty("line.separator", "\n")); //$NON-NLS-2$
consoleOutStream.write(cmd.toString().getBytes());
consoleOutStream.flush();
Process proc = launcher.execute(makeCommand, makeTargets, env, workingDirectory); Process proc = launcher.execute(makeCommand, makeTargets, env, workingDirectory);
if (proc != null) { if (proc != null) {
try { try {

View file

@ -42,21 +42,6 @@ public class OptionReference implements IOption {
// The actual value of the reference // The actual value of the reference
private Object value; private Object value;
/**
* Constructor called when the option reference is created from an
* existing <code>IOption</code>
*
* @param owner
* @param option
*/
public OptionReference(ToolReference owner, IOption option) {
this.owner = owner;
this.option = option;
// Until the option reference is changed, all values will be extracted from original option
owner.addOptionReference(this);
}
/** /**
* This constructor will be called when the receiver is created from * This constructor will be called when the receiver is created from
* the settings found in an extension point. * the settings found in an extension point.
@ -95,13 +80,12 @@ public class OptionReference implements IOption {
case LIBRARIES: case LIBRARIES:
case OBJECTS: case OBJECTS:
List valueList = new ArrayList(); List valueList = new ArrayList();
builtIns = new ArrayList();
IConfigurationElement[] valueElements = element.getChildren(LIST_VALUE); IConfigurationElement[] valueElements = element.getChildren(LIST_VALUE);
for (int i = 0; i < valueElements.length; ++i) { for (int i = 0; i < valueElements.length; ++i) {
IConfigurationElement valueElement = valueElements[i]; IConfigurationElement valueElement = valueElements[i];
Boolean isBuiltIn = new Boolean(valueElement.getAttribute(LIST_ITEM_BUILTIN)); Boolean isBuiltIn = new Boolean(valueElement.getAttribute(LIST_ITEM_BUILTIN));
if (isBuiltIn.booleanValue()) { if (isBuiltIn.booleanValue()) {
builtIns.add(valueElement.getAttribute(LIST_ITEM_VALUE)); getBuiltInList().add(valueElement.getAttribute(LIST_ITEM_VALUE));
} }
else { else {
valueList.add(valueElement.getAttribute(LIST_ITEM_VALUE)); valueList.add(valueElement.getAttribute(LIST_ITEM_VALUE));
@ -111,6 +95,21 @@ public class OptionReference implements IOption {
} }
} }
/**
* Constructor called when the option reference is created from an
* existing <code>IOption</code>
*
* @param owner
* @param option
*/
public OptionReference(ToolReference owner, IOption option) {
this.owner = owner;
this.option = option;
// Until the option reference is changed, all values will be extracted from original option
owner.addOptionReference(this);
}
/** /**
* Created from project file. * Created from project file.
* *
@ -144,14 +143,13 @@ public class OptionReference implements IOption {
case LIBRARIES: case LIBRARIES:
case OBJECTS: case OBJECTS:
List valueList = new ArrayList(); List valueList = new ArrayList();
builtIns = new ArrayList();
NodeList nodes = element.getElementsByTagName(LIST_VALUE); NodeList nodes = element.getElementsByTagName(LIST_VALUE);
for (int i = 0; i < nodes.getLength(); ++i) { for (int i = 0; i < nodes.getLength(); ++i) {
Node node = nodes.item(i); Node node = nodes.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) { if (node.getNodeType() == Node.ELEMENT_NODE) {
Boolean isBuiltIn = new Boolean(((Element)node).getAttribute(LIST_ITEM_BUILTIN)); Boolean isBuiltIn = new Boolean(((Element)node).getAttribute(LIST_ITEM_BUILTIN));
if (isBuiltIn.booleanValue()) { if (isBuiltIn.booleanValue()) {
builtIns.add(((Element)node).getAttribute(LIST_ITEM_VALUE)); getBuiltInList().add(((Element)node).getAttribute(LIST_ITEM_VALUE));
} else { } else {
valueList.add(((Element)node).getAttribute(LIST_ITEM_VALUE)); valueList.add(((Element)node).getAttribute(LIST_ITEM_VALUE));
} }
@ -309,15 +307,32 @@ public class OptionReference implements IOption {
} }
} }
private List getBuiltInList() {
if (builtIns == null) {
builtIns = new ArrayList();
}
return builtIns;
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getBuiltIns() * @see org.eclipse.cdt.core.build.managed.IOption#getBuiltIns()
*/ */
public String[] getBuiltIns() { public String[] getBuiltIns() {
// Return any overridden built-ins here, or the default set List answer = new ArrayList();
// from the option this is a reference to if (builtIns != null) {
return builtIns == null ? answer.addAll(builtIns);
option.getBuiltIns(): }
(String[])builtIns.toArray(new String[builtIns.size()]);
// Add the built-ins from the referenced option to the list
if (option != null) {
String[] optionBuiltIns = option.getBuiltIns();
for (int index = 0; index < optionBuiltIns.length; ++index) {
if (!answer.contains(optionBuiltIns[index])) {
answer.add(optionBuiltIns[index]);
}
}
}
return (String[]) answer.toArray(new String[answer.size()]);
} }
public IOption getOption() { public IOption getOption() {
@ -467,4 +482,19 @@ public class OptionReference implements IOption {
throw new BuildException(ManagedBuilderCorePlugin.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$ throw new BuildException(ManagedBuilderCorePlugin.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
} }
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString() {
String answer = new String();
if (option != null) {
answer += "Reference to " + option.getName(); //$NON-NLS-1$
}
if (answer.length() > 0) {
return answer;
} else {
return super.toString();
}
}
} }