mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +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,10 +425,27 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
String[] allLibs = option.getLibraries();
|
String[] allLibs = option.getLibraries();
|
||||||
for (int j = 0; j < allLibs.length; j++)
|
for (int j = 0; j < allLibs.length; j++)
|
||||||
{
|
{
|
||||||
String string = allLibs[j];
|
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);
|
libs.add(command + string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (BuildMacroException e) {
|
||||||
|
// TODO: report error
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (BuildException e) {
|
} catch (BuildException e) {
|
||||||
// TODO: report error
|
// TODO: report error
|
||||||
|
@ -734,7 +751,24 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
IOption option = opts[i];
|
IOption option = opts[i];
|
||||||
try {
|
try {
|
||||||
if (option.getValueType() == IOption.OBJECTS) {
|
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) {
|
} catch (BuildException e) {
|
||||||
// TODO: report error
|
// TODO: report error
|
||||||
|
|
|
@ -223,7 +223,7 @@ public class BuildMacroProvider implements IBuildMacroProvider {
|
||||||
|
|
||||||
IMacroContextInfo info = getMacroContextInfo(contextType,contextData);
|
IMacroContextInfo info = getMacroContextInfo(contextType,contextData);
|
||||||
if(info != null)
|
if(info != null)
|
||||||
MacroResolver.resolveToStringList(value,getBuildfileMacroSubstitutor(info,nonexistentMacrosValue, listDelimiter));
|
return MacroResolver.resolveToStringList(value,getBuildfileMacroSubstitutor(info,nonexistentMacrosValue, listDelimiter));
|
||||||
return null;
|
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.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
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.core.IToolChain;
|
||||||
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
|
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroSupplier;
|
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroSupplier;
|
||||||
|
@ -151,10 +152,14 @@ public class DefaultMacroContextInfo implements IMacroContextInfo {
|
||||||
IOptionContextData optionContext = (IOptionContextData)fData;
|
IOptionContextData optionContext = (IOptionContextData)fData;
|
||||||
IBuildObject buildObj = optionContext.getParent();
|
IBuildObject buildObj = optionContext.getParent();
|
||||||
IConfiguration cfg = null;
|
IConfiguration cfg = null;
|
||||||
|
if(buildObj instanceof ITool)
|
||||||
|
buildObj = ((ITool)buildObj).getParent();
|
||||||
if(buildObj instanceof IToolChain)
|
if(buildObj instanceof IToolChain)
|
||||||
cfg = ((IToolChain)buildObj).getParent();
|
cfg = ((IToolChain)buildObj).getParent();
|
||||||
else if(buildObj instanceof IResourceConfiguration)
|
else if(buildObj instanceof IResourceConfiguration)
|
||||||
cfg = ((IResourceConfiguration)buildObj).getParent();
|
cfg = ((IResourceConfiguration)buildObj).getParent();
|
||||||
|
else if(buildObj instanceof IConfiguration)
|
||||||
|
cfg = (IConfiguration)buildObj;
|
||||||
|
|
||||||
if(cfg != null){
|
if(cfg != null){
|
||||||
return new DefaultMacroContextInfo(
|
return new DefaultMacroContextInfo(
|
||||||
|
|
|
@ -134,6 +134,11 @@ public class MbsMacroSupplier implements IBuildMacroSupplier {
|
||||||
IOptionContextData optionContext = fContextData.getOptionContextData();
|
IOptionContextData optionContext = fContextData.getOptionContextData();
|
||||||
if(optionContext != null){
|
if(optionContext != null){
|
||||||
IBuildObject buildObject = optionContext.getParent();
|
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){
|
if(buildObject instanceof IToolChain){
|
||||||
IToolChain toolChain = (IToolChain)buildObject;
|
IToolChain toolChain = (IToolChain)buildObject;
|
||||||
builder = toolChain.getBuilder();
|
builder = toolChain.getBuilder();
|
||||||
|
@ -819,9 +824,14 @@ public class MbsMacroSupplier implements IBuildMacroSupplier {
|
||||||
if (parent instanceof ITool) {
|
if (parent instanceof ITool) {
|
||||||
tool = (ITool)parent;
|
tool = (ITool)parent;
|
||||||
}
|
}
|
||||||
final IBuildObject bo = (optionContext instanceof OptionData) ?
|
IBuildObject bo = (optionContext instanceof OptionData) ?
|
||||||
((OptionData)optionContext).getOptionContainer() : optionContext.getParent();
|
((OptionData)optionContext).getOptionContainer() : optionContext.getParent();
|
||||||
IBuildObject parentObject = null;
|
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){
|
if(tool != null && bo instanceof IResourceConfiguration){
|
||||||
|
|
||||||
IToolChain toolChain = null;
|
IToolChain toolChain = null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue