return root;
}
private ServiceRegistration registerBatchedModulesDescriptor()
{
ModuleDescriptor webResourceModuleDescriptor = descriptor.createIndividualModuleDescriptor();
Element root = createElement("web-resource");
for (Element child : new HashSet<Element>(descriptor.getOriginalElement().elements()))
{
root.add(child.createCopy());
}
Element depElement = root.addElement("dependency");
depElement.setText("com.atlassian.labs.speakeasy-plugin:yabble");
Element jsTransform = getJsTransformation(root);
Element trans = jsTransform.addElement("transformer");
trans.addAttribute("key", "commonjs-module");
trans.addAttribute("fullModuleKey", descriptor.getCompleteKey());
for (String id : modules.getModuleIds())
{
Element res = root.addElement("resource");
res.addAttribute("type", "download");
res.addAttribute("name", id + ".js");
res.addAttribute("location", modules.getModulePath(id));
JsDoc jsDoc = modules.getModule(id).getJsDoc();
addAnnotatedDependencies(root, descriptor.getPluginKey(), jsDoc);
}
for (String dep : resolvedExternalModules)
{
Element extDep = root.addElement("dependency");
extDep.setText(dep);
}
for (String resourcePath : modules.getResources())
{
Element res = root.addElement("resource");
res.addAttribute("type", "download");
res.addAttribute("name", resourcePath);
res.addAttribute("location", descriptor.getLocation() + "/" + resourcePath);
}
Element muTrans = root.addElement("transformation");
muTrans.addAttribute("extension", "mu");
trans = muTrans.addElement("transformer");
trans.addAttribute("key", "template");
String generatedModuleKey = descriptor.getKey() + "-modules";
Element cssTrans = root.addElement("transformation");
cssTrans.addAttribute("extension", "css");
trans = cssTrans.addElement("transformer");
trans.addAttribute("key", "cssVariables");
trans.addAttribute("fullModuleKey", descriptor.getPluginKey() + ":" + generatedModuleKey);
webResourceModuleDescriptor.init(descriptor.getPlugin(),
createDescriptorElement(generatedModuleKey, root));
return pluginBundle.getBundleContext().registerService(ModuleDescriptor.class.getName(), webResourceModuleDescriptor, null);
}