[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-dev] [CDT MBS (Managed Build System)] Inheritance problem with Option
|
Hi,
I have an inheritance issue with the value of an option defined under a
toolchain, this option is an enumerated option with 3 values: A (default
value), B and C.
## test case:
1) I create a project where the value for this option is B.
2) I create a new folder "plop" inside my project and I set the pedantic
option only for this folder.
The pedantic option is not relevant, it is just to create a new tag
folderInfo in the cproject file.
So at this point in the cproject file, I have two folderInfo. A parent
folderInfo for all the project and a child just for the plop folder.
3) if I check the property of the plop folder, the option value is still B
--> inheritance works, good so far!
4) I close/reopen project
5) When I check again the property of the plop folder, the option is now the
default value A.
## Env:
cproject file:
<configuration ...">
<folderInfo id="myfolderInfo.776789828." name="/" resourcePath="">
<toolChain id="myToolchain.165714716" name="my toolchain"
superClass="my.superclass.toolchain">
...
<option id="myOption.853101675" name="my option"
superClass="my.superclass.option" value="B" valueType="enumerated"/>
...
</toolChain>
</folderInfo>
<folderInfo id="myfolderInfo.776789828.123765028" name="/"
resourcePath="plop">
<toolChain id="myToolchain.1832164238" name="my toolchain"
superClass="my.superclass.toolchain" unusedChildren="">
...
<option id="myOtpion.853101675.1215255250" name="my option"
superClass="myOption.853101675"/>
<tool id="myTool.2019819561" name="my tool"
superClass="my.superclass.tool.400362476">
<option id="gnu.c.compiler.option.warnings.pedantic.760615677"
name="Pedantic (-pedantic)"
superClass="gnu.c.compiler.option.warnings.pedantic" value="true"
valueType="boolean"/>
...
</tool>
...
</toolChain>
</folderInfo>
...
</configuration>
## Issue:
During the creation of the options, the specific option "myOption.853101675"
(in the first folderInfo) is well created and stored in a specific Map
(optionMap).
But for the option "myOtpion.853101675.1215255250" (second folderInfo), its
superClass is not found so the option is not created correctly by the end
the value is not inherited.
At first sight: the cproject file has been correctly created, the problem
seems to be related to the creation of the options during the parsing of the
xml.
## Debug Flow:
Plugin cdt.managedbuilder.internal.core, in the Toolchain's constructor, for
each children of ICStorageElement we call the loadChild method:
public ToolChain(IFolderInfo parentFldInfo, ICStorageElement element,
String managedBuildRevision) {
...
// Load children
ICStorageElement configElements[] = element.getChildren();
for (int i = 0; i < configElements.length; ++i) {
ICStorageElement configElement = configElements[i];
if (loadChild(configElement)) {
...
In the loadChild method, if the children corresponds to an Option object, it
is created and added in the map "optionMap" declared in HoldsOption class.
protected boolean loadChild(ICStorageElement element) {
if (element.getName().equals(IHoldsOptions.OPTION)) {
Option option = new Option(this, element);
addOption(option); //========================> Important for my issue
(map OptionMap)
During the creation of the Option object, it get the superclass via the map
"extensionOptionMap" declared in ManagedBuildManager class:
// superClass
superClassId =
SafeStringInterner.safeIntern(element.getAttribute(IProjectType.SUPERCLASS));
if (superClassId != null && superClassId.length() > 0) {
superClass = ManagedBuildManager.getExtensionOption(superClassId);
//========================> Important for my issue (map extensionOptionMap)
if (superClass == null) {
// TODO: Report error
}
}
Like I said above, regarding first folderInfo option, the superclass is
found in extensionOptionMap. So after the creation of the option, it is
added to optionMap.
But regarding second folderInfo, the superClass is not found because this
previous superclass was not added in extensionOptionMap but in optionMap.
So the superclass is null, it can't retrieve the value B and in the end it
takes the default value A.
If you have read this far, thanks to you ;).
## Question:
Do you know why a new created option is added in optionMap and not in
extensionOptionMap?
Feel free to comment.
Regards,
Florent
--
View this message in context: http://eclipse.1072660.n5.nabble.com/CDT-MBS-Managed-Build-System-Inheritance-problem-with-Option-tp187903.html
Sent from the Eclipse CDT - Development mailing list archive at Nabble.com.