AAPT2: Fix merging of styleables the right way
Styleables should only be merged when processing overlays.
This moves the styleable merging code out of ResourceTable
and into TableMerger.
Change-Id: I3aae05cf4dd875cd25ac2ac744b61194409b2fee
diff --git a/tools/aapt2/ResourceTable.h b/tools/aapt2/ResourceTable.h
index 6b52a43..df60814 100644
--- a/tools/aapt2/ResourceTable.h
+++ b/tools/aapt2/ResourceTable.h
@@ -38,8 +38,8 @@
enum class SymbolState {
kUndefined,
+ kPrivate,
kPublic,
- kPrivate
};
/**
@@ -185,13 +185,18 @@
public:
ResourceTable() = default;
+ enum class CollisionResult {
+ kKeepOriginal,
+ kConflict,
+ kTakeNew
+ };
+
+ using CollisionResolverFunc = std::function<CollisionResult(Value*, Value*)>;
+
/**
* When a collision of resources occurs, this method decides which value to keep.
- * Returns -1 if the existing value should be chosen.
- * Returns 0 if the collision can not be resolved (error).
- * Returns 1 if the incoming value should be chosen.
*/
- static int resolveValueCollision(Value* existing, Value* incoming);
+ static CollisionResult resolveValueCollision(Value* existing, Value* incoming);
bool addResource(const ResourceNameRef& name,
const ConfigDescription& config,
@@ -299,7 +304,7 @@
const StringPiece& product,
std::unique_ptr<Value> value,
const char* validChars,
- const std::function<int(Value*,Value*)>& conflictResolver,
+ const CollisionResolverFunc& conflictResolver,
IDiagnostics* diag);
bool setSymbolStateImpl(const ResourceNameRef& name,