try {
// try to resolve the build macros in the output
// names
String resolved = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(outputName, "", //$NON-NLS-1$
" ", //$NON-NLS-1$
IBuildMacroProvider.CONTEXT_OPTION, new OptionContextData(option, tool));
if ((resolved = resolved.trim()).length() > 0)
outputs.set(j, resolved);
} catch (BuildMacroException e) {// JABA is not
// going to add
// code
}
}
// NO - myCommandOutputs.addAll(outputs);
typeEnumeratedOutputs.addAll(outputs);
if (variable.length() > 0) {
List<IPath> outputPaths = new ArrayList<IPath>();
for (int j = 0; j < outputs.size(); j++) {
outputPaths.add(Path.fromOSString(outputs.get(j)));
}
if (myOutputMacros.containsKey(variable)) {
List<IPath> currList = myOutputMacros.get(variable);
currList.addAll(outputPaths);
myOutputMacros.put(variable, currList);
} else {
myOutputMacros.put(variable, outputPaths);
}
}
} catch (BuildException ex) {// JABA is not going to add
// code
}
} else
// 3. If a nameProvider is specified, call it
if (nameProvider != null) {
// The inputs must have been calculated before we can do
// this
IPath[] outNames = null;
if (!inputsCalculated) {
done = false;
} else {
Vector<String> inputs = getEnumeratedInputs();
IPath[] inputPaths = new IPath[inputs.size()];
for (int j = 0; j < inputPaths.length; j++) {
inputPaths[j] = Path.fromOSString(inputs.get(j));
}
// JABA: I inserted this code to cater for bin or hex
// extensions based on the board. Basically you need the
// Project
// to get to information to know whether this is a sam
// or avr project (having it in the platform file would
// be easier)
// To make it as much compliant as possible with the
// "CDT way" I added a getOutputNames which takes al the
// info needed to
// know the correct output name
// if (inputPaths.length == 0) {
try {
IManagedOutputNameProviderJaba newNameProvider = (IManagedOutputNameProviderJaba) nameProvider;
outNames = newNameProvider.getOutputNames(project, config, tool, inputPaths);
} catch (Exception e) {
// The provided class is not a
// IManagedOutputNameProviderJaba class;
Common.log(new Status(IStatus.ERROR, ArduinoConst.CORE_PLUGIN_ID,
"The provided class is not of type IManagedOutputNameProviderJaba", e));
}
// } else {
// outNames = nameProvider.getOutputNames(tool,
// inputPaths);
// }
// JABA end of insertion
if (outNames != null) {
for (int j = 0; j < outNames.length; j++) {
String outputName = outNames[j].toString();
try {
// try to resolve the build macros in the
// output names
String resolved = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(outputName, "", //$NON-NLS-1$
" ", //$NON-NLS-1$
IBuildMacroProvider.CONTEXT_CONFIGURATION, config);
if ((resolved = resolved.trim()).length() > 0) {
outputName = resolved;
outNames[j] = Path.fromOSString(resolved);
}
} catch (BuildMacroException e) {// JABA is not
// going to add
// code
}
if (primaryOutput) {
myCommandOutputs.add(outputName);
}
typeEnumeratedOutputs.add(outputName);
}
}
}
if (variable.length() > 0 && outNames != null) {
if (myOutputMacros.containsKey(variable)) {
List<IPath> currList = myOutputMacros.get(variable);
currList.addAll(Arrays.asList(outNames));
myOutputMacros.put(variable, currList);
} else {
myOutputMacros.put(variable, new ArrayList<IPath>(Arrays.asList(outNames)));
}
}
} else
// 4. If outputNames is specified, use it
if (outputNames != null) {
if (outputNames.length > 0) {
for (int j = 0; j < outputNames.length; j++) {
String outputName = outputNames[j];
try {
// try to resolve the build macros in the output
// names
String resolved = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(outputName, "", //$NON-NLS-1$
" ", //$NON-NLS-1$
IBuildMacroProvider.CONTEXT_OPTION, new OptionContextData(option, tool));
if ((resolved = resolved.trim()).length() > 0)
outputNames[j] = resolved;
} catch (BuildMacroException e) {// JABA is not
// going to add
// code