mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Fixed the bug that macros specified in the OBJECTS and LIBRARIES options are always kept unresolved in the buildfile
This commit is contained in:
parent
0f7bebac8d
commit
ab117ca51d
4 changed files with 55 additions and 6 deletions
|
@ -425,8 +425,25 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
|||
String[] allLibs = option.getLibraries();
|
||||
for (int j = 0; j < allLibs.length; j++)
|
||||
{
|
||||
String string = allLibs[j];
|
||||
libs.add(command + string);
|
||||
try {
|
||||
String resolved[] = ManagedBuildManager.getBuildMacroProvider().resolveStringListValueToMakefileFormat(
|
||||
allLibs[j],
|
||||
"", //$NON-NLS-1$
|
||||
" ", //$NON-NLS-1$
|
||||
IBuildMacroProvider.CONTEXT_OPTION,
|
||||
new OptionContextData(option, getDefaultConfiguration().getToolChain()));
|
||||
if(resolved != null && resolved.length > 0){
|
||||
for(int k = 0; k < resolved.length; k++){
|
||||
String string = resolved[k];
|
||||
if(string.length() > 0)
|
||||
libs.add(command + string);
|
||||
}
|
||||
}
|
||||
} catch (BuildMacroException e) {
|
||||
// TODO: report error
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -734,7 +751,24 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
|||
IOption option = opts[i];
|
||||
try {
|
||||
if (option.getValueType() == IOption.OBJECTS) {
|
||||
objs.addAll(Arrays.asList(option.getUserObjects()));
|
||||
String unresolved[] = option.getUserObjects();
|
||||
if(unresolved != null && unresolved.length > 0){
|
||||
for(int k = 0; k < unresolved.length; k++){
|
||||
try {
|
||||
String resolved[] = ManagedBuildManager.getBuildMacroProvider().resolveStringListValueToMakefileFormat(
|
||||
unresolved[k],
|
||||
"", //$NON-NLS-1$
|
||||
" ", //$NON-NLS-1$
|
||||
IBuildMacroProvider.CONTEXT_OPTION,
|
||||
new OptionContextData(option, getDefaultConfiguration().getToolChain()));
|
||||
if(resolved != null && resolved.length > 0)
|
||||
objs.addAll(Arrays.asList(resolved));
|
||||
} catch (BuildMacroException e) {
|
||||
// TODO: report error
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (BuildException e) {
|
||||
// TODO: report error
|
||||
|
|
|
@ -62,7 +62,7 @@ public class BuildMacroProvider implements IBuildMacroProvider {
|
|||
* @return
|
||||
*/
|
||||
static public IBuildMacro getMacro(String macroName, IMacroContextInfo contextInfo, boolean includeParentContexts) {
|
||||
if(contextInfo == null || macroName == null)
|
||||
if(contextInfo == null || macroName == null)
|
||||
return null;
|
||||
|
||||
do{
|
||||
|
@ -223,7 +223,7 @@ public class BuildMacroProvider implements IBuildMacroProvider {
|
|||
|
||||
IMacroContextInfo info = getMacroContextInfo(contextType,contextData);
|
||||
if(info != null)
|
||||
MacroResolver.resolveToStringList(value,getBuildfileMacroSubstitutor(info,nonexistentMacrosValue, listDelimiter));
|
||||
return MacroResolver.resolveToStringList(value,getBuildfileMacroSubstitutor(info,nonexistentMacrosValue, listDelimiter));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
|||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
||||
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
|
||||
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroSupplier;
|
||||
|
@ -151,10 +152,14 @@ public class DefaultMacroContextInfo implements IMacroContextInfo {
|
|||
IOptionContextData optionContext = (IOptionContextData)fData;
|
||||
IBuildObject buildObj = optionContext.getParent();
|
||||
IConfiguration cfg = null;
|
||||
if(buildObj instanceof ITool)
|
||||
buildObj = ((ITool)buildObj).getParent();
|
||||
if(buildObj instanceof IToolChain)
|
||||
cfg = ((IToolChain)buildObj).getParent();
|
||||
else if(buildObj instanceof IResourceConfiguration)
|
||||
cfg = ((IResourceConfiguration)buildObj).getParent();
|
||||
else if(buildObj instanceof IConfiguration)
|
||||
cfg = (IConfiguration)buildObj;
|
||||
|
||||
if(cfg != null){
|
||||
return new DefaultMacroContextInfo(
|
||||
|
|
|
@ -134,6 +134,11 @@ public class MbsMacroSupplier implements IBuildMacroSupplier {
|
|||
IOptionContextData optionContext = fContextData.getOptionContextData();
|
||||
if(optionContext != null){
|
||||
IBuildObject buildObject = optionContext.getParent();
|
||||
if(buildObject instanceof ITool){
|
||||
buildObject = ((ITool)buildObject).getParent();
|
||||
} else if(buildObject instanceof IConfiguration){
|
||||
buildObject = ((IConfiguration)buildObject).getToolChain();
|
||||
}
|
||||
if(buildObject instanceof IToolChain){
|
||||
IToolChain toolChain = (IToolChain)buildObject;
|
||||
builder = toolChain.getBuilder();
|
||||
|
@ -819,9 +824,14 @@ public class MbsMacroSupplier implements IBuildMacroSupplier {
|
|||
if (parent instanceof ITool) {
|
||||
tool = (ITool)parent;
|
||||
}
|
||||
final IBuildObject bo = (optionContext instanceof OptionData) ?
|
||||
IBuildObject bo = (optionContext instanceof OptionData) ?
|
||||
((OptionData)optionContext).getOptionContainer() : optionContext.getParent();
|
||||
IBuildObject parentObject = null;
|
||||
if(bo instanceof ITool)
|
||||
bo = ((ITool)bo).getParent();
|
||||
else if(bo instanceof IConfiguration)
|
||||
bo = ((IConfiguration)bo).getToolChain();
|
||||
|
||||
if(tool != null && bo instanceof IResourceConfiguration){
|
||||
|
||||
IToolChain toolChain = null;
|
||||
|
|
Loading…
Add table
Reference in a new issue