7 from .manifest
import enforce_tabbing_helper
8 from .util
import roscompile
10 PLUGIN_PATTERN =
r'PLUGINLIB_EXPORT_CLASS\(([^:]+)::([^,]+),\s*([^:]+)::([^,]+)\)'
11 PLUGIN_RE = re.compile(PLUGIN_PATTERN)
15 xmls = collections.defaultdict(list)
16 for xml
in package.plugin_configs:
17 for parent_pkg
in xml.parent_pkgs:
18 xmls[parent_pkg].append(xml)
24 if xml.contains_library(library, pkg, name):
30 for library, deps
in build_rules.items():
37 """Check that all the plugins are properly defined.
39 We have three dictionaries
40 * The plugins that are defined by macros (defined_macros)
41 * The plugins that have associated configuration files (existing_plugins)
42 * The plugins that are linked by the manifest. (plugin_xml_by_package)
43 First, we reconcile the macros with the files.
44 Then we handle the manifest.
45 Then we make sure that the specific classes are in the configurations
49 defined_macros = package.source_code.search_for_pattern(PLUGIN_RE)
51 defined_plugins = package.manifest.get_plugin_xmls()
52 build_rules = package.cmake.get_source_build_rules(
'add_library', resolve_target_name=
True)
54 for rel_fn, plugin_info
in defined_macros.items():
57 for pkg1, name1, pkg2, name2
in plugin_info:
59 if pkg2
not in existing_plugins:
60 xml_filename =
'%s_plugins.xml' % pkg2
61 print(
'\tCreating %s' % xml_filename)
62 p_xml =
PluginXML(xml_filename, os.path.join(package.root, xml_filename))
63 package.plugin_configs.append(p_xml)
64 existing_plugins[pkg2] = [p_xml]
67 for plugin_xml
in existing_plugins[pkg2]:
68 if plugin_xml.rel_fn
not in defined_plugins[pkg2]:
69 ex_el = package.manifest.add_plugin_export(pkg2, plugin_xml.rel_fn)
75 xml = existing_plugins[pkg2][0]
76 xml.insert_new_class(library, pkg1, name1, pkg2, name2)