Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Setting the value of an option according to another option's value in MBS

Hello,

I am struggling with a problem in Managed Build System, which regards
enablement expressions for options. I am using v200902130801.

I have defined a custom toolchain in MBS using the buildDefinitions
extension point. I am trying to establish a dependency between two
options OptionA, OptionB so that the value of OptionB is determined from
the value of OptionA.

To do so, the OptionB has several enablement expressions with type
CONTAINER_ATTRIBUTE, which set its value.
Every enablement's value is determined by a checkOption expression.

Here is a test case:

	<toolchain id="myToolchain">

      <optionCategory
            id="toolchain.optionCategory.testing"
            name="Testing Options">
      </optionCategory>
      <option
            category="iar.r32c.toolchain.optionCategory.testing"
            id="OptionA"
            isAbstract="false"
            name="OptionA (Master)"
            resourceFilter="all"
            valueType="enumerated">
         <enumeratedOptionValue
               id="OptionA.enumValue1"
               name="OptionA.enumValue1">
         </enumeratedOptionValue>
         <enumeratedOptionValue
               id="OptionA.enumValue2"
               name="OptionA.enumValue2">
         </enumeratedOptionValue>
      </option>

      <option
            category="iar.r32c.toolchain.optionCategory.testing"
            id="OptionB"
            isAbstract="false"
            name="OptionB (Slave)"
            resourceFilter="all"
            valueType="string">
         <enablement
               attribute="value"
               type="CONTAINER_ATTRIBUTE"
               value="The value of Option A is OptionA.enumValue1">
            <checkOption
                  isRegex="false"
                  optionId="OptionA"
                  value="OptionA.enumValue1">
            </checkOption>
         </enablement>
         <enablement
               attribute="value"
               type="CONTAINER_ATTRIBUTE"
               value="The value of Option A is OptionA.enumValue2">
            <checkOption
                  isRegex="false"
                  optionId="OptionA"
                  value="OptionA.enumValue2">
            </checkOption>
         </enablement>
      </option>
.
.

	(tools declarations, project types, configurations, etc...)
.
.

    </toolChain>

In the BuildSettings tab, when the value of OptionA is changed, the
value of OptionB does not change (it keeps its initial value).

This also happens when the "Apply" button is pressed.

I tried to debug into the ToolSettingsTab class after having clicked
Apply.

An instance of OptionB is properly adjusted by evaluating and applying
its enablement expressions.

Eventually, the 

ToolSettingsTab.setOption(IOption op1, IOption op2, IHoldsOptions dst,
IResourceInfo res) 

method is called with the previous and the adjusted instances of
OptionB. 

Apparently, the adjusted instance is reset to the old value in 

ManagedBuildManager.setOption(IResourceInfo resConfig, IHoldsOptions
holder, IOption option, String value)

Also, other types of enablement (such as UI_ENABLEMENT) work as
expected; the problem is only with CONTAINER_ATTRIBUTE enablements.

Is this a bug? What is the correct way of declaring two dependent
options in MBS?

Thanks for the help!

/Mario



Back to the top