mako: Support interfaces without property
If a settings interface contains no property, the code get compiles
failure that the cereal does not know how to de-serialize the object.
It turns out that if an interface has no property, it does not need to
serialize/de-serialize the properties at all.
Add a check in mako to skip the above for interfaces without properties,
and then the code compiles fine.
Tested: Verify we could add an interface without property to a DBus
object, e.g. xyz.openbmc_project.Inventory.Item.Bmc
Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I68a9e689c2e2a9da65c8b090ac925baebd27733a
diff --git a/settings_manager.mako.hpp b/settings_manager.mako.hpp
index 36cb486..f233a7e 100644
--- a/settings_manager.mako.hpp
+++ b/settings_manager.mako.hpp
@@ -213,7 +213,9 @@
props.extend(intfProps)
props = ', '.join(props)
%>\
+% if props:
a(${props});
+% endif
}
template<class Archive>
@@ -232,7 +234,10 @@
% endfor
% endfor
<% props = ', '.join(props) %>
+% if props:
a(${props});
+% endif
+
<% props = [] %>
% for index, item in enumerate(settingsDict[object]):
% for prop, metaDict in item['Properties'].items():