mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 08:55:25 +02:00
This patch implements 2 pieces of additional option functionality that were discussed on CDT-DEV.
1. For a String option, if the defaultValue attribute is present, and contains a string of length > 0, then the command string (if any) is prepended to the defaultValue string to form the command line string. 2. Add a commandFalse attribute to the Option Schema to be used, if specified, when the value of a Boolean option is False.
This commit is contained in:
parent
3d544739e7
commit
ef50454dbd
6 changed files with 54 additions and 3 deletions
|
@ -214,6 +214,13 @@ Additional special types exist to flag options of special relevance to the build
|
|||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="commandFalse" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
An optional value, used only with options of type Boolean, that specifies the actual command that will be passed to the tool on the command line when the value of the Boolean option is False.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ public interface IOption extends IBuildObject {
|
|||
// Schema attribute names for option elements
|
||||
public static final String CATEGORY = "category"; //$NON-NLS-1$
|
||||
public static final String COMMAND = "command"; //$NON-NLS-1$
|
||||
public static final String COMMAND_FALSE = "commandFalse"; //$NON-NLS-1$
|
||||
public static final String DEFAULT_VALUE = "defaultValue"; //$NON-NLS-1$
|
||||
public static final String ENUM_VALUE = "enumeratedOptionValue"; //$NON-NLS-1$
|
||||
public static final String IS_DEFAULT = "isDefault"; //$NON-NLS-1$
|
||||
|
@ -88,6 +89,13 @@ public interface IOption extends IBuildObject {
|
|||
*/
|
||||
public String getCommand();
|
||||
|
||||
/**
|
||||
* Answers a <code>String</code> containing the actual command line
|
||||
* option associated with a Boolean option when the value is False
|
||||
* @return String
|
||||
*/
|
||||
public String getCommandFalse();
|
||||
|
||||
/**
|
||||
* Answers the user-defined preprocessor symbols.
|
||||
*
|
||||
|
|
|
@ -33,6 +33,7 @@ public class Option extends BuildObject implements IOption {
|
|||
private List builtIns;
|
||||
private IOptionCategory category;
|
||||
private String command;
|
||||
private String commandFalse;
|
||||
private String defaultEnumName;
|
||||
private Map enumCommands;
|
||||
private ITool tool;
|
||||
|
@ -62,6 +63,9 @@ public class Option extends BuildObject implements IOption {
|
|||
// Get the command defined for the option
|
||||
command = element.getAttribute(COMMAND);
|
||||
|
||||
// Get the command defined for a Boolean option when the value is False
|
||||
commandFalse = element.getAttribute(COMMAND_FALSE);
|
||||
|
||||
// Options hold different types of values
|
||||
String valueTypeStr = element.getAttribute(VALUE_TYPE);
|
||||
if (valueTypeStr == null)
|
||||
|
@ -184,6 +188,13 @@ public class Option extends BuildObject implements IOption {
|
|||
return command;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.IOption#getCommandFalse()
|
||||
*/
|
||||
public String getCommandFalse() {
|
||||
return commandFalse;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.IOption#getDefinedSymbols()
|
||||
*/
|
||||
|
|
|
@ -248,6 +248,13 @@ public class OptionReference implements IOption {
|
|||
return option.getCommand();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.IOption#getCommandFalse()
|
||||
*/
|
||||
public String getCommandFalse() {
|
||||
return option.getCommandFalse();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.IOption#getDefinedSymbols()
|
||||
*/
|
||||
|
|
|
@ -206,8 +206,15 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
|||
IOption option = opts[index];
|
||||
switch (option.getValueType()) {
|
||||
case IOption.BOOLEAN :
|
||||
String boolCmd;
|
||||
if (option.getBooleanValue()) {
|
||||
buf.append(option.getCommand() + WHITE_SPACE);
|
||||
boolCmd = option.getCommand();
|
||||
} else {
|
||||
// Note: getCommandFalse is new with CDT 2.0
|
||||
boolCmd = option.getCommandFalse();
|
||||
}
|
||||
if (boolCmd != null && boolCmd.length() > 0) {
|
||||
buf.append(boolCmd + WHITE_SPACE);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -219,8 +226,10 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
|||
break;
|
||||
|
||||
case IOption.STRING :
|
||||
String strCmd = option.getCommand();
|
||||
String val = option.getStringValue();
|
||||
if (val.length() > 0) {
|
||||
if (val.length() > 0) {
|
||||
if (strCmd != null) buf.append(strCmd);
|
||||
buf.append(val + WHITE_SPACE);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -279,8 +279,15 @@ public class ToolReference implements IToolReference {
|
|||
IOption option = opts[index];
|
||||
switch (option.getValueType()) {
|
||||
case IOption.BOOLEAN :
|
||||
String boolCmd;
|
||||
if (option.getBooleanValue()) {
|
||||
buf.append(option.getCommand() + WHITE_SPACE);
|
||||
boolCmd = option.getCommand();
|
||||
} else {
|
||||
// Note: getCommandFalse is new with CDT 2.0
|
||||
boolCmd = option.getCommandFalse();
|
||||
}
|
||||
if (boolCmd != null && boolCmd.length() > 0) {
|
||||
buf.append(boolCmd + WHITE_SPACE);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -292,8 +299,10 @@ public class ToolReference implements IToolReference {
|
|||
break;
|
||||
|
||||
case IOption.STRING :
|
||||
String strCmd = option.getCommand();
|
||||
String val = option.getStringValue();
|
||||
if (val.length() > 0) {
|
||||
if (strCmd != null) buf.append(strCmd);
|
||||
buf.append(val + WHITE_SPACE);
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue