1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 08:55:25 +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
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
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) {
// 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
ToolReference ref = getToolReference(tool);
if (ref == null) {

View file

@ -348,7 +348,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
// Get a launcher for the make command
String errMsg = null;
CommandLauncher launcher = new CommandLauncher();
launcher.showCommand(false);
launcher.showCommand(true);
// Set the environmennt, some scripts may need the CWD var to be set.
Properties props = launcher.getEnvironment();
@ -372,15 +372,6 @@ public class GeneratedMakefileBuilder extends ACBuilder {
OutputStream stderr = epm.getOutputStream();
// 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);
if (proc != null) {
try {

View file

@ -42,21 +42,6 @@ public class OptionReference implements IOption {
// The actual value of the reference
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
* the settings found in an extension point.
@ -95,13 +80,12 @@ public class OptionReference implements IOption {
case LIBRARIES:
case OBJECTS:
List valueList = new ArrayList();
builtIns = new ArrayList();
IConfigurationElement[] valueElements = element.getChildren(LIST_VALUE);
for (int i = 0; i < valueElements.length; ++i) {
IConfigurationElement valueElement = valueElements[i];
Boolean isBuiltIn = new Boolean(valueElement.getAttribute(LIST_ITEM_BUILTIN));
if (isBuiltIn.booleanValue()) {
builtIns.add(valueElement.getAttribute(LIST_ITEM_VALUE));
getBuiltInList().add(valueElement.getAttribute(LIST_ITEM_VALUE));
}
else {
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.
*
@ -144,14 +143,13 @@ public class OptionReference implements IOption {
case LIBRARIES:
case OBJECTS:
List valueList = new ArrayList();
builtIns = new ArrayList();
NodeList nodes = element.getElementsByTagName(LIST_VALUE);
for (int i = 0; i < nodes.getLength(); ++i) {
Node node = nodes.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
Boolean isBuiltIn = new Boolean(((Element)node).getAttribute(LIST_ITEM_BUILTIN));
if (isBuiltIn.booleanValue()) {
builtIns.add(((Element)node).getAttribute(LIST_ITEM_VALUE));
getBuiltInList().add(((Element)node).getAttribute(LIST_ITEM_VALUE));
} else {
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)
* @see org.eclipse.cdt.core.build.managed.IOption#getBuiltIns()
*/
public String[] getBuiltIns() {
// Return any overridden built-ins here, or the default set
// from the option this is a reference to
return builtIns == null ?
option.getBuiltIns():
(String[])builtIns.toArray(new String[builtIns.size()]);
List answer = new ArrayList();
if (builtIns != null) {
answer.addAll(builtIns);
}
// 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() {
@ -467,4 +482,19 @@ public class OptionReference implements IOption {
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();
}
}
}