Home | History | Annotate | Download | only in aapt2
      1 #ifndef AAPT_MANIFEST_MERGER_H
      2 #define AAPT_MANIFEST_MERGER_H
      3 
      4 #include "Logger.h"
      5 #include "Source.h"
      6 #include "XmlDom.h"
      7 
      8 #include <memory>
      9 #include <string>
     10 
     11 namespace aapt {
     12 
     13 class ManifestMerger {
     14 public:
     15     struct Options {
     16     };
     17 
     18     ManifestMerger(const Options& options);
     19 
     20     bool setAppManifest(const Source& source, const std::u16string& package,
     21                         std::unique_ptr<xml::Node> root);
     22 
     23     bool mergeLibraryManifest(const Source& source, const std::u16string& package,
     24                               std::unique_ptr<xml::Node> libRoot);
     25 
     26     xml::Node* getMergedXml();
     27 
     28     bool printMerged();
     29 
     30 private:
     31     bool mergeNewOrEqual(xml::Element* parentA, xml::Element* elA, xml::Element* elB);
     32     bool mergePreferRequired(xml::Element* parentA, xml::Element* elA, xml::Element* elB);
     33     bool checkEqual(xml::Element* elA, xml::Element* elB);
     34     bool mergeApplication(xml::Element* applicationA, xml::Element* applicationB);
     35     bool mergeUsesSdk(xml::Element* elA, xml::Element* elB);
     36 
     37     Options mOptions;
     38     std::unique_ptr<xml::Node> mRoot;
     39     SourceLogger mAppLogger;
     40     SourceLogger mLogger;
     41 };
     42 
     43 } // namespace aapt
     44 
     45 #endif // AAPT_MANIFEST_MERGER_H
     46