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
|
@ -260,18 +260,21 @@ public class BuildStep implements IBuildStep {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(step != null && (step = step.trim()).length() > 0){
|
if(step != null && (step = step.trim()).length() > 0){
|
||||||
String commands[] = step.split(";"); //$NON-NLS-1$
|
step = resolveMacros(step, resolveAll);
|
||||||
if(cwd == null)
|
if(step != null && (step = step.trim()).length() > 0){
|
||||||
cwd = calcCWD();
|
String commands[] = step.split(";"); //$NON-NLS-1$
|
||||||
|
if(cwd == null)
|
||||||
|
cwd = calcCWD();
|
||||||
|
|
||||||
List list = new ArrayList();
|
List list = new ArrayList();
|
||||||
for(int i = 0; i < commands.length; i++){
|
for(int i = 0; i < commands.length; i++){
|
||||||
IBuildCommand cmds[] = createCommandsFromString(commands[i], cwd, getEnvironment());
|
IBuildCommand cmds[] = createCommandsFromString(commands[i], cwd, getEnvironment());
|
||||||
for(int j = 0; j < cmds.length; j++){
|
for(int j = 0; j < cmds.length; j++){
|
||||||
list.add(cmds[j]);
|
list.add(cmds[j]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
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