summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYifan Hong2017-08-21 20:39:29 -0500
committerYifan Hong2017-08-23 17:29:15 -0500
commitee8bc5e17a95c1abb4587550f61dc32790d1df51 (patch)
treec0a4f269de6b36e3ae671c9225e8897d6a6b643a /parse_xml.cpp
parentcef6437c31623647ec2200d46272f7ac5485aeb1 (diff)
downloadplatform-system-libvintf-ee8bc5e17a95c1abb4587550f61dc32790d1df51.tar.gz
platform-system-libvintf-ee8bc5e17a95c1abb4587550f61dc32790d1df51.tar.xz
platform-system-libvintf-ee8bc5e17a95c1abb4587550f61dc32790d1df51.zip
Add <conditions> to <kernel> in framework compat mat
When <conditions> are present, the <kernel> tag is only checked when all conditions are met. This is to support arch-specific kernel config requirements. Test: libvintf_test Bug: 64124223 Change-Id: I91ecd115ca42473b79bda24d9b8613eed817e7e2 Merged-In: I91ecd115ca42473b79bda24d9b8613eed817e7e2
Diffstat (limited to 'parse_xml.cpp')
-rw-r--r--parse_xml.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/parse_xml.cpp b/parse_xml.cpp
index 5239275..df3cb54 100644
--- a/parse_xml.cpp
+++ b/parse_xml.cpp
@@ -549,14 +549,31 @@ struct MatrixHalConverter : public XmlNodeConverter<MatrixHal> {
549 549
550const MatrixHalConverter matrixHalConverter{}; 550const MatrixHalConverter matrixHalConverter{};
551 551
552struct MatrixKernelConditionsConverter : public XmlNodeConverter<std::vector<KernelConfig>> {
553 std::string elementName() const override { return "conditions"; }
554 void mutateNode(const std::vector<KernelConfig>& conds, NodeType* root,
555 DocType* d) const override {
556 appendChildren(root, kernelConfigConverter, conds, d);
557 }
558 bool buildObject(std::vector<KernelConfig>* object, NodeType* root) const override {
559 return parseChildren(root, kernelConfigConverter, object);
560 }
561};
562
563const MatrixKernelConditionsConverter matrixKernelConditionsConverter{};
564
552struct MatrixKernelConverter : public XmlNodeConverter<MatrixKernel> { 565struct MatrixKernelConverter : public XmlNodeConverter<MatrixKernel> {
553 std::string elementName() const override { return "kernel"; } 566 std::string elementName() const override { return "kernel"; }
554 void mutateNode(const MatrixKernel &kernel, NodeType *root, DocType *d) const override { 567 void mutateNode(const MatrixKernel &kernel, NodeType *root, DocType *d) const override {
555 appendAttr(root, "version", kernel.mMinLts); 568 appendAttr(root, "version", kernel.mMinLts);
569 if (!kernel.mConditions.empty()) {
570 appendChild(root, matrixKernelConditionsConverter(kernel.mConditions, d));
571 }
556 appendChildren(root, kernelConfigConverter, kernel.mConfigs, d); 572 appendChildren(root, kernelConfigConverter, kernel.mConfigs, d);
557 } 573 }
558 bool buildObject(MatrixKernel *object, NodeType *root) const override { 574 bool buildObject(MatrixKernel *object, NodeType *root) const override {
559 if (!parseAttr(root, "version", &object->mMinLts) || 575 if (!parseAttr(root, "version", &object->mMinLts) ||
576 !parseOptionalChild(root, matrixKernelConditionsConverter, {}, &object->mConditions) ||
560 !parseChildren(root, kernelConfigConverter, &object->mConfigs)) { 577 !parseChildren(root, kernelConfigConverter, &object->mConfigs)) {
561 return false; 578 return false;
562 } 579 }