AAPT2: Support static lib referencing static lib

When a static library A references static library B,
and app C references both A and B, we get the following symbol merging,
symbols from library B get imported twice.

We must only check that symbol references to library B are valid
when building library A. We should only merge all the symbols
when building final app C.

Change-Id: I23cba33b0901dcbb5328d9c9dfaa6a979c073c36
This commit is contained in:
Adam Lesinski
2015-05-04 17:40:56 -07:00
parent a4492b418d
commit 330edcdf13
20 changed files with 754 additions and 460 deletions

View File

@ -101,8 +101,8 @@ bool Id::isWeak() const {
}
bool Id::flatten(android::Res_value& out) const {
out.dataType = android::Res_value::TYPE_NULL;
out.data = android::Res_value::DATA_NULL_UNDEFINED;
out.dataType = android::Res_value::TYPE_INT_BOOLEAN;
out.data = 0;
return true;
}
@ -231,17 +231,15 @@ Attribute* Attribute::clone(StringPool* /*newPool*/) const {
return attr;
}
void Attribute::print(std::ostream& out) const {
out << "(attr)";
void Attribute::printMask(std::ostream& out) const {
if (typeMask == android::ResTable_map::TYPE_ANY) {
out << " any";
out << "any";
return;
}
bool set = false;
if ((typeMask & android::ResTable_map::TYPE_REFERENCE) != 0) {
if (!set) {
out << " ";
set = true;
} else {
out << "|";
@ -251,7 +249,6 @@ void Attribute::print(std::ostream& out) const {
if ((typeMask & android::ResTable_map::TYPE_STRING) != 0) {
if (!set) {
out << " ";
set = true;
} else {
out << "|";
@ -261,7 +258,6 @@ void Attribute::print(std::ostream& out) const {
if ((typeMask & android::ResTable_map::TYPE_INTEGER) != 0) {
if (!set) {
out << " ";
set = true;
} else {
out << "|";
@ -271,7 +267,6 @@ void Attribute::print(std::ostream& out) const {
if ((typeMask & android::ResTable_map::TYPE_BOOLEAN) != 0) {
if (!set) {
out << " ";
set = true;
} else {
out << "|";
@ -281,7 +276,6 @@ void Attribute::print(std::ostream& out) const {
if ((typeMask & android::ResTable_map::TYPE_COLOR) != 0) {
if (!set) {
out << " ";
set = true;
} else {
out << "|";
@ -291,7 +285,6 @@ void Attribute::print(std::ostream& out) const {
if ((typeMask & android::ResTable_map::TYPE_FLOAT) != 0) {
if (!set) {
out << " ";
set = true;
} else {
out << "|";
@ -301,7 +294,6 @@ void Attribute::print(std::ostream& out) const {
if ((typeMask & android::ResTable_map::TYPE_DIMENSION) != 0) {
if (!set) {
out << " ";
set = true;
} else {
out << "|";
@ -311,7 +303,6 @@ void Attribute::print(std::ostream& out) const {
if ((typeMask & android::ResTable_map::TYPE_FRACTION) != 0) {
if (!set) {
out << " ";
set = true;
} else {
out << "|";
@ -321,7 +312,6 @@ void Attribute::print(std::ostream& out) const {
if ((typeMask & android::ResTable_map::TYPE_ENUM) != 0) {
if (!set) {
out << " ";
set = true;
} else {
out << "|";
@ -331,13 +321,17 @@ void Attribute::print(std::ostream& out) const {
if ((typeMask & android::ResTable_map::TYPE_FLAGS) != 0) {
if (!set) {
out << " ";
set = true;
} else {
out << "|";
}
out << "flags";
}
}
void Attribute::print(std::ostream& out) const {
out << "(attr) ";
printMask(out);
out << " ["
<< util::joiner(symbols.begin(), symbols.end(), ", ")
@ -348,10 +342,6 @@ void Attribute::print(std::ostream& out) const {
}
}
static ::std::ostream& operator<<(::std::ostream& out, const Attribute::Symbol& s) {
return out << s.symbol.name.entry << "=" << s.value;
}
Style::Style(bool weak) : weak(weak) {
}