Adam Lesinski 8c831ca87b AAPT2: Add manifest merging
Now that AAPT2 is library-aware, it needs to take care of
all library related work, including merging manifests.
The logic was taken from the current Java ManifestMerger.

Change-Id: Id93f713f27ae8617922bf89e325e45be9f863c06
2015-06-04 18:00:33 -07:00

46 lines
1.2 KiB
C++

#ifndef AAPT_MANIFEST_MERGER_H
#define AAPT_MANIFEST_MERGER_H
#include "Logger.h"
#include "Source.h"
#include "XmlDom.h"
#include <memory>
#include <string>
namespace aapt {
class ManifestMerger {
public:
struct Options {
};
ManifestMerger(const Options& options);
bool setAppManifest(const Source& source, const std::u16string& package,
std::unique_ptr<xml::Node> root);
bool mergeLibraryManifest(const Source& source, const std::u16string& package,
std::unique_ptr<xml::Node> libRoot);
xml::Node* getMergedXml();
bool printMerged();
private:
bool mergeNewOrEqual(xml::Element* parentA, xml::Element* elA, xml::Element* elB);
bool mergePreferRequired(xml::Element* parentA, xml::Element* elA, xml::Element* elB);
bool checkEqual(xml::Element* elA, xml::Element* elB);
bool mergeApplication(xml::Element* applicationA, xml::Element* applicationB);
bool mergeUsesSdk(xml::Element* elA, xml::Element* elB);
Options mOptions;
std::unique_ptr<xml::Node> mRoot;
SourceLogger mAppLogger;
SourceLogger mLogger;
};
} // namespace aapt
#endif // AAPT_MANIFEST_MERGER_H