* @return
*/
public ISigilBundle getBundle(String id, IBldBundle bundle)
{
ISigilBundle sigilBundle = new SigilBundle();
IBundleModelElement info = new BundleModelElement();
sigilBundle.setBundleInfo(info);
// exports
// FIXME: UI doesn't understand export wildcard packages
for (IPackageExport export : bundle.getExports())
{
IPackageExport clone = (IPackageExport) export.clone();
clone.setParent(null);
info.addExport(clone);
}
// imports
for (IPackageImport import1 : bundle.getImports())
{
IPackageImport clone = (IPackageImport) import1.clone();
clone.setParent(null);
info.addImport(clone);
}
// requires
for (IRequiredBundle require : bundle.getRequires())
{
IRequiredBundle clone = (IRequiredBundle) require.clone();
clone.setParent(null);
info.addRequiredBundle(clone);
}
// fragment
IRequiredBundle fragment = bundle.getFragmentHost();
if (fragment != null)
{
info.setFragmentHost(fragment);
}
// contents
for (String pkg : bundle.getContents())
{
sigilBundle.addPackage(pkg);
}
// sources
for (String source : config.getList(null, BldConfig.L_SRC_CONTENTS))
{
sigilBundle.addClasspathEntry(String.format(classpathFormat, "src", source));
}
// libs
Map<String, Map<String, String>> libs = bundle.getLibs();
for (String path : libs.keySet())
{
Map<String, String> attr = libs.get(path);
String kind = attr.get(BldAttr.KIND_ATTRIBUTE);
if ("classpath".equals(kind))
{
sigilBundle.addClasspathEntry(String.format(classpathFormat, "lib", path));
}
else
{
BldCore.error("Can't convert -libs kind=" + kind);
}
}
// resources
// FIXME: UI doesn't support -resources: path1=path2
List<Resource> resources = bundle.getResources();
for (Resource resource : resources)
{
sigilBundle.addSourcePath(resource);
}
////////////////////
// simple headers