1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-11 18:25:40 +02:00

Patch for Sean Evoy:

Two of the fixes, 43614 and 43756, involved changing property files only, 
which validates the extra work of externalizing strings from the start!

For 43616, I simply took the advice of the bug reporter and added the '-' 
in front of the RM macro in the clean target and the include directives in 
the makefile.

The largest part of the fix involves 43220. Until just now, this was a 
critical bug in bugzilla, so I addressed it. It has just been downgraded 
to an enhancement request. There is now a new entry widget in the linker 
options for user objects. The makefile will simply add these to the final 
build target's command. Most of the work was done in the plugin file and 
the build model to handle the new "type" of option.
This commit is contained in:
Doug Schaefer 2003-09-26 19:54:33 +00:00
parent a3a827cf92
commit dcbbea5b74
17 changed files with 570 additions and 257 deletions

View file

@ -1,2 +1,5 @@
pluginName=C/C++ Managed Builder Core pluginName=C/C++ Managed Builder Core
providerName=Eclipse.org providerName=Eclipse.org
GeneratedMakefileCBuilder.name=Generated Makefile Builder
ManagedBuildNature.name=Managed Builder Project

View file

@ -144,7 +144,7 @@
<documentation> <documentation>
General options can be one of the following types; &apos;string&apos; for catch-all entries for options that cannot be easily defined any other way, &apos;string list&apos; for entries that consist of a list of values such as defined symbols or paths, &apos;boolean&apos; for options that have two values, and &apos;enumerated&apos; for options that are one-of a list of values. General options can be one of the following types; &apos;string&apos; for catch-all entries for options that cannot be easily defined any other way, &apos;string list&apos; for entries that consist of a list of values such as defined symbols or paths, &apos;boolean&apos; for options that have two values, and &apos;enumerated&apos; for options that are one-of a list of values.
Two additional types exist to flag options of special relevance to the build model; &apos;include&apos;, and &apos;definedSymbols&apos;. You can pre-populate with optionValues, and they will display in the UI the same way the &apos;StringList&apos; options do. The build model will look specifically for these value types when clients query for include paths and preprocessor defines. Additional special types exist to flag options of special relevance to the build model; &apos;include&apos;, &apos;libs&apos;, &apos;userObjs&apos; and &apos;definedSymbols&apos;. You can pre-populate with optionValues, and they will display in the UI the same way the &apos;stringList&apos; options do. The build model will look specifically for these value types when clients query for include paths and preprocessor defines. The makefile generator will treat the libs and userObjs entries differently than other stringLists.
</documentation> </documentation>
</annotation> </annotation>
<simpleType> <simpleType>
@ -163,6 +163,8 @@ Two additional types exist to flag options of special relevance to the build mod
</enumeration> </enumeration>
<enumeration value="libs"> <enumeration value="libs">
</enumeration> </enumeration>
<enumeration value="userObjs">
</enumeration>
</restriction> </restriction>
</simpleType> </simpleType>
</attribute> </attribute>

View file

@ -182,6 +182,12 @@ public interface IManagedBuildInfo {
*/ */
public String getToolForTarget(String extension); public String getToolForTarget(String extension);
/**
* @param extension
* @return
*/
public String[] getUserObjectsForTarget(String extension);
/** /**
* Answers true if the build model has been changed by the user. * Answers true if the build model has been changed by the user.
* *

View file

@ -22,6 +22,7 @@ public interface IOption extends IBuildObject {
public static final int INCLUDE_PATH = 4; public static final int INCLUDE_PATH = 4;
public static final int PREPROCESSOR_SYMBOLS = 5; public static final int PREPROCESSOR_SYMBOLS = 5;
public static final int LIBRARIES = 6; public static final int LIBRARIES = 6;
public static final int OBJECTS = 7;
// Schema attribute names for option elements // Schema attribute names for option elements
public static final String CATEGORY = "category"; public static final String CATEGORY = "category";
@ -36,6 +37,7 @@ public interface IOption extends IBuildObject {
public static final String TYPE_LIB = "libs"; public static final String TYPE_LIB = "libs";
public static final String TYPE_STRING = "string"; public static final String TYPE_STRING = "string";
public static final String TYPE_STR_LIST = "stringList"; public static final String TYPE_STR_LIST = "stringList";
public static final String TYPE_USER_OBJS = "userObjs";
public static final String VALUE_TYPE = "valueType"; public static final String VALUE_TYPE = "valueType";
// Schema attribute names for listOptionValue elements // Schema attribute names for listOptionValue elements
@ -48,14 +50,15 @@ public interface IOption extends IBuildObject {
* the list of possible values for that enum. * the list of possible values for that enum.
* *
* If this option is not defined as an enumeration, it returns <code>null</code>. * If this option is not defined as an enumeration, it returns <code>null</code>.
* @return *
* @return String []
*/ */
public String [] getApplicableValues(); public String [] getApplicableValues();
/** /**
* Answers the value for a boolean option. * Answers the value for a boolean option.
* *
* @return * @return boolean
* @throws BuildException * @throws BuildException
*/ */
public boolean getBooleanValue() throws BuildException; public boolean getBooleanValue() throws BuildException;
@ -66,14 +69,14 @@ public interface IOption extends IBuildObject {
* option. If none have been defined, the array will be empty but * option. If none have been defined, the array will be empty but
* never <code>null</code>. * never <code>null</code>.
* *
* @return * @return String[]
*/ */
public String[] getBuiltIns(); public String[] getBuiltIns();
/** /**
* Returns the category for this option. * Returns the category for this option.
* *
* @return * @return IOptionCategory
*/ */
public IOptionCategory getCategory(); public IOptionCategory getCategory();
@ -81,12 +84,14 @@ public interface IOption extends IBuildObject {
* Answers a <code>String</code> containing the actual command line * Answers a <code>String</code> containing the actual command line
* option associated with the option * option associated with the option
* *
* @return * @return String
*/ */
public String getCommand(); public String getCommand();
/** /**
* @return * Answers the user-defined preprocessor symbols.
*
* @return String[]
* @throws BuildException * @throws BuildException
*/ */
public String[] getDefinedSymbols() throws BuildException; public String[] getDefinedSymbols() throws BuildException;
@ -105,7 +110,7 @@ public interface IOption extends IBuildObject {
* Answers an array of <code>String</code> containing the includes paths * Answers an array of <code>String</code> containing the includes paths
* defined in the build model. * defined in the build model.
* *
* @return * @return String[]
* @throws BuildException * @throws BuildException
*/ */
public String[] getIncludePaths() throws BuildException; public String[] getIncludePaths() throws BuildException;
@ -114,7 +119,9 @@ public interface IOption extends IBuildObject {
/** /**
* Answers an array or <code>String</code>s containing the libraries * Answers an array or <code>String</code>s containing the libraries
* that must be linked into the project. * that must be linked into the project.
* @return *
* @return String[]
* @throws BuildException
*/ */
public String[] getLibraries() throws BuildException ; public String[] getLibraries() throws BuildException ;
@ -125,7 +132,7 @@ public interface IOption extends IBuildObject {
* If the user has modified the selection, the receiver will answer with the * If the user has modified the selection, the receiver will answer with the
* overridden selection. * overridden selection.
* *
* @return * @return String
* @throws BuildException * @throws BuildException
*/ */
public String getSelectedEnum () throws BuildException; public String getSelectedEnum () throws BuildException;
@ -133,7 +140,7 @@ public interface IOption extends IBuildObject {
/** /**
* 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.
* *
* @return * @return String []
* @throws BuildException * @throws BuildException
*/ */
public String [] getStringListValue() throws BuildException; public String [] getStringListValue() throws BuildException;
@ -141,7 +148,7 @@ public interface IOption extends IBuildObject {
/** /**
* Returns the current value for this option if it is a String * Returns the current value for this option if it is a String
* *
* @return * @return String
* @throws BuildException * @throws BuildException
*/ */
public String getStringValue() throws BuildException; public String getStringValue() throws BuildException;
@ -149,14 +156,24 @@ public interface IOption extends IBuildObject {
/** /**
* Returns the tool defining this option. * Returns the tool defining this option.
* *
* @return * @return ITool
*/ */
public ITool getTool(); public ITool getTool();
/**
* Answers all of the user-defined object files that must be linked with
* the final build target.
*
* @return
* @throws BuildException
*/
public String [] getUserObjects() throws BuildException;
/** /**
* Get the type for the value of the option. * Get the type for the value of the option.
* *
* @return * @return int
*/ */
public int getValueType(); public int getValueType();

View file

@ -329,6 +329,15 @@ public class MakefileGenerator {
} }
buffer.append(NEWLINE + NEWLINE); buffer.append(NEWLINE + NEWLINE);
// Add the extra user-specified objects
buffer.append("USER_OBJS := ");
String[] userObjs = info.getUserObjectsForTarget(extension);
for (int j = 0; j < userObjs.length; j++) {
String string = userObjs[j];
buffer.append(LINEBREAK + NEWLINE + string);
}
buffer.append(NEWLINE + NEWLINE);
buffer.append("OBJS = $(C_SRCS:$(ROOT)/%.c=%.o) $(CC_SRCS:$(ROOT)/%.cc=%.o) $(CXX_SRCS:$(ROOT)/%.cxx=%.o) $(CAPC_SRCS:$(ROOT)/%.C=%.o) $(CPP_SRCS:$(ROOT)/%.cpp=%.o)" + NEWLINE); buffer.append("OBJS = $(C_SRCS:$(ROOT)/%.c=%.o) $(CC_SRCS:$(ROOT)/%.cc=%.o) $(CXX_SRCS:$(ROOT)/%.cxx=%.o) $(CAPC_SRCS:$(ROOT)/%.C=%.o) $(CPP_SRCS:$(ROOT)/%.cpp=%.o)" + NEWLINE);
return (buffer.append(NEWLINE)); return (buffer.append(NEWLINE));
} }
@ -336,11 +345,11 @@ public class MakefileGenerator {
/* (non-javadoc) /* (non-javadoc)
* @return * @return
*/ */
protected StringBuffer addModules() { protected StringBuffer addSubdirectories() {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
// Add the comment // Add the comment
buffer.append(ManagedBuilderCorePlugin.getResourceString(MOD_LIST) + NEWLINE); buffer.append(ManagedBuilderCorePlugin.getResourceString(MOD_LIST) + NEWLINE);
buffer.append("MODULES := " + LINEBREAK + NEWLINE); buffer.append("SUBDIRS := " + LINEBREAK + NEWLINE);
// Get all the module names // Get all the module names
ListIterator iter = getSubdirList().listIterator(); ListIterator iter = getSubdirList().listIterator();
@ -358,7 +367,7 @@ public class MakefileGenerator {
// Now add the makefile instruction to include all the subdirectory makefile fragments // Now add the makefile instruction to include all the subdirectory makefile fragments
buffer.append(NEWLINE); buffer.append(NEWLINE);
buffer.append(ManagedBuilderCorePlugin.getResourceString(MOD_INCL) + NEWLINE); buffer.append(ManagedBuilderCorePlugin.getResourceString(MOD_INCL) + NEWLINE);
buffer.append("include ${patsubst %, %/module.mk, $(MODULES)}" + NEWLINE); buffer.append("-include ${patsubst %, %/module.mk, $(SUBDIRS)}" + NEWLINE);
buffer.append(NEWLINE + NEWLINE); buffer.append(NEWLINE + NEWLINE);
return buffer; return buffer;
@ -487,7 +496,7 @@ public class MakefileGenerator {
/* /*
* Write out the target rule as: * Write out the target rule as:
* <prefix><target>.<extension>: $(OBJS) [<dep_proj_1_output> ... <dep_proj_n_output>] * <prefix><target>.<extension>: $(OBJS) [<dep_proj_1_output> ... <dep_proj_n_output>]
* $(BUILD_TOOL) $(FLAGS) $(OUTPUT_FLAG) $@ $^ $(LIB_DEPS) * $(BUILD_TOOL) $(FLAGS) $(OUTPUT_FLAG) $@ $(OBJS) $(USER_OBJS) $(LIB_DEPS)
*/ */
// //
buffer.append(outputPrefix + target + COLON + WHITESPACE + "$(OBJS)"); buffer.append(outputPrefix + target + COLON + WHITESPACE + "$(OBJS)");
@ -496,17 +505,17 @@ public class MakefileGenerator {
buffer.append(WHITESPACE + (String)iter.next()); buffer.append(WHITESPACE + (String)iter.next());
} }
buffer.append(NEWLINE); buffer.append(NEWLINE);
buffer.append(TAB + cmd + WHITESPACE + flags + WHITESPACE + outflag + WHITESPACE + "$@" + WHITESPACE + "$(OBJS) $(LIBS)"); buffer.append(TAB + cmd + WHITESPACE + flags + WHITESPACE + outflag + WHITESPACE + "$@" + WHITESPACE + "$(OBJS) $(USER_OBJS) $(LIBS)");
buffer.append(NEWLINE + NEWLINE); buffer.append(NEWLINE + NEWLINE);
// Always add a clean target // Always add a clean target
buffer.append("clean:" + NEWLINE); buffer.append("clean:" + NEWLINE);
buffer.append(TAB + "$(RM)" + WHITESPACE + "$(OBJS)" + WHITESPACE + outputPrefix + target + NEWLINE + NEWLINE); buffer.append(TAB + "-$(RM)" + WHITESPACE + "$(OBJS)" + WHITESPACE + outputPrefix + target + NEWLINE + NEWLINE);
buffer.append(".PHONY: all clean deps" + NEWLINE + NEWLINE); buffer.append(".PHONY: all clean deps" + NEWLINE + NEWLINE);
buffer.append(ManagedBuilderCorePlugin.getResourceString(DEP_INCL) + NEWLINE); buffer.append(ManagedBuilderCorePlugin.getResourceString(DEP_INCL) + NEWLINE);
buffer.append("include ${patsubst %, %/module.dep, $(MODULES)}" + NEWLINE); buffer.append("-include ${patsubst %, %/module.dep, $(SUBDIRS)}" + NEWLINE);
return buffer; return buffer;
} }
@ -807,7 +816,7 @@ public class MakefileGenerator {
buffer.append(addMacros()); buffer.append(addMacros());
// Append the module list // Append the module list
buffer.append(addModules()); buffer.append(addSubdirectories());
// Add targets // Add targets
buffer.append(addTargets(rebuild)); buffer.append(addTargets(rebuild));

View file

@ -475,6 +475,35 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
return null; return null;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#getUserObjectsForTarget(java.lang.String)
*/
public String[] getUserObjectsForTarget(String extension) {
ArrayList objs = new ArrayList();
// Get all the tools for the current config
IConfiguration config = getDefaultConfiguration(getDefaultTarget());
ITool[] tools = config.getTools();
for (int index = 0; index < tools.length; index++) {
ITool tool = tools[index];
if (tool.producesFileType(extension)) {
IOption[] opts = tool.getOptions();
// Look for the user object option type
for (int i = 0; i < opts.length; i++) {
IOption option = opts[i];
if (option.getValueType() == IOption.OBJECTS) {
try {
objs.addAll(Arrays.asList(option.getUserObjects()));
} catch (BuildException e) {
continue;
}
}
}
}
}
objs.trimToSize();
return (String[])objs.toArray(new String[objs.size()]);
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#isDirty() * @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#isDirty()
*/ */

View file

@ -22,9 +22,6 @@ import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IConfigurationElement;
/**
*
*/
public class Option extends BuildObject implements IOption { public class Option extends BuildObject implements IOption {
// Static default return values // Static default return values
private static final String EMPTY_STRING = new String(); private static final String EMPTY_STRING = new String();
@ -49,82 +46,85 @@ public class Option extends BuildObject implements IOption {
this(tool); this(tool);
// Get the unique id of the option // Get the unique id of the option
setId(element.getAttribute(IOption.ID)); setId(element.getAttribute(ID));
// Hook me up to a tool // Hook me up to a tool
tool.addOption(this); tool.addOption(this);
// Get the option Name (this is what the user will see in the UI) // Get the option Name (this is what the user will see in the UI)
setName(element.getAttribute(IOption.NAME)); setName(element.getAttribute(NAME));
// Options can be grouped into categories // Options can be grouped into categories
String categoryId = element.getAttribute(IOption.CATEGORY); String categoryId = element.getAttribute(CATEGORY);
if (categoryId != null) if (categoryId != null)
setCategory(tool.getOptionCategory(categoryId)); setCategory(tool.getOptionCategory(categoryId));
// Get the command defined for the option // Get the command defined for the option
command = element.getAttribute(IOption.COMMAND); command = element.getAttribute(COMMAND);
// Options hold different types of values // Options hold different types of values
String valueTypeStr = element.getAttribute(IOption.VALUE_TYPE); String valueTypeStr = element.getAttribute(VALUE_TYPE);
if (valueTypeStr == null) if (valueTypeStr == null)
valueType = -1; valueType = -1;
else if (valueTypeStr.equals(IOption.TYPE_STRING)) else if (valueTypeStr.equals(TYPE_STRING))
valueType = IOption.STRING; valueType = STRING;
else if (valueTypeStr.equals(IOption.TYPE_STR_LIST)) else if (valueTypeStr.equals(TYPE_STR_LIST))
valueType = IOption.STRING_LIST; valueType = STRING_LIST;
else if (valueTypeStr.equals(IOption.TYPE_BOOL)) else if (valueTypeStr.equals(TYPE_BOOL))
valueType = IOption.BOOLEAN; valueType = BOOLEAN;
else if (valueTypeStr.equals(IOption.TYPE_ENUM)) else if (valueTypeStr.equals(TYPE_ENUM))
valueType = IOption.ENUMERATED; valueType = ENUMERATED;
else if (valueTypeStr.equals(IOption.TYPE_INC_PATH)) else if (valueTypeStr.equals(TYPE_INC_PATH))
valueType = IOption.INCLUDE_PATH; valueType = INCLUDE_PATH;
else if (valueTypeStr.equals(IOption.TYPE_LIB)) else if (valueTypeStr.equals(TYPE_LIB))
valueType = IOption.LIBRARIES; valueType = LIBRARIES;
else if (valueTypeStr.equals(TYPE_USER_OBJS))
valueType = OBJECTS;
else else
valueType = IOption.PREPROCESSOR_SYMBOLS; valueType = PREPROCESSOR_SYMBOLS;
// Now get the actual value // Now get the actual value
enumCommands = new HashMap(); enumCommands = new HashMap();
switch (valueType) { switch (valueType) {
case IOption.BOOLEAN: case BOOLEAN:
// Convert the string to a boolean // Convert the string to a boolean
value = new Boolean(element.getAttribute(IOption.DEFAULT_VALUE)); value = new Boolean(element.getAttribute(DEFAULT_VALUE));
break; break;
case IOption.STRING: case STRING:
// Just get the value out of the option directly // Just get the value out of the option directly
value = element.getAttribute(IOption.DEFAULT_VALUE); value = element.getAttribute(DEFAULT_VALUE);
break; break;
case IOption.ENUMERATED: case ENUMERATED:
List enumList = new ArrayList(); List enumList = new ArrayList();
IConfigurationElement[] enumElements = element.getChildren(IOption.ENUM_VALUE); IConfigurationElement[] enumElements = element.getChildren(ENUM_VALUE);
for (int i = 0; i < enumElements.length; ++i) { for (int i = 0; i < enumElements.length; ++i) {
String optName = enumElements[i].getAttribute(IOption.NAME); String optName = enumElements[i].getAttribute(NAME);
String optCommand = enumElements[i].getAttribute(IOption.COMMAND); String optCommand = enumElements[i].getAttribute(COMMAND);
enumList.add(optName); enumList.add(optName);
enumCommands.put(optName, optCommand); enumCommands.put(optName, optCommand);
Boolean isDefault = new Boolean(enumElements[i].getAttribute(IOption.IS_DEFAULT)); Boolean isDefault = new Boolean(enumElements[i].getAttribute(IS_DEFAULT));
if (isDefault.booleanValue()) { if (isDefault.booleanValue()) {
defaultEnumName = optName; defaultEnumName = optName;
} }
} }
value = enumList; value = enumList;
break; break;
case IOption.STRING_LIST: case STRING_LIST:
case IOption.INCLUDE_PATH: case INCLUDE_PATH:
case IOption.PREPROCESSOR_SYMBOLS: case PREPROCESSOR_SYMBOLS:
case IOption.LIBRARIES: case LIBRARIES:
case OBJECTS:
List valueList = new ArrayList(); List valueList = new ArrayList();
builtIns = new ArrayList(); builtIns = new ArrayList();
IConfigurationElement[] valueElements = element.getChildren(IOption.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(IOption.LIST_ITEM_BUILTIN)); Boolean isBuiltIn = new Boolean(valueElement.getAttribute(LIST_ITEM_BUILTIN));
if (isBuiltIn.booleanValue()) { if (isBuiltIn.booleanValue()) {
builtIns.add(valueElement.getAttribute(IOption.LIST_ITEM_VALUE)); builtIns.add(valueElement.getAttribute(LIST_ITEM_VALUE));
} }
else { else {
valueList.add(valueElement.getAttribute(IOption.LIST_ITEM_VALUE)); valueList.add(valueElement.getAttribute(LIST_ITEM_VALUE));
} }
} }
value = valueList; value = valueList;
@ -177,7 +177,7 @@ public class Option extends BuildObject implements IOption {
* @see org.eclipse.cdt.core.build.managed.IOption#getDefinedSymbols() * @see org.eclipse.cdt.core.build.managed.IOption#getDefinedSymbols()
*/ */
public String[] getDefinedSymbols() throws BuildException { public String[] getDefinedSymbols() throws BuildException {
if (valueType != IOption.PREPROCESSOR_SYMBOLS) { if (valueType != PREPROCESSOR_SYMBOLS) {
throw new BuildException("bad value type"); throw new BuildException("bad value type");
} }
List v = (List)value; List v = (List)value;
@ -198,7 +198,7 @@ public class Option extends BuildObject implements IOption {
* @see org.eclipse.cdt.core.build.managed.IOption#getIncludePaths() * @see org.eclipse.cdt.core.build.managed.IOption#getIncludePaths()
*/ */
public String[] getIncludePaths() throws BuildException { public String[] getIncludePaths() throws BuildException {
if (valueType != IOption.INCLUDE_PATH) { if (valueType != INCLUDE_PATH) {
throw new BuildException("bad value type"); throw new BuildException("bad value type");
} }
List v = (List)value; List v = (List)value;
@ -211,7 +211,7 @@ public class Option extends BuildObject implements IOption {
* @see org.eclipse.cdt.core.build.managed.IOption#getLibraries() * @see org.eclipse.cdt.core.build.managed.IOption#getLibraries()
*/ */
public String[] getLibraries() throws BuildException { public String[] getLibraries() throws BuildException {
if (valueType != IOption.LIBRARIES) { if (valueType != LIBRARIES) {
throw new BuildException("bad value type"); throw new BuildException("bad value type");
} }
List v = (List)value; List v = (List)value;
@ -224,7 +224,7 @@ public class Option extends BuildObject implements IOption {
* @see org.eclipse.cdt.core.build.managed.IOption#getDefaultEnumValue() * @see org.eclipse.cdt.core.build.managed.IOption#getDefaultEnumValue()
*/ */
public String getSelectedEnum() throws BuildException { public String getSelectedEnum() throws BuildException {
if (valueType != IOption.ENUMERATED) { if (valueType != ENUMERATED) {
throw new BuildException("bad value type"); throw new BuildException("bad value type");
} }
return defaultEnumName == null ? EMPTY_STRING : defaultEnumName; return defaultEnumName == null ? EMPTY_STRING : defaultEnumName;
@ -234,7 +234,7 @@ public class Option extends BuildObject implements IOption {
* @see org.eclipse.cdt.core.build.managed.IOption#getStringListValue() * @see org.eclipse.cdt.core.build.managed.IOption#getStringListValue()
*/ */
public String[] getStringListValue() throws BuildException { public String[] getStringListValue() throws BuildException {
if (valueType != IOption.STRING_LIST) { if (valueType != STRING_LIST) {
throw new BuildException("bad value type"); throw new BuildException("bad value type");
} }
List v = (List)value; List v = (List)value;
@ -247,7 +247,7 @@ public class Option extends BuildObject implements IOption {
* @see org.eclipse.cdt.core.build.managed.IOption#getStringValue() * @see org.eclipse.cdt.core.build.managed.IOption#getStringValue()
*/ */
public String getStringValue() throws BuildException { public String getStringValue() throws BuildException {
if (valueType != IOption.STRING) { if (valueType != STRING) {
throw new BuildException("bad value type"); throw new BuildException("bad value type");
} }
return value == null ? EMPTY_STRING : (String)value; return value == null ? EMPTY_STRING : (String)value;
@ -260,6 +260,20 @@ public class Option extends BuildObject implements IOption {
return tool; return tool;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IOption#getUserObjects()
*/
public String[] getUserObjects() throws BuildException {
if (valueType != OBJECTS) {
throw new BuildException("bad value type");
}
// This is the right puppy, so return its list value
List v = (List)value;
return v != null
? (String[])v.toArray(new String[v.size()])
: EMPTY_STRING_ARRAY;
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getValueType() * @see org.eclipse.cdt.core.build.managed.IOption#getValueType()
*/ */
@ -281,7 +295,7 @@ public class Option extends BuildObject implements IOption {
throws BuildException throws BuildException
{ {
if (valueType != IOption.STRING if (valueType != IOption.STRING
|| valueType != IOption.ENUMERATED) || valueType != ENUMERATED)
throw new BuildException("Bad value for type"); throw new BuildException("Bad value for type");
if (config == null) { if (config == null) {
@ -299,10 +313,11 @@ public class Option extends BuildObject implements IOption {
public IOption setValue(IConfiguration config, String[] value) public IOption setValue(IConfiguration config, String[] value)
throws BuildException throws BuildException
{ {
if (valueType != IOption.STRING_LIST if (valueType != STRING_LIST
|| valueType != IOption.INCLUDE_PATH || valueType != INCLUDE_PATH
|| valueType != IOption.PREPROCESSOR_SYMBOLS || valueType != PREPROCESSOR_SYMBOLS
|| valueType != IOption.LIBRARIES) || valueType != LIBRARIES
|| valueType != OBJECTS)
throw new BuildException("Bad value for type"); throw new BuildException("Bad value for type");
if (config == null) { if (config == null) {

View file

@ -42,7 +42,8 @@ public class OptionReference implements IOption {
private Object value; private Object value;
/** /**
* Created internally. * Constructor called when the option reference is created from an
* existing <code>IOption</code>
* *
* @param owner * @param owner
* @param option * @param option
@ -56,26 +57,27 @@ public class OptionReference implements IOption {
} }
/** /**
* Created from extension point. * This constructor will be called when the receiver is created from
* the settings found in an extension point.
* *
* @param owner * @param owner
* @param element * @param element
*/ */
public OptionReference(ToolReference owner, IConfigurationElement element) { public OptionReference(ToolReference owner, IConfigurationElement element) {
this.owner = owner; this.owner = owner;
option = owner.getTool().getOption(element.getAttribute(IOption.ID)); option = owner.getTool().getOption(element.getAttribute(ID));
owner.addOptionReference(this); owner.addOptionReference(this);
// value // value
switch (option.getValueType()) { switch (option.getValueType()) {
case IOption.BOOLEAN: case BOOLEAN:
value = new Boolean(element.getAttribute(IOption.DEFAULT_VALUE)); value = new Boolean(element.getAttribute(DEFAULT_VALUE));
break; break;
case IOption.STRING: case STRING:
value = element.getAttribute(IOption.DEFAULT_VALUE); value = element.getAttribute(DEFAULT_VALUE);
break; break;
case IOption.ENUMERATED: case ENUMERATED:
String temp = element.getAttribute(DEFAULT_VALUE); String temp = element.getAttribute(DEFAULT_VALUE);
if (temp == null) { if (temp == null) {
try { try {
@ -86,21 +88,22 @@ public class OptionReference implements IOption {
} }
value = temp; value = temp;
break; break;
case IOption.STRING_LIST: case STRING_LIST:
case IOption.INCLUDE_PATH: case INCLUDE_PATH:
case IOption.PREPROCESSOR_SYMBOLS: case PREPROCESSOR_SYMBOLS:
case IOption.LIBRARIES: case LIBRARIES:
case OBJECTS:
List valueList = new ArrayList(); List valueList = new ArrayList();
builtIns = new ArrayList(); builtIns = new ArrayList();
IConfigurationElement[] valueElements = element.getChildren(IOption.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(IOption.LIST_ITEM_BUILTIN)); Boolean isBuiltIn = new Boolean(valueElement.getAttribute(LIST_ITEM_BUILTIN));
if (isBuiltIn.booleanValue()) { if (isBuiltIn.booleanValue()) {
builtIns.add(valueElement.getAttribute(IOption.LIST_ITEM_VALUE)); builtIns.add(valueElement.getAttribute(LIST_ITEM_VALUE));
} }
else { else {
valueList.add(valueElement.getAttribute(IOption.LIST_ITEM_VALUE)); valueList.add(valueElement.getAttribute(LIST_ITEM_VALUE));
} } } }
value = valueList; value = valueList;
break; break;
@ -115,34 +118,35 @@ public class OptionReference implements IOption {
*/ */
public OptionReference(ToolReference owner, Element element) { public OptionReference(ToolReference owner, Element element) {
this.owner = owner; this.owner = owner;
option = owner.getTool().getOption(element.getAttribute(IOption.ID)); option = owner.getTool().getOption(element.getAttribute(ID));
owner.addOptionReference(this); owner.addOptionReference(this);
// value // value
switch (option.getValueType()) { switch (option.getValueType()) {
case IOption.BOOLEAN: case BOOLEAN:
value = new Boolean(element.getAttribute(IOption.DEFAULT_VALUE)); value = new Boolean(element.getAttribute(DEFAULT_VALUE));
break; break;
case IOption.STRING: case STRING:
case IOption.ENUMERATED: case ENUMERATED:
value = (String) element.getAttribute(IOption.DEFAULT_VALUE); value = (String) element.getAttribute(DEFAULT_VALUE);
break; break;
case IOption.STRING_LIST: case STRING_LIST:
case IOption.INCLUDE_PATH: case INCLUDE_PATH:
case IOption.PREPROCESSOR_SYMBOLS: case PREPROCESSOR_SYMBOLS:
case IOption.LIBRARIES: case LIBRARIES:
case OBJECTS:
List valueList = new ArrayList(); List valueList = new ArrayList();
builtIns = new ArrayList(); builtIns = new ArrayList();
NodeList nodes = element.getElementsByTagName(IOption.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(IOption.LIST_ITEM_BUILTIN)); Boolean isBuiltIn = new Boolean(((Element)node).getAttribute(LIST_ITEM_BUILTIN));
if (isBuiltIn.booleanValue()) { if (isBuiltIn.booleanValue()) {
builtIns.add(((Element)node).getAttribute(IOption.LIST_ITEM_VALUE)); builtIns.add(((Element)node).getAttribute(LIST_ITEM_VALUE));
} else { } else {
valueList.add(((Element)node).getAttribute(IOption.LIST_ITEM_VALUE)); valueList.add(((Element)node).getAttribute(LIST_ITEM_VALUE));
} }
} }
} }
@ -159,36 +163,37 @@ public class OptionReference implements IOption {
* @param element * @param element
*/ */
public void serialize(Document doc, Element element) { public void serialize(Document doc, Element element) {
element.setAttribute(IOption.ID, option.getId()); element.setAttribute(ID, option.getId());
// value // value
switch (option.getValueType()) { switch (option.getValueType()) {
case IOption.BOOLEAN: case BOOLEAN:
element.setAttribute(IOption.DEFAULT_VALUE, ((Boolean)value).toString()); element.setAttribute(DEFAULT_VALUE, ((Boolean)value).toString());
break; break;
case IOption.STRING: case STRING:
case IOption.ENUMERATED: case ENUMERATED:
element.setAttribute(IOption.DEFAULT_VALUE, (String)value); element.setAttribute(DEFAULT_VALUE, (String)value);
break; break;
case IOption.STRING_LIST: case STRING_LIST:
case IOption.INCLUDE_PATH: case INCLUDE_PATH:
case IOption.PREPROCESSOR_SYMBOLS: case PREPROCESSOR_SYMBOLS:
case IOption.LIBRARIES: case LIBRARIES:
case OBJECTS:
ArrayList stringList = (ArrayList)value; ArrayList stringList = (ArrayList)value;
ListIterator iter = stringList.listIterator(); ListIterator iter = stringList.listIterator();
while (iter.hasNext()) { while (iter.hasNext()) {
Element valueElement = doc.createElement(IOption.LIST_VALUE); Element valueElement = doc.createElement(LIST_VALUE);
valueElement.setAttribute(IOption.LIST_ITEM_VALUE, (String)iter.next()); valueElement.setAttribute(LIST_ITEM_VALUE, (String)iter.next());
valueElement.setAttribute(IOption.LIST_ITEM_BUILTIN, "false"); valueElement.setAttribute(LIST_ITEM_BUILTIN, "false");
element.appendChild(valueElement); element.appendChild(valueElement);
} }
// Serialize the built-ins that have been overridden // Serialize the built-ins that have been overridden
if (builtIns != null) { if (builtIns != null) {
iter = builtIns.listIterator(); iter = builtIns.listIterator();
while (iter.hasNext()) { while (iter.hasNext()) {
Element valueElement = doc.createElement(IOption.LIST_VALUE); Element valueElement = doc.createElement(LIST_VALUE);
valueElement.setAttribute(IOption.LIST_ITEM_VALUE, (String)iter.next()); valueElement.setAttribute(LIST_ITEM_VALUE, (String)iter.next());
valueElement.setAttribute(IOption.LIST_ITEM_BUILTIN, "true"); valueElement.setAttribute(LIST_ITEM_BUILTIN, "true");
element.appendChild(valueElement); element.appendChild(valueElement);
} }
} }
@ -223,7 +228,7 @@ public class OptionReference implements IOption {
public String[] getDefinedSymbols() throws BuildException { public String[] getDefinedSymbols() throws BuildException {
if (value == null) if (value == null)
return option.getDefinedSymbols(); return option.getDefinedSymbols();
else if (getValueType() == IOption.PREPROCESSOR_SYMBOLS) { else if (getValueType() == PREPROCESSOR_SYMBOLS) {
ArrayList list = (ArrayList)value; ArrayList list = (ArrayList)value;
return (String[]) list.toArray(new String[list.size()]); return (String[]) list.toArray(new String[list.size()]);
} }
@ -252,7 +257,7 @@ public class OptionReference implements IOption {
public String[] getIncludePaths() throws BuildException { public String[] getIncludePaths() throws BuildException {
if (value == null) if (value == null)
return option.getIncludePaths(); return option.getIncludePaths();
else if (getValueType() == IOption.INCLUDE_PATH) { else if (getValueType() == INCLUDE_PATH) {
ArrayList list = (ArrayList)value; ArrayList list = (ArrayList)value;
return (String[]) list.toArray(new String[list.size()]); return (String[]) list.toArray(new String[list.size()]);
} }
@ -266,7 +271,7 @@ public class OptionReference implements IOption {
public String[] getLibraries() throws BuildException { public String[] getLibraries() throws BuildException {
if (value == null) if (value == null)
return option.getLibraries(); return option.getLibraries();
else if (getValueType() == IOption.LIBRARIES) { else if (getValueType() == LIBRARIES) {
ArrayList list = (ArrayList)value; ArrayList list = (ArrayList)value;
return (String[]) list.toArray(new String[list.size()]); return (String[]) list.toArray(new String[list.size()]);
} }
@ -289,7 +294,7 @@ public class OptionReference implements IOption {
if (value == null){ if (value == null){
return option.getBooleanValue(); return option.getBooleanValue();
} }
else if (getValueType() == IOption.BOOLEAN) { else if (getValueType() == BOOLEAN) {
Boolean bool = (Boolean) value; Boolean bool = (Boolean) value;
return bool.booleanValue(); return bool.booleanValue();
} else { } else {
@ -315,7 +320,7 @@ public class OptionReference implements IOption {
if (value == null) { if (value == null) {
// Return the default defined for the enumeration in the manifest. // Return the default defined for the enumeration in the manifest.
return option.getSelectedEnum(); return option.getSelectedEnum();
} else if (getValueType() == IOption.ENUMERATED) { } else if (getValueType() == ENUMERATED) {
// Value will contain the human-readable name of the enum // Value will contain the human-readable name of the enum
return (String) value; return (String) value;
} else { } else {
@ -329,7 +334,7 @@ public class OptionReference implements IOption {
public String[] getStringListValue() throws BuildException { public String[] getStringListValue() throws BuildException {
if (value == null) if (value == null)
return option.getStringListValue(); return option.getStringListValue();
else if (getValueType() == IOption.STRING_LIST) { else if (getValueType() == STRING_LIST) {
ArrayList list = (ArrayList)value; ArrayList list = (ArrayList)value;
return (String[]) list.toArray(new String[list.size()]); return (String[]) list.toArray(new String[list.size()]);
} }
@ -343,7 +348,7 @@ public class OptionReference implements IOption {
public String getStringValue() throws BuildException { public String getStringValue() throws BuildException {
if (value == null) if (value == null)
return option.getStringValue(); return option.getStringValue();
else if (getValueType() == IOption.STRING) else if (getValueType() == STRING)
return (String)value; return (String)value;
else else
throw new BuildException("bad value type"); throw new BuildException("bad value type");
@ -356,10 +361,29 @@ public class OptionReference implements IOption {
return owner; return owner;
} }
/**
* Answers the tool reference that contains the receiver.
*
* @return ToolReference
*/
public ToolReference getToolReference() { public ToolReference getToolReference() {
return owner; return owner;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IOption#getUserObjects()
*/
public String[] getUserObjects() throws BuildException {
if (value == null)
return option.getDefinedSymbols();
else if (getValueType() == OBJECTS) {
ArrayList list = (ArrayList)value;
return (String[]) list.toArray(new String[list.size()]);
}
else
throw new BuildException("bad value type");
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getValueType() * @see org.eclipse.cdt.core.build.managed.IOption#getValueType()
*/ */
@ -367,30 +391,47 @@ public class OptionReference implements IOption {
return option.getValueType(); return option.getValueType();
} }
/**
* Answers <code>true</code> if the receiver is a reference to the
* <code>IOption</code> specified in the argument, esle answers <code>false</code>.
*
* @param target
* @return boolean
*/
public boolean references(IOption target) { public boolean references(IOption target) {
if (equals(target)) if (equals(target)) {
// we are the target // we are the target
return true; return true;
else if (option instanceof OptionReference) } else if (option instanceof OptionReference) {
// check the reference we are overriding // check the reference we are overriding
return ((OptionReference)option).references(target); return ((OptionReference)option).references(target);
else } else {
// the real reference // the real reference
return option.equals(target); return option.equals(target);
} }
}
/** /**
* Sets the boolean value of the receiver to the value specified in the argument.
* If the receive is not a reference to a boolean option, method will throw an
* exception.
*
* @param value * @param value
* @throws BuildException
*/ */
public void setValue(boolean value) throws BuildException { public void setValue(boolean value) throws BuildException {
if (getValueType() == IOption.BOOLEAN) if (getValueType() == BOOLEAN)
this.value = new Boolean(value); this.value = new Boolean(value);
else else
throw new BuildException("bad value type"); throw new BuildException("bad value type");
} }
/**
* @param value
* @throws BuildException
*/
public void setValue(String value) throws BuildException { public void setValue(String value) throws BuildException {
if (getValueType() == IOption.STRING || getValueType() == IOption.ENUMERATED) if (getValueType() == STRING || getValueType() == ENUMERATED)
this.value = value; this.value = value;
else else
throw new BuildException("bad value type"); throw new BuildException("bad value type");
@ -403,14 +444,16 @@ public class OptionReference implements IOption {
* @throws BuildException * @throws BuildException
*/ */
public void setValue(String [] value) throws BuildException { public void setValue(String [] value) throws BuildException {
if (getValueType() == IOption.STRING_LIST if (getValueType() == STRING_LIST
|| getValueType() == IOption.INCLUDE_PATH || getValueType() == INCLUDE_PATH
|| getValueType() == IOption.PREPROCESSOR_SYMBOLS || getValueType() == PREPROCESSOR_SYMBOLS
|| getValueType() == IOption.LIBRARIES) { || getValueType() == LIBRARIES
|| getValueType() == OBJECTS) {
// Just replace what the option reference is holding onto // Just replace what the option reference is holding onto
this.value = new ArrayList(Arrays.asList(value)); this.value = new ArrayList(Arrays.asList(value));
} }
else else
throw new BuildException("bad value type"); throw new BuildException("bad value type");
} }
} }

View file

@ -1,3 +1,20 @@
2003-09-25 Sean Evoy
For bug (really an enhancement request)43756, I added the word default to a
widget label to try and make it clear that a new configuration will be based
on default values, not user-overridden stuff. It remains to be seen if this
actually helps, but it seems reasonable.
* src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties
For bug 43220 I now display a widget just for user objects.
* src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPage.java
* src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolsSettingsStore.java
I also reordered the plugin definition for the linker tools, and moved some of
the option labels to the plugin property file. I also added a user object option
to each linker tool definition.
* plugin.properties
* plugin.xml
2003-09-25 Sean Evoy 2003-09-25 Sean Evoy
This patch contains a lot of changes needed to implement fixes for 42648 and This patch contains a lot of changes needed to implement fixes for 42648 and
43122. 43122.

View file

@ -37,6 +37,13 @@ Option.Posix.Optimize.Most=Optimize most (-O3)
Option.Posix.Verbose=Verbose (-v) Option.Posix.Verbose=Verbose (-v)
Option.OtherFlags=Other flags Option.OtherFlags=Other flags
Option.Posix.Linker.NoStartFiles=Do not use standard start files (-nostartfiles)
Option.Posix.Linker.NoDefLibs=Do not use default libraries (-nodefaultlibs)
Option.Posix.Linker.NoStdLibs=No startup or default libs (-nostdlib)
Option.Posix.Linker.Strip=Remove symbol table (-s)
Option.Posix.Linker.Static=No shared libraries (-static)
Option.Posix.Linker.XLinker=Other options (-Xlinker [option])
Option.Posix.Linker.Flags=Linker flags Option.Posix.Linker.Flags=Linker flags
Option.Posix.Libs=Libraries (-l) Option.Posix.Libs=Libraries (-l)
Option.Posix.Libsearch=Library search path (-L) Option.Posix.Libsearch=Library search path (-L)
Option.Posix.UserObjs=Other objects

View file

@ -418,25 +418,88 @@
id="cygwin.linker.category.general"> id="cygwin.linker.category.general">
</optionCategory> </optionCategory>
<option <option
name="Linker Flags" defaultValue="false"
name="%Option.Posix.Linker.NoStartFiles"
category="cygwin.linker.category.general" category="cygwin.linker.category.general"
valueType="string" command="-nostartfiles"
id="cygwin.link.ld.flags"> valueType="boolean"
id="linux.gnu.linker.options.nostart">
</option> </option>
<option <option
name="%Option.Posix.Libs" defaultValue="false"
name="%Option.Posix.Linker.NoDefLibs"
category="cygwin.linker.category.general" category="cygwin.linker.category.general"
command="-nodefaultlibs"
valueType="boolean"
id="cygwin.gnu.linker.options.nodeflibs">
</option>
<option
defaultValue="false"
name="%Option.Posix.Linker.NoStdLibs"
category="cygwin.linker.category.general"
command="-nostdlib"
valueType="boolean"
id="cygwin.gnu.linker.options.nostdlibs">
</option>
<option
defaultValue="false"
name="%Option.Posix.Linker.Strip"
category="linux.gnu.linker.category.options"
command="-s"
valueType="boolean"
id="cygwin.gnu.linker.options.strip">
</option>
<option
defaultValue="false"
name="%Option.Posix.Linker.Static"
category="cygwin.linker.category.general"
command="-static"
valueType="boolean"
id="cygwin.gnu.linker.options.noshared">
</option>
<optionCategory
owner="org.eclipse.cdt.build.tool.cygwin.link"
name="%OptionCategory.Libs"
id="cygwin.gnu.linker.category.libs">
</optionCategory>
<option
name="%Option.Posix.Libs"
category="cygwin.gnu.linker.category.libs"
command="-l" command="-l"
valueType="libs" valueType="libs"
id="cygwin.link.libs"> id="cygwin.link.libs">
</option> </option>
<option <option
name="%Option.Posix.Libsearch" name="%Option.Posix.Libsearch"
category="cygwin.linker.category.general" category="cygwin.gnu.linker.category.libs"
command="-L" command="-L"
valueType="stringList" valueType="stringList"
id="cygwin.link.ld.paths"> id="cygwin.link.ld.paths">
</option> </option>
<optionCategory
owner="org.eclipse.cdt.build.tool.cygwin.link"
name="%OptionCategory.Misc"
id="cygwin.gnu.linker.category.other">
</optionCategory>
<option
name="Linker Flags"
category="cygwin.gnu.linker.category.other"
valueType="string"
id="cygwin.link.ld.flags">
</option>
<option
name="%Option.Posix.Linker.XLinker"
category="cygwin.gnu.linker.category.other"
command="-Xlinker"
valueType="stringList"
id="cygwin.gnu.linker.options.other">
</option>
<option
name="%Option.Posix.UserObjs"
category="cygwin.gnu.linker.category.other"
valueType="userObjs"
id="cygwin.gnu.link.ld.userobjs">
</option>
</tool> </tool>
</target> </target>
<target <target
@ -490,29 +553,84 @@
<optionCategory <optionCategory
owner="org.eclipse.cdt.build.tool.cygwin.solink" owner="org.eclipse.cdt.build.tool.cygwin.solink"
name="%OptionCategory.General" name="%OptionCategory.General"
id="cygwin.solink.category.general"> id="cygwin.gnu.solink.category.general">
</optionCategory> </optionCategory>
<option <option
defaultValue="" defaultValue="false"
name="Linker Flags" name="%Option.Posix.Linker.NoStartFiles"
category="cygwin.solink.category.general" category="cygwin.gnu.solink.category.general"
valueType="string" command="-nostartfiles"
id="cygwin.solink.ld.flags"> valueType="boolean"
id="linux.gnu.solink.options.nostart">
</option> </option>
<option
defaultValue="false"
name="%Option.Posix.Linker.NoDefLibs"
category="cygwin.gnu.solink.category.general"
command="-nodefaultlibs"
valueType="boolean"
id="cygwin.gnu.solink.options.nodeflibs">
</option>
<option
defaultValue="false"
name="%Option.Posix.Linker.NoStdLibs"
category="cygwin.gnu.solink.category.general"
command="-nostdlib"
valueType="boolean"
id="cygwin.gnu.solink.options.nostdlibs">
</option>
<option
defaultValue="false"
name="%Option.Posix.Linker.Strip"
category="cygwin.gnu.solink.category.general"
command="-s"
valueType="boolean"
id="cygwin.gnu.solink.options.strip">
</option>
<optionCategory
owner="org.eclipse.cdt.build.tool.cygwin.solink"
name="%OptionCategory.Libs"
id="cygwin.gnu.solink.category.libs">
</optionCategory>
<option <option
name="%Option.Posix.Libs" name="%Option.Posix.Libs"
category="cygwin.solink.category.general" category="cygwin.gnu.solink.category.libs"
command="-l" command="-l"
valueType="libs" valueType="libs"
id="cygwin.solink.libs"> id="cygwin.solink.libs">
</option> </option>
<option <option
name="%Option.Posix.Libsearch" name="%Option.Posix.Libsearch"
category="cygwin.solink.category.general" category="cygwin.gnu.solink.category.libs"
command="-L" command="-L"
valueType="stringList" valueType="stringList"
id="cygwin.solink.ld.paths"> id="cygwin.solink.ld.paths">
</option> </option>
<optionCategory
owner="org.eclipse.cdt.build.tool.cygwin.solink"
name="%OptionCategory.Misc"
id="cygwin.gnu.solink.category.other">
</optionCategory>
<option
defaultValue=""
name="Linker Flags"
category="cygwin.gnu.solink.category.other"
valueType="string"
id="cygwin.solink.ld.flags">
</option>
<option
name="%Option.Posix.Linker.XLinker"
category="cygwin.gnu.solink.category.other"
command="-Xlinker"
valueType="stringList"
id="cygwin.gnu.solinker.options.other">
</option>
<option
name="%Option.Posix.UserObjs"
category="cygwin.gnu.solink.category.other"
valueType="userObjs"
id="cygwin.gnu.solink.userobjs">
</option>
</tool> </tool>
</target> </target>
<target <target
@ -1002,7 +1120,7 @@
</optionCategory> </optionCategory>
<option <option
defaultValue="false" defaultValue="false"
name="Do not use standard start files (-nostartfiles)" name="%Option.Posix.Linker.NoStartFiles"
category="linux.gnu.linker.category.options" category="linux.gnu.linker.category.options"
command="-nostartfiles" command="-nostartfiles"
valueType="boolean" valueType="boolean"
@ -1010,7 +1128,7 @@
</option> </option>
<option <option
defaultValue="false" defaultValue="false"
name="Do not use default libraries (-nodefaultlibs)" name="%Option.Posix.Linker.NoDefLibs"
category="linux.gnu.linker.category.options" category="linux.gnu.linker.category.options"
command="-nodefaultlibs" command="-nodefaultlibs"
valueType="boolean" valueType="boolean"
@ -1018,7 +1136,7 @@
</option> </option>
<option <option
defaultValue="false" defaultValue="false"
name="No startup or default libs (-nostdlib)" name="%Option.Posix.Linker.NoStdLibs"
category="linux.gnu.linker.category.options" category="linux.gnu.linker.category.options"
command="-nostdlib" command="-nostdlib"
valueType="boolean" valueType="boolean"
@ -1026,7 +1144,7 @@
</option> </option>
<option <option
defaultValue="false" defaultValue="false"
name="Remove symbol table (-s)" name="%Option.Posix.Linker.Strip"
category="linux.gnu.linker.category.options" category="linux.gnu.linker.category.options"
command="-s" command="-s"
valueType="boolean" valueType="boolean"
@ -1034,30 +1152,17 @@
</option> </option>
<option <option
defaultValue="false" defaultValue="false"
name="No shared libraries (-static)" name="%Option.Posix.Linker.Static"
category="linux.gnu.linker.category.options" category="linux.gnu.linker.category.options"
command="-static" command="-static"
valueType="boolean" valueType="boolean"
id="linux.gnu.linker.options.noshared"> id="linux.gnu.linker.options.noshared">
</option> </option>
<option
name="Other options (-Xlinker [option])"
category="linux.gnu.linker.category.options"
command="-Xlinker"
valueType="stringList"
id="linux.gnu.linker.options.other">
</option>
<optionCategory <optionCategory
owner="cdt.build.tool.linux.gnu.link" owner="cdt.build.tool.linux.gnu.link"
name="%OptionCategory.Libs" name="%OptionCategory.Libs"
id="linux.gnu.linker.category.libs"> id="linux.gnu.linker.category.libs">
</optionCategory> </optionCategory>
<option
name="%Option.Posix.Linker.Flags"
category="linux.gnu.linker.category.libs"
valueType="string"
id="linux.gnu.linker.libs.flags">
</option>
<option <option
name="%Option.Posix.Libs" name="%Option.Posix.Libs"
category="linux.gnu.linker.category.libs" category="linux.gnu.linker.category.libs"
@ -1072,6 +1177,30 @@
valueType="stringList" valueType="stringList"
id="linux.gnu.linker.libs.paths"> id="linux.gnu.linker.libs.paths">
</option> </option>
<optionCategory
owner="cdt.build.tool.linux.gnu.link"
name="%OptionCategory.Misc"
id="linux.gnu.linker.category.other">
</optionCategory>
<option
name="%Option.Posix.Linker.Flags"
category="linux.gnu.linker.category.other"
valueType="string"
id="linux.gnu.linker.libs.flags">
</option>
<option
name="%Option.Posix.Linker.XLinker"
category="linux.gnu.linker.category.other"
command="-Xlinker"
valueType="stringList"
id="linux.gnu.linker.options.other">
</option>
<option
name="%Option.Posix.UserObjs"
category="linux.gnu.linker.category.other"
valueType="userObjs"
id="linux.gnu.linker.userobjs">
</option>
</tool> </tool>
</target> </target>
<target <target
@ -1127,7 +1256,7 @@
</optionCategory> </optionCategory>
<option <option
defaultValue="false" defaultValue="false"
name="Do not use standard start files (-nostartfiles)" name="%Option.Posix.Linker.NoStartFiles"
category="linux.gnu.solink.category.options" category="linux.gnu.solink.category.options"
command="-nostartfiles" command="-nostartfiles"
valueType="boolean" valueType="boolean"
@ -1135,7 +1264,7 @@
</option> </option>
<option <option
defaultValue="false" defaultValue="false"
name="Do not use default libraries (-nodefaultlibs)" name="%Option.Posix.Linker.NoDefLibs"
category="linux.gnu.solink.category.options" category="linux.gnu.solink.category.options"
command="-nodefaultlibs" command="-nodefaultlibs"
valueType="boolean" valueType="boolean"
@ -1143,7 +1272,7 @@
</option> </option>
<option <option
defaultValue="false" defaultValue="false"
name="No startup or default libs (-nostdlib)" name="%Option.Posix.Linker.NoStdLibs"
category="linux.gnu.solink.category.options" category="linux.gnu.solink.category.options"
command="-nostdlib" command="-nostdlib"
valueType="boolean" valueType="boolean"
@ -1151,46 +1280,17 @@
</option> </option>
<option <option
defaultValue="false" defaultValue="false"
name="Remove symbol table (-s)" name="%Option.Posix.Linker.Strip"
category="linux.gnu.solink.category.options" category="linux.gnu.solink.category.options"
command="-s" command="-s"
valueType="boolean" valueType="boolean"
id="linux.gnu.solink.options.strip"> id="linux.gnu.solink.options.strip">
</option> </option>
<option
defaultValue="false"
name="No shared libraries (-static)"
category="linux.gnu.solink.category.options"
command="-static"
valueType="boolean"
id="linux.gnu.solink.options.noshared">
</option>
<option
defaultValue="false"
name="Bind global symbol references (-symbolic)"
category="linux.gnu.solink.category.options"
command="-symbolic"
valueType="boolean"
id="linux.gnu.solink.options.symbolic">
</option>
<option
name="Other options (-Xlinker [option])"
category="linux.gnu.solink.category.options"
command="-Xlinker"
valueType="stringList"
id="linux.gnu.solink.options.other">
</option>
<optionCategory <optionCategory
owner="cdt.build.tool.linux.gnu.solink" owner="cdt.build.tool.linux.gnu.solink"
name="%OptionCategory.Libs" name="%OptionCategory.Libs"
id="linux.gnu.solink.category.libs"> id="linux.gnu.solink.category.libs">
</optionCategory> </optionCategory>
<option
category="linux.gnu.solink.category.libs"
name="%Option.Posix.Linker.Flags"
id="linux.gnu.solink.libs.flags"
valueType="string">
</option>
<option <option
name="%Option.Posix.Libs" name="%Option.Posix.Libs"
category="linux.gnu.solink.category.libs" category="linux.gnu.solink.category.libs"
@ -1205,6 +1305,30 @@
valueType="stringList" valueType="stringList"
id="linux.gnu.solink.libs.paths"> id="linux.gnu.solink.libs.paths">
</option> </option>
<optionCategory
owner="cdt.build.tool.linux.gnu.solink"
name="%OptionCategory.Misc"
id="linux.gnu.solink.category.other">
</optionCategory>
<option
name="%Option.Posix.Linker.Flags"
category="linux.gnu.solink.category.other"
valueType="string"
id="linux.gnu.solink.libs.flags">
</option>
<option
name="%Option.Posix.Linker.XLinker"
category="linux.gnu.solink.category.other"
command="-Xlinker"
valueType="stringList"
id="linux.gnu.solink.options.other">
</option>
<option
name="%Option.Posix.UserObjs"
category="linux.gnu.solink.category.other"
valueType="userObjs"
id="linux.gnu.solink.userobjs">
</option>
</tool> </tool>
</target> </target>
<target <target
@ -1601,7 +1725,7 @@
</optionCategory> </optionCategory>
<option <option
defaultValue="false" defaultValue="false"
name="Do not use standard start files (-nostartfiles)" name="%Option.Posix.Linker.NoStartFiles"
category="solaris.gnu.linker.category.options" category="solaris.gnu.linker.category.options"
command="-nostartfiles" command="-nostartfiles"
valueType="boolean" valueType="boolean"
@ -1609,7 +1733,7 @@
</option> </option>
<option <option
defaultValue="false" defaultValue="false"
name="Do not use default libraries (-nodefaultlibs)" name="%Option.Posix.Linker.NoDefLibs"
category="solaris.gnu.linker.category.options" category="solaris.gnu.linker.category.options"
command="-nodefaultlibs" command="-nodefaultlibs"
valueType="boolean" valueType="boolean"
@ -1617,7 +1741,7 @@
</option> </option>
<option <option
defaultValue="false" defaultValue="false"
name="No startup or default libs (-nostdlib)" name="%Option.Posix.Linker.NoStdLibs"
category="solaris.gnu.linker.category.options" category="solaris.gnu.linker.category.options"
command="-nostdlib" command="-nostdlib"
valueType="boolean" valueType="boolean"
@ -1625,7 +1749,7 @@
</option> </option>
<option <option
defaultValue="false" defaultValue="false"
name="Remove symbol table (-s)" name="%Option.Posix.Linker.Strip"
category="solaris.gnu.linker.category.options" category="solaris.gnu.linker.category.options"
command="-s" command="-s"
valueType="boolean" valueType="boolean"
@ -1633,30 +1757,17 @@
</option> </option>
<option <option
defaultValue="false" defaultValue="false"
name="No shared libraries (-static)" name="%Option.Posix.Linker.Static"
category="solaris.gnu.linker.category.options" category="solaris.gnu.linker.category.options"
command="-static" command="-static"
valueType="boolean" valueType="boolean"
id="solaris.gnu.linker.options.noshared"> id="solaris.gnu.linker.options.noshared">
</option> </option>
<option
name="Other options (-Xlinker [option])"
category="solaris.gnu.linker.category.options"
command="-Xlinker"
valueType="stringList"
id="solaris.gnu.linker.options.other">
</option>
<optionCategory <optionCategory
owner="cdt.build.tool.solaris.gnu.link" owner="cdt.build.tool.solaris.gnu.link"
name="%OptionCategory.Libs" name="%OptionCategory.Libs"
id="solaris.gnu.linker.category.libs"> id="solaris.gnu.linker.category.libs">
</optionCategory> </optionCategory>
<option
category="solaris.gnu.linker.category.libs"
name="%Option.Posix.Linker.Flags"
id="solaris.gnu.linker.libs.flags"
valueType="string">
</option>
<option <option
name="%Option.Posix.Libs" name="%Option.Posix.Libs"
category="solaris.gnu.linker.category.libs" category="solaris.gnu.linker.category.libs"
@ -1671,6 +1782,30 @@
valueType="stringList" valueType="stringList"
id="solaris.gnu.linker.libs.paths"> id="solaris.gnu.linker.libs.paths">
</option> </option>
<optionCategory
owner="cdt.build.tool.solaris.gnu.link"
name="%OptionCategory.Misc"
id="solaris.gnu.linker.category.other">
</optionCategory>
<option
name="%Option.Posix.Linker.Flags"
category="solaris.gnu.linker.category.other"
valueType="string"
id="solaris.gnu.linker.libs.flags">
</option>
<option
name="%Option.Posix.Linker.XLinker"
category="solaris.gnu.linker.category.other"
command="-Xlinker"
valueType="stringList"
id="solaris.gnu.linker.options.other">
</option>
<option
name="%Option.Posix.UserObjs"
category="solaris.gnu.linker.category.other"
valueType="userObjs"
id="solaris.gnu.linker.userobjs">
</option>
</tool> </tool>
</target> </target>
<target <target
@ -1726,7 +1861,7 @@
</optionCategory> </optionCategory>
<option <option
defaultValue="false" defaultValue="false"
name="Do not use standard start files (-nostartfiles)" name="%Option.Posix.Linker.NoStartFiles"
category="solaris.gnu.solink.category.options" category="solaris.gnu.solink.category.options"
command="-nostartfiles" command="-nostartfiles"
valueType="boolean" valueType="boolean"
@ -1734,7 +1869,7 @@
</option> </option>
<option <option
defaultValue="false" defaultValue="false"
name="Do not use default libraries (-nodefaultlibs)" name="%Option.Posix.Linker.NoDefLibs"
category="solaris.gnu.solink.category.options" category="solaris.gnu.solink.category.options"
command="-nodefaultlibs" command="-nodefaultlibs"
valueType="boolean" valueType="boolean"
@ -1742,7 +1877,7 @@
</option> </option>
<option <option
defaultValue="false" defaultValue="false"
name="No startup or default libs (-nostdlib)" name="%Option.Posix.Linker.NoStdLibs"
category="solaris.gnu.solink.category.options" category="solaris.gnu.solink.category.options"
command="-nostdlib" command="-nostdlib"
valueType="boolean" valueType="boolean"
@ -1750,46 +1885,17 @@
</option> </option>
<option <option
defaultValue="false" defaultValue="false"
name="Remove symbol table (-s)" name="%Option.Posix.Linker.Strip"
category="solaris.gnu.solink.category.options" category="solaris.gnu.solink.category.options"
command="-s" command="-s"
valueType="boolean" valueType="boolean"
id="solaris.gnu.solink.options.strip"> id="solaris.gnu.solink.options.strip">
</option> </option>
<option
defaultValue="false"
name="No shared libraries (-static)"
category="solaris.gnu.solink.category.options"
command="-static"
valueType="boolean"
id="solaris.gnu.solink.options.noshared">
</option>
<option
defaultValue="false"
name="Bind global symbol references (-symbolic)"
category="solaris.gnu.solink.category.options"
command="-symbolic"
valueType="boolean"
id="solaris.gnu.solink.options.symbolic">
</option>
<option
name="Other options (-Xlinker [option])"
category="solaris.gnu.solink.category.options"
command="-Xlinker"
valueType="stringList"
id="solaris.gnu.solink.options.other">
</option>
<optionCategory <optionCategory
owner="cdt.build.tool.solaris.gnu.solink" owner="cdt.build.tool.solaris.gnu.solink"
name="%OptionCategory.Libs" name="%OptionCategory.Libs"
id="solaris.gnu.solink.category.libs"> id="solaris.gnu.solink.category.libs">
</optionCategory> </optionCategory>
<option
name="%Option.Posix.Linker.Flags"
category="solaris.gnu.solink.category.libs"
valueType="string"
id="solaris.gnu.solink.libs.flags">
</option>
<option <option
name="%Option.Posix.Libs" name="%Option.Posix.Libs"
category="solaris.gnu.solink.category.libs" category="solaris.gnu.solink.category.libs"
@ -1804,6 +1910,30 @@
valueType="stringList" valueType="stringList"
id="solaris.gnu.solink.libs.paths"> id="solaris.gnu.solink.libs.paths">
</option> </option>
<optionCategory
owner="cdt.build.tool.solaris.gnu.solink"
name="%OptionCategory.Misc"
id="solaris.gnu.solink.category.other">
</optionCategory>
<option
name="%Option.Posix.Linker.Flags"
category="solaris.gnu.solink.category.other"
valueType="string"
id="solaris.gnu.solink.libs.flags">
</option>
<option
name="%Option.Posix.Linker.XLinker"
category="solaris.gnu.solink.category.other"
command="-Xlinker"
valueType="stringList"
id="solaris.gnu.solink.options.other">
</option>
<option
name="%Option.Posix.UserObjs"
category="solaris.gnu.solink.category.other"
valueType="userObjs"
id="solaris.gnu.solink.userobjs">
</option>
</tool> </tool>
</target> </target>
<target <target

View file

@ -51,7 +51,7 @@ BuildPropertyPage.manage.title=Manage
# ----------- New Configuration ----------- # ----------- New Configuration -----------
NewConfiguration.label.name=Configuration name: NewConfiguration.label.name=Configuration name:
NewConfiguration.label.copy=Copy settings from: NewConfiguration.label.copy=Copy default settings from:
NewConfiguration.error.title=Error NewConfiguration.error.title=Error
NewConfiguration.error.duplicateName=A configuration named "{0}" already exists. NewConfiguration.error.duplicateName=A configuration named "{0}" already exists.

View file

@ -81,6 +81,7 @@ public class BuildToolSettingsPage extends FieldEditorPreferencePage {
case IOption.INCLUDE_PATH : case IOption.INCLUDE_PATH :
case IOption.PREPROCESSOR_SYMBOLS : case IOption.PREPROCESSOR_SYMBOLS :
case IOption.LIBRARIES : case IOption.LIBRARIES :
case IOption.OBJECTS:
BuildOptionListFieldEditor listField = new BuildOptionListFieldEditor(opt.getId(), opt.getName(), getFieldEditorParent()); BuildOptionListFieldEditor listField = new BuildOptionListFieldEditor(opt.getId(), opt.getName(), getFieldEditorParent());
addField(listField); addField(listField);
break; break;
@ -131,6 +132,7 @@ public class BuildToolSettingsPage extends FieldEditorPreferencePage {
case IOption.INCLUDE_PATH : case IOption.INCLUDE_PATH :
case IOption.PREPROCESSOR_SYMBOLS : case IOption.PREPROCESSOR_SYMBOLS :
case IOption.LIBRARIES : case IOption.LIBRARIES :
case IOption.OBJECTS:
String listStr = getPreferenceStore().getString(option.getId()); String listStr = getPreferenceStore().getString(option.getId());
String[] listVal = BuildToolsSettingsStore.parseString(listStr); String[] listVal = BuildToolsSettingsStore.parseString(listStr);
ManagedBuildManager.setOption(configuration, option, listVal); ManagedBuildManager.setOption(configuration, option, listVal);

View file

@ -259,6 +259,14 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
} }
getOptionMap().put(name, value); getOptionMap().put(name, value);
break; break;
case IOption.OBJECTS :
try {
value = createList(opt.getUserObjects());
} catch (BuildException e) {
break;
}
getOptionMap().put(name, value);
break;
default : default :
break; break;
} }

View file

@ -2,6 +2,11 @@
Added QuickParseASTTests::testBug43644() & testBug43062(). Added QuickParseASTTests::testBug43644() & testBug43062().
Moved ASTFailedTests::testBug39531() to QuickParseASTTests. Moved ASTFailedTests::testBug39531() to QuickParseASTTests.
2003-09-25 Sean Evoy
Bug 43220 test for the new option type and retrieval methods.
* plugin.xml
* build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java
2003-09-25 Andrew Niefer 2003-09-25 Andrew Niefer
-bug43129 - Cannot search for definitions of global variables -bug43129 - Cannot search for definitions of global variables
-added testbug43129() in OtherPatternTests -added testbug43129() in OtherPatternTests

View file

@ -805,9 +805,9 @@ public class ManagedBuildTests extends TestCase {
// Now get the tool defined for this target // Now get the tool defined for this target
ITool subTool = tools[1]; ITool subTool = tools[1];
assertEquals("Sub Tool", subTool.getName()); assertEquals("Sub Tool", subTool.getName());
// Confirm that it has three options // Confirm that it has four options
IOption[] subOpts = subTool.getOptions(); IOption[] subOpts = subTool.getOptions();
assertEquals(3, subOpts.length); assertEquals(4, subOpts.length);
assertEquals("", subTool.getOutputFlag()); assertEquals("", subTool.getOutputFlag());
assertTrue(subTool.buildsFileType("yarf")); assertTrue(subTool.buildsFileType("yarf"));
assertTrue(subTool.producesFileType("bus")); assertTrue(subTool.producesFileType("bus"));
@ -841,6 +841,13 @@ public class ManagedBuildTests extends TestCase {
assertEquals(1, moreIncPath.length); assertEquals(1, moreIncPath.length);
assertEquals("C:\\home\\tester/include", moreIncPath[0]); assertEquals("C:\\home\\tester/include", moreIncPath[0]);
assertEquals("-I", subOpts[2].getCommand()); assertEquals("-I", subOpts[2].getCommand());
// Check the user object option
assertEquals("User Objects", subOpts[3].getName());
assertEquals(IOption.OBJECTS, subOpts[3].getValueType());
String[] objs = subOpts[3].getUserObjects();
assertEquals(2, objs.length);
assertEquals("obj1.o", objs[0]);
assertEquals("obj2.o", objs[1]);
// Get the configs for this target; it should inherit all the configs defined for the parent // Get the configs for this target; it should inherit all the configs defined for the parent
IConfiguration[] configs = target.getConfigurations(); IConfiguration[] configs = target.getConfigurations();

View file

@ -125,12 +125,12 @@
<toolReference <toolReference
id="root.tool"> id="root.tool">
<optionReference <optionReference
id="string.option" defaultValue="overridden"
defaultValue="overridden"> id="string.option">
</optionReference> </optionReference>
<optionReference <optionReference
id="boolean.option" defaultValue="true"
defaultValue="true"> id="boolean.option">
</optionReference> </optionReference>
<optionReference <optionReference
defaultValue="-e2" defaultValue="-e2"
@ -199,6 +199,19 @@
builtIn="false"> builtIn="false">
</listOptionValue> </listOptionValue>
</option> </option>
<option
name="User Objects"
valueType="userObjs"
id="sub.tool.opt.objs">
<listOptionValue
value="obj1.o"
builtIn="false">
</listOptionValue>
<listOptionValue
value="obj2.o"
builtIn="false">
</listOptionValue>
</option>
</tool> </tool>
</target> </target>
<target <target