// Check if we have to do something
if (isUpToDate(descriptor, descr, destFile))
return;
final Jar jarTask = new Jar();
jarTask.setProject(getProject());
jarTask.setTaskName(getTaskName());
jarTask.setDestFile(destFile);
jarTask.setCompress(false);
// Add plugin.xml
final File tmpPluginDir;
final File tmpPluginXmlFile;
try {
tmpPluginDir = new File(tmpDir, "jnode-plugins" + File.separator + fullId);
tmpPluginDir.mkdirs();
tmpPluginXmlFile = new File(tmpPluginDir, "plugin.xml");
FileUtils.newFileUtils().copyFile(descriptor, tmpPluginXmlFile);
FileSet fs = new FileSet();
fs.setDir(tmpPluginDir);
fs.createInclude().setName("plugin.xml");
jarTask.addFileset(fs);
} catch (IOException ex) {
throw new BuildException(ex);
}
// Create manifest
try {
jarTask.addConfiguredManifest(createManifest(descr));
} catch (ManifestException ex) {
throw new BuildException(ex);
}
// Add runtime resources
final Runtime rt = descr.getRuntime();
if (rt != null) {
final HashMap<File, ZipFileSet> fileSets = new HashMap<File, ZipFileSet>();
final Library[] libs = rt.getLibraries();
for (int l = 0; l < libs.length; l++) {
processLibrary(jarTask, libs[l], fileSets, getPluginDir());
}
}
jarTask.execute();
}