1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-12 18:55:38 +02:00

Bug 422378: allow case of getOutputNames() returning null

Allow GnuMakefileGenerator to completely ignore an input file

Change-Id: If4b45db8482b273f4729211d55cfa4f201760b29
Signed-off-by: jantje <eclipse@baeyens.it>
This commit is contained in:
jantje 2016-10-21 02:02:23 +02:00 committed by Jonah Graham
parent 5d6f8c3b2b
commit 5cafc1413a

View file

@ -3256,58 +3256,60 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
IPath[] inPaths = new IPath[1]; IPath[] inPaths = new IPath[1];
inPaths[0] = sourceLocation; inPaths[0] = sourceLocation;
IPath[] outPaths = nameProvider.getOutputNames(tool, inPaths); IPath[] outPaths = nameProvider.getOutputNames(tool, inPaths);
for (int j=0; j<outPaths.length; j++) { if (outPaths != null) {
IPath outPath = outPaths[j]; for (int j=0; j<outPaths.length; j++) {
String outputName = outPaths[j].toString(); IPath outPath = outPaths[j];
String outputName = outPaths[j].toString();
// try to resolve the build macros in the output names // try to resolve the build macros in the output names
try { try {
String resolved = null; String resolved = null;
if (containsSpecialCharacters(sourceLocation.toString())) if (containsSpecialCharacters(sourceLocation.toString()))
{ {
resolved = ManagedBuildManager resolved = ManagedBuildManager
.getBuildMacroProvider() .getBuildMacroProvider()
.resolveValue( .resolveValue(
outputName, outputName,
"", //$NON-NLS-1$ "", //$NON-NLS-1$
" ", //$NON-NLS-1$ " ", //$NON-NLS-1$
IBuildMacroProvider.CONTEXT_FILE, IBuildMacroProvider.CONTEXT_FILE,
new FileContextData( new FileContextData(
sourceLocation, null, sourceLocation, null,
option, tool)); option, tool));
}
else {
resolved = ManagedBuildManager
.getBuildMacroProvider()
.resolveValueToMakefileFormat(
outputName,
"", //$NON-NLS-1$
" ", //$NON-NLS-1$
IBuildMacroProvider.CONTEXT_FILE,
new FileContextData(
sourceLocation, null,
option, tool));
}
if ((resolved = resolved.trim()).length() > 0)
outputName = resolved;
} catch (BuildMacroException e) {
} }
else { // If only a file name is specified, add the relative path of this output directory
resolved = ManagedBuildManager if (outPath.segmentCount() == 1) {
.getBuildMacroProvider() outPath = Path.fromOSString(relativePath + outPath.toString());
.resolveValueToMakefileFormat( }
outputName, if (primaryOutput) {
"", //$NON-NLS-1$ ruleOutputs.add(j, outPath);
" ", //$NON-NLS-1$ enumeratedPrimaryOutputs.add(j, resolvePercent(outPath, sourceLocation));
IBuildMacroProvider.CONTEXT_FILE, } else {
new FileContextData( ruleOutputs.add(outPath);
sourceLocation, null, enumeratedSecondaryOutputs.add(resolvePercent(outPath, sourceLocation));
option, tool));
} }
if ((resolved = resolved.trim()).length() > 0)
outputName = resolved;
} catch (BuildMacroException e) {
}
// If only a file name is specified, add the relative path of this output directory
if (outPath.segmentCount() == 1) {
outPath = Path.fromOSString(relativePath + outPath.toString());
}
if (primaryOutput) {
ruleOutputs.add(j, outPath);
enumeratedPrimaryOutputs.add(j, resolvePercent(outPath, sourceLocation));
} else {
ruleOutputs.add(outPath);
enumeratedSecondaryOutputs.add(resolvePercent(outPath, sourceLocation));
} }
} }
} else } else