/*
* If we are writing to an output directory copy the manifest but only if we already have one
*/
private void writeManifest() throws IOException {
Manifest manifest = getWeaver().getManifest(false);
if (manifest != null && zos == null) {
File outputDir = buildConfig.getOutputDir();
if (buildConfig.getCompilationResultDestinationManager() != null) {
// Manifests are only written if we have a jar on the inpath. Therefore,
// we write the manifest to the defaultOutputLocation because this is
// where we sent the classes that were on the inpath
outputDir = buildConfig.getCompilationResultDestinationManager().getDefaultOutputLocation();
}
if (outputDir == null) {
return;
}
File outputLocation = new File(outputDir, MANIFEST_NAME);
OutputStream fos = FileUtil.makeOutputStream(outputLocation);
manifest.write(fos);
fos.close();
if (buildConfig.getCompilationResultDestinationManager() != null) {
buildConfig.getCompilationResultDestinationManager().reportFileWrite(outputLocation.getPath(),
CompilationResultDestinationManager.FILETYPE_RESOURCE);
}