use of org.apache.ivy.osgi.core.ExecutionEnvironmentProfileProvider in project ant-ivy by apache.
the class ConvertManifestTask method doExecute.
public void doExecute() throws BuildException {
if (ivyFile == null) {
throw new BuildException("destination ivy file is required for convertmanifest task");
}
if (manifest == null) {
throw new BuildException("source manifest file is required for convertmanifest task");
}
if (profileProvider == null) {
try {
profileProvider = new ExecutionEnvironmentProfileProvider();
} catch (IOException e) {
throw new BuildException("Enable to load the default environment profiles", e);
}
}
Manifest m;
try {
m = new Manifest(new FileInputStream(manifest));
} catch (FileNotFoundException e) {
throw new BuildException("the manifest file '" + manifest + "' was not found", e);
} catch (IOException e) {
throw new BuildException("the manifest file '" + manifest + "' could not be read", e);
}
BundleInfo bundleInfo;
try {
bundleInfo = ManifestParser.parseManifest(m);
} catch (ParseException e) {
throw new BuildException("Incorrect manifest file '" + manifest + "'", e);
}
ModuleDescriptor md = BundleInfoAdapter.toModuleDescriptor(OSGiManifestParser.getInstance(), null, bundleInfo, m, profileProvider);
try {
XmlModuleDescriptorWriter.write(md, ivyFile);
} catch (IOException e) {
throw new BuildException("The ivyFile '" + ivyFile + "' could not be written", e);
}
}
Aggregations