mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Patch for Sean Evoy:
Core 1. Added 2 new option types: Boolean and enumerated 2. Changed the IOption interface to get new option type values 3. In plugin manifest and IOption interface added concept of a default enumerated value to support on-going GUI work 4. In plugin manifest and IOption, added field to map the actual command line argument with the option for makefile generation. Tests 1. Changed the plugin.xml manifest to match the new option types 2. AllBuildTests.java updated to test new option types and fields added in core
This commit is contained in:
parent
1885198194
commit
7b1c64d5fe
8 changed files with 726 additions and 414 deletions
|
@ -16,36 +16,10 @@ package org.eclipse.cdt.core.build.managed;
|
||||||
public interface IOption extends IBuildObject {
|
public interface IOption extends IBuildObject {
|
||||||
|
|
||||||
// Type for the value of the option
|
// Type for the value of the option
|
||||||
public static final int STRING = 0;
|
public static final int BOOLEAN = 0;
|
||||||
public static final int STRING_LIST = 1;
|
public static final int ENUMERATED = 1;
|
||||||
|
public static final int STRING = 2;
|
||||||
/**
|
public static final int STRING_LIST = 3;
|
||||||
* Returns the tool defining this option.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public ITool getTool();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the category for this option.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public IOptionCategory getCategory();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the name of this option.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getName();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the type for the value of the option.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public int getValueType();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If this option is defined as an enumeration, this function returns
|
* If this option is defined as an enumeration, this function returns
|
||||||
|
@ -57,11 +31,42 @@ public interface IOption extends IBuildObject {
|
||||||
public String [] getApplicableValues();
|
public String [] getApplicableValues();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current value for this option if it is a String
|
* @return the value for a boolean option.
|
||||||
|
*/
|
||||||
|
public boolean getBooleanValue() throws BuildException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the category for this option.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getStringValue() throws BuildException;
|
public IOptionCategory getCategory();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a String containing the actual command line option
|
||||||
|
* associated with the <code>IOption</code>
|
||||||
|
*/
|
||||||
|
public String getCommand();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a <code>String</code> containing the default value for the
|
||||||
|
* enumerated option.
|
||||||
|
*/
|
||||||
|
public String getDefaultEnumName ();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return <code>String</code> containing the command associated with the
|
||||||
|
* enumeration name.
|
||||||
|
*/
|
||||||
|
public String getEnumCommand (String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of this option.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current value for this option if it is a List of Strings.
|
* Returns the current value for this option if it is a List of Strings.
|
||||||
|
@ -70,4 +75,24 @@ public interface IOption extends IBuildObject {
|
||||||
*/
|
*/
|
||||||
public String [] getStringListValue() throws BuildException;
|
public String [] getStringListValue() throws BuildException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current value for this option if it is a String
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getStringValue() throws BuildException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the tool defining this option.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public ITool getTool();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the type for the value of the option.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int getValueType();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,9 @@
|
||||||
package org.eclipse.cdt.internal.core.build.managed;
|
package org.eclipse.cdt.internal.core.build.managed;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.build.managed.BuildException;
|
import org.eclipse.cdt.core.build.managed.BuildException;
|
||||||
import org.eclipse.cdt.core.build.managed.IConfiguration;
|
import org.eclipse.cdt.core.build.managed.IConfiguration;
|
||||||
|
@ -27,10 +29,12 @@ public class Option extends BuildObject implements IOption {
|
||||||
|
|
||||||
private ITool tool;
|
private ITool tool;
|
||||||
private IOptionCategory category;
|
private IOptionCategory category;
|
||||||
private List enumValues;
|
|
||||||
|
|
||||||
private int valueType;
|
private int valueType;
|
||||||
private Object value;
|
private Object value;
|
||||||
|
private Map enumCommands;
|
||||||
|
private String defaultEnumName;
|
||||||
|
private String command;
|
||||||
|
|
||||||
private static final String[] emptyStrings = new String[0];
|
private static final String[] emptyStrings = new String[0];
|
||||||
|
|
||||||
|
@ -55,25 +59,53 @@ public class Option extends BuildObject implements IOption {
|
||||||
if (categoryId != null)
|
if (categoryId != null)
|
||||||
setCategory(tool.getOptionCategory(categoryId));
|
setCategory(tool.getOptionCategory(categoryId));
|
||||||
|
|
||||||
|
// command
|
||||||
|
command = element.getAttribute("command");
|
||||||
|
|
||||||
// valueType
|
// valueType
|
||||||
String valueTypeStr = element.getAttribute("valueType");
|
String valueTypeStr = element.getAttribute("valueType");
|
||||||
if (valueTypeStr == null || valueTypeStr.equals("string"))
|
if (valueTypeStr == null || valueTypeStr.equals("string"))
|
||||||
valueType = IOption.STRING;
|
valueType = IOption.STRING;
|
||||||
else if (valueTypeStr.equals("stringList"))
|
else if (valueTypeStr.equals("stringList"))
|
||||||
valueType = IOption.STRING_LIST;
|
valueType = IOption.STRING_LIST;
|
||||||
|
else if (valueTypeStr.equals("boolean"))
|
||||||
|
valueType = IOption.BOOLEAN;
|
||||||
|
else
|
||||||
|
valueType = IOption.ENUMERATED;
|
||||||
|
|
||||||
// value
|
// value
|
||||||
|
enumCommands = new HashMap();
|
||||||
switch (valueType) {
|
switch (valueType) {
|
||||||
|
case IOption.BOOLEAN:
|
||||||
|
// Convert the string to a boolean
|
||||||
|
value = new Boolean(element.getAttribute("defaultValue"));
|
||||||
|
break;
|
||||||
case IOption.STRING:
|
case IOption.STRING:
|
||||||
value = element.getAttribute("value");
|
// Just get the value out of the option directly
|
||||||
|
value = element.getAttribute("defaultValue");
|
||||||
|
break;
|
||||||
|
case IOption.ENUMERATED:
|
||||||
|
List enumList = new ArrayList();
|
||||||
|
IConfigurationElement[] enumElements = element.getChildren("optionEnum");
|
||||||
|
for (int i = 0; i < enumElements.length; ++i) {
|
||||||
|
String optName = enumElements[i].getAttribute("name");
|
||||||
|
String optCommand = enumElements[i].getAttribute("command");
|
||||||
|
enumList.add(optName);
|
||||||
|
enumCommands.put(optName, optCommand);
|
||||||
|
Boolean isDefault = new Boolean(enumElements[i].getAttribute("isDefault"));
|
||||||
|
if (isDefault.booleanValue()) {
|
||||||
|
defaultEnumName = optName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
value = enumList;
|
||||||
break;
|
break;
|
||||||
case IOption.STRING_LIST:
|
case IOption.STRING_LIST:
|
||||||
List valueList = new ArrayList();
|
List valueList = new ArrayList();
|
||||||
value = valueList;
|
|
||||||
IConfigurationElement[] valueElements = element.getChildren("optionValue");
|
IConfigurationElement[] valueElements = element.getChildren("optionValue");
|
||||||
for (int i = 0; i < valueElements.length; ++i) {
|
for (int i = 0; i < valueElements.length; ++i) {
|
||||||
valueList.add(valueElements[i].getAttribute("value"));
|
valueList.add(valueElements[i].getAttribute("value"));
|
||||||
}
|
}
|
||||||
|
value = valueList;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,11 +114,17 @@ public class Option extends BuildObject implements IOption {
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#getApplicableValues()
|
* @see org.eclipse.cdt.core.build.managed.IOption#getApplicableValues()
|
||||||
*/
|
*/
|
||||||
public String[] getApplicableValues() {
|
public String[] getApplicableValues() {
|
||||||
|
List enumValues = (List)value;
|
||||||
return enumValues != null
|
return enumValues != null
|
||||||
? (String[])enumValues.toArray(new String[enumValues.size()])
|
? (String[])enumValues.toArray(new String[enumValues.size()])
|
||||||
: emptyStrings;
|
: emptyStrings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getBooleanValue() {
|
||||||
|
Boolean bool = (Boolean) value;
|
||||||
|
return bool.booleanValue();
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#getCategory()
|
* @see org.eclipse.cdt.core.build.managed.IOption#getCategory()
|
||||||
*/
|
*/
|
||||||
|
@ -94,6 +132,27 @@ public class Option extends BuildObject implements IOption {
|
||||||
return category != null ? category : getTool().getTopOptionCategory();
|
return category != null ? category : getTool().getTopOptionCategory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.build.managed.IOption#getCommand()
|
||||||
|
*/
|
||||||
|
public String getCommand() {
|
||||||
|
return command;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.build.managed.IOption#getDefaultEnumValue()
|
||||||
|
*/
|
||||||
|
public String getDefaultEnumName() {
|
||||||
|
return defaultEnumName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.build.managed.IOption#getEnumCommand(java.lang.String)
|
||||||
|
*/
|
||||||
|
public String getEnumCommand(String name) {
|
||||||
|
return (String) enumCommands.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#getStringListValue()
|
* @see org.eclipse.cdt.core.build.managed.IOption#getStringListValue()
|
||||||
*/
|
*/
|
||||||
|
@ -125,6 +184,13 @@ public class Option extends BuildObject implements IOption {
|
||||||
return valueType;
|
return valueType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.build.managed.IOption#setCategory(org.eclipse.cdt.core.build.managed.IOptionCategory)
|
||||||
|
*/
|
||||||
|
public void setCategory(IOptionCategory category) {
|
||||||
|
this.category = category;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#setStringValue(org.eclipse.cdt.core.build.managed.IConfiguration, java.lang.String)
|
* @see org.eclipse.cdt.core.build.managed.IOption#setStringValue(org.eclipse.cdt.core.build.managed.IConfiguration, java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@ -163,11 +229,4 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#setCategory(org.eclipse.cdt.core.build.managed.IOptionCategory)
|
|
||||||
*/
|
|
||||||
public void setCategory(IOptionCategory category) {
|
|
||||||
this.category = category;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,10 @@
|
||||||
package org.eclipse.cdt.internal.core.build.managed;
|
package org.eclipse.cdt.internal.core.build.managed;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.build.managed.BuildException;
|
import org.eclipse.cdt.core.build.managed.BuildException;
|
||||||
import org.eclipse.cdt.core.build.managed.IOption;
|
import org.eclipse.cdt.core.build.managed.IOption;
|
||||||
|
@ -30,6 +33,9 @@ public class OptionReference implements IOption {
|
||||||
private IOption option;
|
private IOption option;
|
||||||
private ToolReference owner;
|
private ToolReference owner;
|
||||||
private Object value;
|
private Object value;
|
||||||
|
private String defaultEnumName;
|
||||||
|
private String command;
|
||||||
|
private Map enumCommands;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created internally.
|
* Created internally.
|
||||||
|
@ -57,9 +63,28 @@ public class OptionReference implements IOption {
|
||||||
owner.addOptionReference(this);
|
owner.addOptionReference(this);
|
||||||
|
|
||||||
// value
|
// value
|
||||||
|
enumCommands = new HashMap();
|
||||||
switch (option.getValueType()) {
|
switch (option.getValueType()) {
|
||||||
|
case IOption.BOOLEAN:
|
||||||
|
value = new Boolean(element.getAttribute("defaultValue"));
|
||||||
|
break;
|
||||||
case IOption.STRING:
|
case IOption.STRING:
|
||||||
value = element.getAttribute("value");
|
value = element.getAttribute("defaultValue");
|
||||||
|
break;
|
||||||
|
case IOption.ENUMERATED:
|
||||||
|
List enumList = new ArrayList();
|
||||||
|
IConfigurationElement[] enumElements = element.getChildren("optionEnum");
|
||||||
|
for (int i = 0; i < enumElements.length; ++i) {
|
||||||
|
String optName = enumElements[i].getAttribute("name");
|
||||||
|
String optCommand = enumElements[i].getAttribute("command");
|
||||||
|
enumList.add(optName);
|
||||||
|
enumCommands.put(optName, optCommand);
|
||||||
|
Boolean isDefault = new Boolean(enumElements[i].getAttribute("isDefault"));
|
||||||
|
if (isDefault.booleanValue()) {
|
||||||
|
defaultEnumName = optName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
value = enumList;
|
||||||
break;
|
break;
|
||||||
case IOption.STRING_LIST:
|
case IOption.STRING_LIST:
|
||||||
List valueList = new ArrayList();
|
List valueList = new ArrayList();
|
||||||
|
@ -67,6 +92,7 @@ public class OptionReference implements IOption {
|
||||||
for (int i = 0; i < valueElements.length; ++i) {
|
for (int i = 0; i < valueElements.length; ++i) {
|
||||||
valueList.add(valueElements[i].getAttribute("value"));
|
valueList.add(valueElements[i].getAttribute("value"));
|
||||||
}
|
}
|
||||||
|
value = valueList;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,6 +111,7 @@ public class OptionReference implements IOption {
|
||||||
|
|
||||||
// value
|
// value
|
||||||
switch (option.getValueType()) {
|
switch (option.getValueType()) {
|
||||||
|
case IOption.BOOLEAN:
|
||||||
case IOption.STRING:
|
case IOption.STRING:
|
||||||
value = element.getAttribute("value");
|
value = element.getAttribute("value");
|
||||||
break;
|
break;
|
||||||
|
@ -94,6 +121,7 @@ public class OptionReference implements IOption {
|
||||||
for (int i = 0; i < nodes.getLength(); ++i) {
|
for (int i = 0; i < nodes.getLength(); ++i) {
|
||||||
valueList.add(((Element)nodes.item(i)).getAttribute("value"));
|
valueList.add(((Element)nodes.item(i)).getAttribute("value"));
|
||||||
}
|
}
|
||||||
|
value = valueList;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,16 +138,26 @@ public class OptionReference implements IOption {
|
||||||
|
|
||||||
// value
|
// value
|
||||||
switch (option.getValueType()) {
|
switch (option.getValueType()) {
|
||||||
|
case IOption.BOOLEAN:
|
||||||
case IOption.STRING:
|
case IOption.STRING:
|
||||||
element.setAttribute("value", (String)value);
|
element.setAttribute("value", (String)value);
|
||||||
break;
|
break;
|
||||||
case IOption.STRING_LIST:
|
case IOption.STRING_LIST:
|
||||||
List valueList = (List)value;
|
List stringList = (List)value;
|
||||||
for (int i = 0; i < valueList.size(); ++i) {
|
for (int i = 0; i < stringList.size(); ++i) {
|
||||||
Element valueElement = doc.createElement("optionValue");
|
Element valueElement = doc.createElement("optionValue");
|
||||||
valueElement.setAttribute("value", (String)valueList.get(i));
|
valueElement.setAttribute("value", (String)stringList.get(i));
|
||||||
element.appendChild(valueElement);
|
element.appendChild(valueElement);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case IOption.ENUMERATED:
|
||||||
|
List enumList = (List)value;
|
||||||
|
for (int i = 0; i < enumList.size(); ++i) {
|
||||||
|
Element valueElement = doc.createElement("optionEnum");
|
||||||
|
valueElement.setAttribute("value", (String)enumList.get(i));
|
||||||
|
element.appendChild(valueElement);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +175,42 @@ public class OptionReference implements IOption {
|
||||||
return option.getCategory();
|
return option.getCategory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.build.managed.IOption#getCommand()
|
||||||
|
*/
|
||||||
|
public String getCommand() {
|
||||||
|
return option.getCommand();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.build.managed.IOption#getDefaultEnumValue()
|
||||||
|
*/
|
||||||
|
public String getDefaultEnumName() {
|
||||||
|
if (value == null) {
|
||||||
|
return option.getDefaultEnumName();
|
||||||
|
} else {
|
||||||
|
return defaultEnumName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.build.managed.IOption#getEnumCommand(java.lang.String)
|
||||||
|
*/
|
||||||
|
public String getEnumCommand(String name) {
|
||||||
|
if (value == null) {
|
||||||
|
return option.getEnumCommand(name);
|
||||||
|
} else {
|
||||||
|
return (String)enumCommands.get(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.build.managed.IBuildObject#getId()
|
||||||
|
*/
|
||||||
|
public String getId() {
|
||||||
|
return option.getId();
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IBuildObject#getName()
|
* @see org.eclipse.cdt.core.build.managed.IBuildObject#getName()
|
||||||
*/
|
*/
|
||||||
|
@ -144,6 +218,21 @@ public class OptionReference implements IOption {
|
||||||
return option.getName();
|
return option.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.build.managed.IOption#getBooleanValue()
|
||||||
|
*/
|
||||||
|
public boolean getBooleanValue() throws BuildException {
|
||||||
|
if (value == null){
|
||||||
|
return option.getBooleanValue();
|
||||||
|
}
|
||||||
|
else if (getValueType() == IOption.BOOLEAN) {
|
||||||
|
Boolean bool = (Boolean) value;
|
||||||
|
return bool.booleanValue();
|
||||||
|
} else {
|
||||||
|
throw new BuildException("bad value type");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#getStringListValue()
|
* @see org.eclipse.cdt.core.build.managed.IOption#getStringListValue()
|
||||||
*/
|
*/
|
||||||
|
@ -186,13 +275,6 @@ public class OptionReference implements IOption {
|
||||||
return option.getValueType();
|
return option.getValueType();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.build.managed.IBuildObject#getId()
|
|
||||||
*/
|
|
||||||
public String getId() {
|
|
||||||
return option.getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean references(IOption target) {
|
public boolean references(IOption target) {
|
||||||
if (equals(target))
|
if (equals(target))
|
||||||
// we are the target
|
// we are the target
|
||||||
|
|
|
@ -14,3 +14,7 @@ ProcessList.name=Process List
|
||||||
makeproject.name=Make Project
|
makeproject.name=Make Project
|
||||||
genericmake.name=Generic Make
|
genericmake.name=Generic Make
|
||||||
makebuildmodel.name=Make Builder
|
makebuildmodel.name=Make Builder
|
||||||
|
|
||||||
|
ManagedBuildNature.name=Managed C/C++ Build Nature
|
||||||
|
|
||||||
|
GeneratedMakefileCBuilder.name=Generated Makefile C/C++ Builder
|
||||||
|
|
|
@ -252,5 +252,29 @@
|
||||||
pattern="*.exe">
|
pattern="*.exe">
|
||||||
</ignore>
|
</ignore>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
id="managedBuildNature"
|
||||||
|
name="%ManagedBuildNature.name"
|
||||||
|
point="org.eclipse.core.resources.natures">
|
||||||
|
<requires-nature
|
||||||
|
id="org.eclipse.cdt.core.cnature">
|
||||||
|
</requires-nature>
|
||||||
|
<runtime>
|
||||||
|
<run
|
||||||
|
class="org.eclipse.cdt.core.ManagedCProjectNature">
|
||||||
|
</run>
|
||||||
|
</runtime>
|
||||||
|
</extension>
|
||||||
|
<extension
|
||||||
|
id="generatedMakefileCBuilder"
|
||||||
|
name="%GeneratedMakefileCBuilder.name"
|
||||||
|
point="org.eclipse.core.resources.builders">
|
||||||
|
<builder
|
||||||
|
hasNature="true">
|
||||||
|
<run
|
||||||
|
class="org.eclipse.cdt.internal.core.GeneratedMakefileCBuilder">
|
||||||
|
</run>
|
||||||
|
</builder>
|
||||||
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<meta.schema plugin="org.eclipse.cdt.core" id="ManagedBuildTools" name="Managed Build Tools"/>
|
<meta.schema plugin="org.eclipse.cdt.core" id="ManagedBuildTools" name="Managed Build Tools"/>
|
||||||
</appInfo>
|
</appInfo>
|
||||||
<documentation>
|
<documentation>
|
||||||
[Enter description of this extension point.]
|
Describes targets, configurations, and toolchains for the build system.
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
|
|
||||||
|
@ -97,21 +97,21 @@
|
||||||
<attribute name="id" type="string" use="required">
|
<attribute name="id" type="string" use="required">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
A unique identifier for the option.
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
<attribute name="name" type="string" use="required">
|
<attribute name="name" type="string" use="required">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
A descriptive name for the option.
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
<attribute name="valueType" use="default" value="string">
|
<attribute name="valueType" use="default" value="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
An option can be one of the following types; 'string' for catch-all entries for options that cannot be easily defined any other way, 'string list' for entries that consist of a list of values such as defined symbols or paths, 'boolean' for options that have two values, and 'enumerated' for options that are one-of a list of values.
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
<simpleType>
|
<simpleType>
|
||||||
|
@ -120,13 +120,17 @@
|
||||||
</enumeration>
|
</enumeration>
|
||||||
<enumeration value="stringList">
|
<enumeration value="stringList">
|
||||||
</enumeration>
|
</enumeration>
|
||||||
|
<enumeration value="boolean">
|
||||||
|
</enumeration>
|
||||||
|
<enumeration value="enumerated">
|
||||||
|
</enumeration>
|
||||||
</restriction>
|
</restriction>
|
||||||
</simpleType>
|
</simpleType>
|
||||||
</attribute>
|
</attribute>
|
||||||
<attribute name="value" type="string">
|
<attribute name="value" type="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
Overridden value assigned to the option by the end user.
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
@ -137,22 +141,55 @@
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
<attribute name="defaultValue" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
Specifies the default value for the option if the 'value' field is blank. For enumerated options the optionEnums will be searched for the default. For string list options, all defined optionValues will be treated as defaults. For boolean values, specify truth using the string 'true'. All other strings will be treated as false.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="command" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
An optional value that specifies the actual command that will be passed to the tool on the command line.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
</complexType>
|
</complexType>
|
||||||
</element>
|
</element>
|
||||||
|
|
||||||
<element name="optionEnum">
|
<element name="optionEnum">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
Defines a single value of an enumerated option.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
<complexType>
|
<complexType>
|
||||||
<attribute name="id" type="string" use="required">
|
<attribute name="id" type="string" use="required">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
Unique identifier for the option enumeration.
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
<attribute name="name" type="string" use="required">
|
<attribute name="name" type="string" use="required">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
A descriptive name for the enumeration.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="isDefault" type="boolean">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
Flags this enumerated value as the default to apply to the option if the user has not changed the setting.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="command" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
The command that the enumerated value translates to on the command line.
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
@ -205,7 +242,14 @@
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
<attribute name="value" type="string">
|
<attribute name="defaultValue" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="command" type="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
|
||||||
|
@ -258,6 +302,11 @@
|
||||||
</element>
|
</element>
|
||||||
|
|
||||||
<element name="optionCategory">
|
<element name="optionCategory">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
An optional, but useful, mechanism for grouping options together.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
<complexType>
|
<complexType>
|
||||||
<attribute name="id" type="string">
|
<attribute name="id" type="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
|
@ -284,6 +333,11 @@
|
||||||
</element>
|
</element>
|
||||||
|
|
||||||
<element name="optionValue">
|
<element name="optionValue">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
A value for defining individual elements of a string list option.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
<complexType>
|
<complexType>
|
||||||
<attribute name="value" type="string" use="required">
|
<attribute name="value" type="string" use="required">
|
||||||
<annotation>
|
<annotation>
|
||||||
|
@ -300,7 +354,7 @@
|
||||||
<meta.section type="since"/>
|
<meta.section type="since"/>
|
||||||
</appInfo>
|
</appInfo>
|
||||||
<documentation>
|
<documentation>
|
||||||
[Enter the first release in which this extension point appears.]
|
CDT 1.1
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
|
|
||||||
|
|
|
@ -172,27 +172,51 @@ public class AllBuildTests extends TestCase {
|
||||||
// Root Tool
|
// Root Tool
|
||||||
ITool rootTool = tools[0];
|
ITool rootTool = tools[0];
|
||||||
assertEquals("Root Tool", rootTool.getName());
|
assertEquals("Root Tool", rootTool.getName());
|
||||||
// Options
|
// 4 Options are defined in the root tool
|
||||||
IOption[] options = rootTool.getOptions();
|
IOption[] options = rootTool.getOptions();
|
||||||
assertEquals(2, options.length);
|
assertEquals(4, options.length);
|
||||||
assertEquals("Option in Top", options[0].getName());
|
// First option is a 2-element list
|
||||||
|
assertEquals("List Option in Top", options[0].getName());
|
||||||
|
assertEquals(IOption.STRING_LIST, options[0].getValueType());
|
||||||
String[] valueList = options[0].getStringListValue();
|
String[] valueList = options[0].getStringListValue();
|
||||||
|
assertEquals(2, valueList.length);
|
||||||
assertEquals("a", valueList[0]);
|
assertEquals("a", valueList[0]);
|
||||||
assertEquals("b", valueList[1]);
|
assertEquals("b", valueList[1]);
|
||||||
assertEquals("Option in Category", options[1].getName());
|
assertEquals(options[0].getCommand(), "-L");
|
||||||
assertEquals("x", options[1].getStringValue());
|
// Next option is a boolean in top
|
||||||
|
assertEquals("Boolean Option in Top", options[1].getName());
|
||||||
|
assertEquals(IOption.BOOLEAN, options[1].getValueType());
|
||||||
|
assertEquals(false, options[1].getBooleanValue());
|
||||||
|
assertEquals("-b", options[1].getCommand());
|
||||||
|
// Next option is a string category
|
||||||
|
assertEquals("String Option in Category", options[2].getName());
|
||||||
|
assertEquals(IOption.STRING, options[2].getValueType());
|
||||||
|
assertEquals("x", options[2].getStringValue());
|
||||||
|
// Final option is an enumerated
|
||||||
|
assertEquals("Enumerated Option in Category", options[3].getName());
|
||||||
|
assertEquals(IOption.ENUMERATED, options[3].getValueType());
|
||||||
|
assertEquals("Default Enum", options[3].getDefaultEnumName());
|
||||||
|
valueList = options[3].getApplicableValues();
|
||||||
|
assertEquals(2, valueList.length);
|
||||||
|
assertEquals("Default Enum", valueList[0]);
|
||||||
|
assertEquals("Another Enum", valueList[1]);
|
||||||
|
assertEquals("-e1", options[3].getEnumCommand(valueList[0]));
|
||||||
|
assertEquals("-e2", options[3].getEnumCommand(valueList[1]));
|
||||||
|
|
||||||
// Option Categories
|
// Option Categories
|
||||||
IOptionCategory topCategory = rootTool.getTopOptionCategory();
|
IOptionCategory topCategory = rootTool.getTopOptionCategory();
|
||||||
assertEquals("Root Tool", topCategory.getName());
|
assertEquals("Root Tool", topCategory.getName());
|
||||||
options = topCategory.getOptions(null);
|
options = topCategory.getOptions(null);
|
||||||
assertEquals(1, options.length);
|
assertEquals(2, options.length);
|
||||||
assertEquals("Option in Top", options[0].getName());
|
assertEquals("List Option in Top", options[0].getName());
|
||||||
|
assertEquals("Boolean Option in Top", options[1].getName());
|
||||||
IOptionCategory[] categories = topCategory.getChildCategories();
|
IOptionCategory[] categories = topCategory.getChildCategories();
|
||||||
assertEquals(1, categories.length);
|
assertEquals(1, categories.length);
|
||||||
assertEquals("Category", categories[0].getName());
|
assertEquals("Category", categories[0].getName());
|
||||||
options = categories[0].getOptions(null);
|
options = categories[0].getOptions(null);
|
||||||
assertEquals(1, options.length);
|
assertEquals(2, options.length);
|
||||||
assertEquals("Option in Category", options[0].getName());
|
assertEquals("String Option in Category", options[0].getName());
|
||||||
|
assertEquals("Enumerated Option in Category", options[1].getName());
|
||||||
|
|
||||||
// Configs
|
// Configs
|
||||||
IConfiguration[] configs = target.getConfigurations();
|
IConfiguration[] configs = target.getConfigurations();
|
||||||
|
@ -205,15 +229,18 @@ public class AllBuildTests extends TestCase {
|
||||||
assertEquals("Root Tool", tools[0].getName());
|
assertEquals("Root Tool", tools[0].getName());
|
||||||
topCategory = tools[0].getTopOptionCategory();
|
topCategory = tools[0].getTopOptionCategory();
|
||||||
options = topCategory.getOptions(configs[0]);
|
options = topCategory.getOptions(configs[0]);
|
||||||
assertEquals(1, options.length);
|
assertEquals(2, options.length);
|
||||||
assertEquals("Option in Top", options[0].getName());
|
assertEquals("List Option in Top", options[0].getName());
|
||||||
valueList = options[0].getStringListValue();
|
valueList = options[0].getStringListValue();
|
||||||
assertEquals("a", valueList[0]);
|
assertEquals("a", valueList[0]);
|
||||||
assertEquals("b", valueList[1]);
|
assertEquals("b", valueList[1]);
|
||||||
|
assertEquals("Boolean Option in Top", options[1].getName());
|
||||||
categories = topCategory.getChildCategories();
|
categories = topCategory.getChildCategories();
|
||||||
options = categories[0].getOptions(configs[0]);
|
options = categories[0].getOptions(configs[0]);
|
||||||
assertEquals("Option in Category", options[0].getName());
|
assertEquals(2, options.length);
|
||||||
|
assertEquals("String Option in Category", options[0].getName());
|
||||||
assertEquals(oicValue, options[0].getStringValue());
|
assertEquals(oicValue, options[0].getStringValue());
|
||||||
|
assertEquals("Enumerated Option in Category", options[1].getName());
|
||||||
// Root Override Config
|
// Root Override Config
|
||||||
assertEquals("Root Override Config", configs[1].getName());
|
assertEquals("Root Override Config", configs[1].getName());
|
||||||
tools = configs[1].getTools();
|
tools = configs[1].getTools();
|
||||||
|
@ -222,15 +249,24 @@ public class AllBuildTests extends TestCase {
|
||||||
assertEquals("Root Tool", tools[0].getName());
|
assertEquals("Root Tool", tools[0].getName());
|
||||||
topCategory = tools[0].getTopOptionCategory();
|
topCategory = tools[0].getTopOptionCategory();
|
||||||
options = topCategory.getOptions(configs[1]);
|
options = topCategory.getOptions(configs[1]);
|
||||||
assertEquals(1, options.length);
|
assertEquals(2, options.length);
|
||||||
assertEquals("Option in Top", options[0].getName());
|
assertEquals("List Option in Top", options[0].getName());
|
||||||
valueList = options[0].getStringListValue();
|
valueList = options[0].getStringListValue();
|
||||||
assertEquals("a", valueList[0]);
|
assertEquals("a", valueList[0]);
|
||||||
assertEquals("b", valueList[1]);
|
assertEquals("b", valueList[1]);
|
||||||
|
assertEquals("Boolean Option in Top", options[1].getName());
|
||||||
categories = topCategory.getChildCategories();
|
categories = topCategory.getChildCategories();
|
||||||
options = categories[0].getOptions(configs[1]);
|
options = categories[0].getOptions(configs[1]);
|
||||||
assertEquals("Option in Category", options[0].getName());
|
assertEquals(2, options.length);
|
||||||
|
assertEquals("String Option in Category", options[0].getName());
|
||||||
assertEquals("y", options[0].getStringValue());
|
assertEquals("y", options[0].getStringValue());
|
||||||
|
assertEquals("Enumerated Option in Category", options[1].getName());
|
||||||
|
valueList = options[1].getApplicableValues();
|
||||||
|
assertEquals(2, valueList.length);
|
||||||
|
assertEquals("Default Enum", valueList[0]);
|
||||||
|
assertEquals("Another Enum", valueList[1]);
|
||||||
|
assertEquals("-e1", options[1].getEnumCommand(valueList[0]));
|
||||||
|
assertEquals("-e2", options[1].getEnumCommand(valueList[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,8 @@
|
||||||
id="category">
|
id="category">
|
||||||
</optionCategory>
|
</optionCategory>
|
||||||
<option
|
<option
|
||||||
name="Option in Top"
|
name="List Option in Top"
|
||||||
|
command="-L"
|
||||||
valueType="stringList"
|
valueType="stringList"
|
||||||
id="topOption">
|
id="topOption">
|
||||||
<optionValue
|
<optionValue
|
||||||
|
@ -116,12 +117,38 @@
|
||||||
</optionValue>
|
</optionValue>
|
||||||
</option>
|
</option>
|
||||||
<option
|
<option
|
||||||
name="Option in Category"
|
defaultValue="false"
|
||||||
|
name="Boolean Option in Top"
|
||||||
|
command="-b"
|
||||||
|
valueType="boolean"
|
||||||
|
id="topBoolOption">
|
||||||
|
</option>
|
||||||
|
<option
|
||||||
|
defaultValue="x"
|
||||||
|
name="String Option in Category"
|
||||||
category="category"
|
category="category"
|
||||||
value="x"
|
|
||||||
valueType="string"
|
valueType="string"
|
||||||
id="childOption">
|
id="childOption">
|
||||||
</option>
|
</option>
|
||||||
|
<option
|
||||||
|
name="Enumerated Option in Category"
|
||||||
|
category="category"
|
||||||
|
valueType="enumerated"
|
||||||
|
id="child.enumerated.option">
|
||||||
|
<optionEnum
|
||||||
|
name="Default Enum"
|
||||||
|
value="s"
|
||||||
|
isDefault="true"
|
||||||
|
command="-e1"
|
||||||
|
id="default.enum.option">
|
||||||
|
</optionEnum>
|
||||||
|
<optionEnum
|
||||||
|
name="Another Enum"
|
||||||
|
value="t"
|
||||||
|
command="-e2"
|
||||||
|
id="another.enum.option">
|
||||||
|
</optionEnum>
|
||||||
|
</option>
|
||||||
</tool>
|
</tool>
|
||||||
<configuration
|
<configuration
|
||||||
name="Root Config"
|
name="Root Config"
|
||||||
|
@ -133,6 +160,7 @@
|
||||||
<toolRef
|
<toolRef
|
||||||
id="root.tool">
|
id="root.tool">
|
||||||
<optionRef
|
<optionRef
|
||||||
|
defaultValue="y"
|
||||||
value="y"
|
value="y"
|
||||||
id="childOption">
|
id="childOption">
|
||||||
</optionRef>
|
</optionRef>
|
||||||
|
|
Loading…
Add table
Reference in a new issue