mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 10:46:02 +02:00
Fix for [Bug 196852] Internal Builder does not expand macros in pre- and post- build steps
This commit is contained in:
parent
18e36b75d0
commit
868b714c51
1 changed files with 29 additions and 11 deletions
|
@ -259,6 +259,8 @@ public class BuildStep implements IBuildStep {
|
||||||
step = fBuildDescription.getConfiguration().getPostbuildStep();
|
step = fBuildDescription.getConfiguration().getPostbuildStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(step != null && (step = step.trim()).length() > 0){
|
||||||
|
step = resolveMacros(step, resolveAll);
|
||||||
if(step != null && (step = step.trim()).length() > 0){
|
if(step != null && (step = step.trim()).length() > 0){
|
||||||
String commands[] = step.split(";"); //$NON-NLS-1$
|
String commands[] = step.split(";"); //$NON-NLS-1$
|
||||||
if(cwd == null)
|
if(cwd == null)
|
||||||
|
@ -273,6 +275,7 @@ public class BuildStep implements IBuildStep {
|
||||||
}
|
}
|
||||||
return (IBuildCommand[])list.toArray(new BuildCommand[list.size()]);
|
return (IBuildCommand[])list.toArray(new BuildCommand[list.size()]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return new IBuildCommand[0];
|
return new IBuildCommand[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,6 +462,21 @@ public class BuildStep implements IBuildStep {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String resolveMacros(String str, boolean resolveAll){
|
||||||
|
String result = str;
|
||||||
|
try {
|
||||||
|
IConfiguration cfg = getBuildDescription().getConfiguration();
|
||||||
|
if(resolveAll){
|
||||||
|
result = ManagedBuildManager.getBuildMacroProvider().resolveValue(str, "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, cfg); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
} else {
|
||||||
|
result = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(str, "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, cfg); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
}
|
||||||
|
} catch (CdtVariableException e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private SupplierBasedCdtVariableSubstitutor createSubstitutor(IConfiguration cfg, IBuilder builder, IFileContextData fileData){
|
private SupplierBasedCdtVariableSubstitutor createSubstitutor(IConfiguration cfg, IBuilder builder, IFileContextData fileData){
|
||||||
BuildMacroProvider prov = (BuildMacroProvider)ManagedBuildManager.getBuildMacroProvider();
|
BuildMacroProvider prov = (BuildMacroProvider)ManagedBuildManager.getBuildMacroProvider();
|
||||||
IMacroContextInfo info = prov.getMacroContextInfo(IBuildMacroProvider.CONTEXT_FILE, fileData);
|
IMacroContextInfo info = prov.getMacroContextInfo(IBuildMacroProvider.CONTEXT_FILE, fileData);
|
||||||
|
|
Loading…
Add table
Reference in a new issue