1
0
Fork 0
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:
Mikhail Sennikovsky 2007-08-10 11:04:48 +00:00
parent 2bcffd1b40
commit ac83768385
3 changed files with 46 additions and 6 deletions

View file

@ -1083,6 +1083,17 @@ public class BuildDescription implements IBuildDescription {
} 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);
if(artifactExt != null && artifactExt.length() != 0)
path = path.addFileExtension(artifactExt);

View file

@ -196,4 +196,16 @@ public class BuildResource implements IBuildResource {
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();
}
}

View file

@ -288,21 +288,35 @@ public class BuildStep implements IBuildStep {
IManagedCommandLineGenerator gen = fTool.getCommandLineGenerator();
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,
fTool.getToolCommand(),
getCommandFlags(inRcPath, outRcPath, resolveAll),
fTool.getOutputFlag(),
fTool.getOutputPrefix(),
listToString(resourcesToStrings(cwd, getPrimaryResources(false)), " "), //$NON-NLS-1$
outPrefix,
listToString(resourcesToStrings(cwd, getPrimaryResources(false), outPrefix), " "), //$NON-NLS-1$
getInputResources(cwd, getPrimaryResources(true)),
fTool.getCommandLinePattern());
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) {
String[] resources = resourcesToStrings(cwd, rcs);
String[] resources = resourcesToStrings(cwd, rcs, null);
// also need to get libraries
String[] libs = null;
@ -417,14 +431,17 @@ public class BuildStep implements IBuildStep {
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);
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()]);
}
private String resolveMacros(String str, IFileContextData fileData, boolean resolveAll){
String result = str;
try {