Skip to main content

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

Posted a bug about this matter

https://bugs.eclipse.org/bugs/show_bug.cgi?id=273822

Best,

/Mario

-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
On Behalf Of Mario Pierro
Sent: den 27 april 2009 09:21
To: Tokugawa, Miwako
Cc: CDT General developers list.
Subject: RE: [cdt-dev] Setting the value of an option according
toanotheroption's value in MBS

Hello,

Thanks for your suggestion.

While IOptionApplicability and CMD_USAGE enablement expressions work as
expected, they do not help in some cases where the option's value needs
to be programmatically determined from other options - whether by
CONTAINER_ATTRIBUTE enablement expressions or IManagedOptionValueHandler
implementations.

Our problem seems to be actually related to how the options are handled
after the enablement expressions have been applied, as the correct value
gets overwritten...



-----Original Message-----
From: Tokugawa, Miwako [mailto:miwako.tokugawa@xxxxxxxxx] 
Sent: den 24 april 2009 23:32
To: Mario Pierro
Subject: RE: [cdt-dev] Setting the value of an option according to
anotheroption's value in MBS
Importance: Low

Hi, Mario.
Have you gotten a response to this?

Can you use applicabilityCalculator attribute, i.e.

 <option
	id="OptionB" ...
	applicabilityCalculator="com.x.OptionBApplicability" ... >

Com.x.optionBApplicability.java would have

public class myOptionBApplicability implements IOptionApplicability { }


-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
On Behalf Of Mario Pierro
Sent: Thursday, April 23, 2009 4:04 AM
To: CDT General developers list.
Subject: RE: [cdt-dev] Setting the value of an option according to
another option's value in MBS

Hello,

Sorry, the test case given in my previous msg had incorrect category ids
in the options. Here is a revised version: 


      <optionCategory
            id="toolchain.optionCategory.testing"
            name="Testing Options">
      </optionCategory>
      <option
            category="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="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>

Again, why is OptionB's adjusted value being reset by MBS? Is this
approach incorrect?

I am seeing a similar behavior even when using an
IManagedOptionValueHandler to programmatically set the value of OptionB
according to OptionA's value. The handler class works as expected but
OptionB's value is overwrittien afterwards by an old value...

Thanks,

/Mario


-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
On Behalf Of Mario Pierro
Sent: den 22 april 2009 15:06
To: CDT General developers list.
Subject: [cdt-dev] Setting the value of an option according to
anotheroption'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

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev





Back to the top