mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 02:36:01 +02:00
Added support for the options that contained by a tool-chain
This commit is contained in:
parent
ec7b5fa286
commit
2b8dec03b8
1 changed files with 30 additions and 17 deletions
|
@ -98,6 +98,22 @@ public class MbsMacroSupplier implements IBuildMacroSupplier {
|
||||||
"HostArchName", //$NON-NLS-1$
|
"HostArchName", //$NON-NLS-1$
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private class OptionData extends OptionContextData {
|
||||||
|
private IBuildObject fOptionContainer;
|
||||||
|
public OptionData(IOption option, IBuildObject parent) {
|
||||||
|
this(option, parent, parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OptionData(IOption option, IBuildObject parent, IBuildObject optionContainer) {
|
||||||
|
super(option, parent);
|
||||||
|
fOptionContainer = optionContainer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IBuildObject getOptionContainer(){
|
||||||
|
return fOptionContainer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class FileContextMacro extends BuildMacro{
|
public class FileContextMacro extends BuildMacro{
|
||||||
private IFileContextData fContextData;
|
private IFileContextData fContextData;
|
||||||
private IConfiguration fConfiguration;
|
private IConfiguration fConfiguration;
|
||||||
|
@ -790,7 +806,7 @@ public class MbsMacroSupplier implements IBuildMacroSupplier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IOptionContextData getParent(IOptionContextData optionContext){
|
private OptionData getParent(IOptionContextData optionContext){
|
||||||
if(optionContext == null)
|
if(optionContext == null)
|
||||||
return null;
|
return null;
|
||||||
IOption option = optionContext.getOption();
|
IOption option = optionContext.getOption();
|
||||||
|
@ -798,14 +814,14 @@ public class MbsMacroSupplier implements IBuildMacroSupplier {
|
||||||
return null;
|
return null;
|
||||||
IOption parentOption = null;
|
IOption parentOption = null;
|
||||||
|
|
||||||
// TODO: In CDT 3.0. Option.getParent can return a Tool or ToolChain
|
|
||||||
// We need to decide what to do with the ToolChain case
|
|
||||||
IBuildObject parent = option.getParent();
|
IBuildObject parent = option.getParent();
|
||||||
ITool tool = null;
|
ITool tool = null;
|
||||||
if (parent instanceof ITool) {
|
if (parent instanceof ITool) {
|
||||||
tool = (ITool)parent;
|
tool = (ITool)parent;
|
||||||
}
|
}
|
||||||
IBuildObject bo = optionContext.getParent();
|
final IBuildObject bo = (optionContext instanceof OptionData) ?
|
||||||
|
((OptionData)optionContext).getOptionContainer() : optionContext.getParent();
|
||||||
|
IBuildObject parentObject = null;
|
||||||
if(tool != null && bo instanceof IResourceConfiguration){
|
if(tool != null && bo instanceof IResourceConfiguration){
|
||||||
|
|
||||||
IToolChain toolChain = null;
|
IToolChain toolChain = null;
|
||||||
|
@ -815,6 +831,7 @@ public class MbsMacroSupplier implements IBuildMacroSupplier {
|
||||||
IResourceConfiguration rc = (IResourceConfiguration)bo;
|
IResourceConfiguration rc = (IResourceConfiguration)bo;
|
||||||
cfg = rc.getParent();
|
cfg = rc.getParent();
|
||||||
toolChain = cfg.getToolChain();
|
toolChain = cfg.getToolChain();
|
||||||
|
parentObject = toolChain;
|
||||||
if(rc.getTool(tool.getId()) != null){
|
if(rc.getTool(tool.getId()) != null){
|
||||||
//get the configuration tool
|
//get the configuration tool
|
||||||
tool = tool.getSuperClass();
|
tool = tool.getSuperClass();
|
||||||
|
@ -864,21 +881,17 @@ public class MbsMacroSupplier implements IBuildMacroSupplier {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
parentOption = option.getSuperClass();
|
parentOption = option.getSuperClass();
|
||||||
|
if(parentOption != null){
|
||||||
|
IBuildObject parentParent = parentOption.getParent();
|
||||||
|
if (parentParent instanceof ITool)
|
||||||
|
parentObject = ((ITool)parentParent).getParent();
|
||||||
|
else if (parentParent instanceof IToolChain)
|
||||||
|
parentObject = parentParent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(parentOption != null){
|
if(parentOption != null)
|
||||||
// TODO: In CDT 3.0. Option.getParent can return a Tool or ToolChain
|
return new OptionData(parentOption,bo,parentObject);
|
||||||
// We need to decide what to do with the ToolChain case
|
|
||||||
IBuildObject parentObject = null;
|
|
||||||
ITool t = null;
|
|
||||||
IBuildObject parentParent = parentOption.getParent();
|
|
||||||
if (parentParent instanceof ITool) {
|
|
||||||
t = (ITool)parentParent;
|
|
||||||
}
|
|
||||||
if(t != null)
|
|
||||||
parentObject = t.getParent();
|
|
||||||
return new OptionContextData(parentOption,parentObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue