mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for [Bug 197973] Internal builder does not use outputPrefix
This commit is contained in:
parent
2bcffd1b40
commit
ac83768385
3 changed files with 46 additions and 6 deletions
|
@ -1083,6 +1083,17 @@ public class BuildDescription implements IBuildDescription {
|
||||||
} catch (BuildMacroException e) {
|
} catch (BuildMacroException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String artifactPrefix = tool.getOutputPrefix();
|
||||||
|
if(artifactPrefix != null && artifactPrefix.length() != 0){
|
||||||
|
try {
|
||||||
|
String tmp = ManagedBuildManager.getBuildMacroProvider().resolveValue(artifactPrefix, "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, fCfg); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
if((tmp = tmp.trim()).length() > 0)
|
||||||
|
artifactPrefix = tmp;
|
||||||
|
} catch (BuildMacroException e){
|
||||||
|
}
|
||||||
|
artifactName = artifactPrefix + artifactName;
|
||||||
|
}
|
||||||
|
|
||||||
IPath path = new Path(artifactName);
|
IPath path = new Path(artifactName);
|
||||||
if(artifactExt != null && artifactExt.length() != 0)
|
if(artifactExt != null && artifactExt.length() != 0)
|
||||||
path = path.addFileExtension(artifactExt);
|
path = path.addFileExtension(artifactExt);
|
||||||
|
|
|
@ -196,4 +196,16 @@ public class BuildResource implements IBuildResource {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
StringBuffer buf = new StringBuffer();
|
||||||
|
buf.append("BR ");
|
||||||
|
IPath fullPath = getFullPath();
|
||||||
|
if(fullPath != null)
|
||||||
|
buf.append("WSP|").append(fullPath);
|
||||||
|
else
|
||||||
|
buf.append("FS|").append(getLocation());
|
||||||
|
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,21 +288,35 @@ public class BuildStep implements IBuildStep {
|
||||||
|
|
||||||
IManagedCommandLineGenerator gen = fTool.getCommandLineGenerator();
|
IManagedCommandLineGenerator gen = fTool.getCommandLineGenerator();
|
||||||
FileContextData data = new FileContextData(inRcPath, outRcPath, null, fTool);
|
FileContextData data = new FileContextData(inRcPath, outRcPath, null, fTool);
|
||||||
|
String outPrefix = fTool.getOutputPrefix();
|
||||||
|
outPrefix = resolveMacros(outPrefix, data, true);
|
||||||
|
outRcPath = rmNamePrefix(outRcPath, outPrefix);
|
||||||
|
|
||||||
IManagedCommandLineInfo info = gen.generateCommandLineInfo(fTool,
|
IManagedCommandLineInfo info = gen.generateCommandLineInfo(fTool,
|
||||||
fTool.getToolCommand(),
|
fTool.getToolCommand(),
|
||||||
getCommandFlags(inRcPath, outRcPath, resolveAll),
|
getCommandFlags(inRcPath, outRcPath, resolveAll),
|
||||||
fTool.getOutputFlag(),
|
fTool.getOutputFlag(),
|
||||||
fTool.getOutputPrefix(),
|
outPrefix,
|
||||||
listToString(resourcesToStrings(cwd, getPrimaryResources(false)), " "), //$NON-NLS-1$
|
listToString(resourcesToStrings(cwd, getPrimaryResources(false), outPrefix), " "), //$NON-NLS-1$
|
||||||
getInputResources(cwd, getPrimaryResources(true)),
|
getInputResources(cwd, getPrimaryResources(true)),
|
||||||
fTool.getCommandLinePattern());
|
fTool.getCommandLinePattern());
|
||||||
|
|
||||||
return createCommandsFromString(resolveMacros(info.getCommandLine(), data, true), cwd, getEnvironment());
|
return createCommandsFromString(resolveMacros(info.getCommandLine(), data, true), cwd, getEnvironment());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IPath rmNamePrefix(IPath path, String prefix){
|
||||||
|
if(prefix != null && prefix.length() != 0){
|
||||||
|
String name = path.lastSegment();
|
||||||
|
if(name.startsWith(prefix)){
|
||||||
|
name = name.substring(prefix.length());
|
||||||
|
path = path.removeLastSegments(1).append(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
private String[] getInputResources(IPath cwd, BuildResource[] rcs) {
|
private String[] getInputResources(IPath cwd, BuildResource[] rcs) {
|
||||||
String[] resources = resourcesToStrings(cwd, rcs);
|
String[] resources = resourcesToStrings(cwd, rcs, null);
|
||||||
|
|
||||||
// also need to get libraries
|
// also need to get libraries
|
||||||
String[] libs = null;
|
String[] libs = null;
|
||||||
|
@ -417,14 +431,17 @@ public class BuildStep implements IBuildStep {
|
||||||
return (BuildResource[])list.toArray(new BuildResource[list.size()]);
|
return (BuildResource[])list.toArray(new BuildResource[list.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] resourcesToStrings(IPath cwd, BuildResource rcs[]){
|
private String[] resourcesToStrings(IPath cwd, BuildResource rcs[], String prefixToRm){
|
||||||
List list = new ArrayList(rcs.length);
|
List list = new ArrayList(rcs.length);
|
||||||
|
|
||||||
for(int i = 0; i < rcs.length; i++){
|
for(int i = 0; i < rcs.length; i++){
|
||||||
list.add(BuildDescriptionManager.getRelPath(cwd, rcs[i].getLocation()).toOSString());
|
IPath path = BuildDescriptionManager.getRelPath(cwd, rcs[i].getLocation());
|
||||||
|
path = rmNamePrefix(path, prefixToRm);
|
||||||
|
list.add(path.toOSString());
|
||||||
}
|
}
|
||||||
return (String[])list.toArray(new String[list.size()]);
|
return (String[])list.toArray(new String[list.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String resolveMacros(String str, IFileContextData fileData, boolean resolveAll){
|
private String resolveMacros(String str, IFileContextData fileData, boolean resolveAll){
|
||||||
String result = str;
|
String result = str;
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Reference in a new issue