Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Additions to Managed Build Options Functionality

Hi,

 

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.

 

I’ll send a patch to the JUnit Managed Builder tests next.

 

Leo

 

Index: schema/ManagedBuildTools.exsd

===================================================================

retrieving revision 1.7

diff -u -r1.7 ManagedBuildTools.exsd

--- schema/ManagedBuildTools.exsd       26 Feb 2004 20:53:54 -0000        1.7

+++ schema/ManagedBuildTools.exsd    17 Mar 2004 14:13:10 -0000

@@ -213,6 +213,13 @@

                </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>

 

Index: src/org/eclipse/cdt/managedbuilder/core/IOption.java

===================================================================

retrieving revision 1.3

diff -u -r1.3 IOption.java

--- src/org/eclipse/cdt/managedbuilder/core/IOption.java     16 Mar 2004 22:25:50 -0000        1.3

+++ src/org/eclipse/cdt/managedbuilder/core/IOption.java  17 Mar 2004 14:13:10 -0000

@@ -27,6 +27,7 @@

            // 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$

@@ -87,6 +88,14 @@

             * @return String

             */

            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.

Index: src/org/eclipse/cdt/managedbuilder/internal/core/Option.java

===================================================================

retrieving revision 1.5

diff -u -r1.5 Option.java

--- src/org/eclipse/cdt/managedbuilder/internal/core/Option.java      12 Mar 2004 19:11:53 -0000        1.5

+++ src/org/eclipse/cdt/managedbuilder/internal/core/Option.java   17 Mar 2004 14:13:13 -0000

@@ -33,6 +33,7 @@

            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 @@

                        // 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)

@@ -182,6 +186,13 @@

             */

            public String getCommand() {

                        return command;

+          }

+

+          /* (non-Javadoc)

+          * @see org.eclipse.cdt.core.build.managed.IOption#getCommandFalse()

+          */

+          public String getCommandFalse() {

+                      return commandFalse;

            }

 

            /* (non-Javadoc)

Index: src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java

===================================================================

retrieving revision 1.8

diff -u -r1.8 OptionReference.java

--- src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java   12 Mar 2004 19:11:53 -0000        1.8

+++ src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java            17 Mar 2004 14:13:13 -0000

@@ -249,6 +249,13 @@

            }

 

            /* (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()

             */

            public String[] getDefinedSymbols() throws BuildException {

Index: src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java

===================================================================

retrieving revision 1.9

diff -u -r1.9 Tool.java

--- src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java         12 Mar 2004 19:11:53 -0000        1.9

+++ src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java      17 Mar 2004 14:13:13 -0000

@@ -206,8 +206,16 @@

                                    IOption option = opts[index];

                                    switch (option.getValueType()) {

                                                case IOption.BOOLEAN :

+                                                          String boolCmd;

                                                            if (option.getBooleanValue()) {

-                                                                       buf.append(option.getCommand() + WHITE_SPACE);

+                                                                      boolCmd = option.getCommand();

+                                                          }

+                                                          //  FYI; getCommandFalse is new with CDT 2.0

+                                                          else {

+                                                                      boolCmd = option.getCommandFalse();

+                                                          }

+                                                          if (boolCmd != null && boolCmd.length() > 0) {

+                                                                      buf.append(boolCmd + WHITE_SPACE);

                                                            }

                                                            break;

                                               

@@ -219,8 +227,11 @@

                                                            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;

Index: src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java

===================================================================

retrieving revision 1.9

diff -u -r1.9 ToolReference.java

--- src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java       16 Mar 2004 22:12:23 -0000        1.9

+++ src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java    17 Mar 2004 14:13:14 -0000

@@ -199,8 +199,16 @@

                                    IOption option = opts[index];

                                    switch (option.getValueType()) {

                                                case IOption.BOOLEAN :

+                                                          String boolCmd;

                                                            if (option.getBooleanValue()) {

-                                                                       buf.append(option.getCommand() + WHITE_SPACE);

+                                                                      boolCmd = option.getCommand();

+                                                          }

+                                                          //  FYI; getCommandFalse is new with CDT 2.0

+                                                          else {

+                                                                      boolCmd = option.getCommandFalse();

+                                                          }

+                                                          if (boolCmd != null && boolCmd.length() > 0) {

+                                                                      buf.append(boolCmd + WHITE_SPACE);

                                                            }

                                                            break;

                                               

@@ -212,8 +220,11 @@

                                                            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;


Back to the top