AAPT2: Process <java-symbols> and private symbol package
Need to introduce the idea of multiple levels of visibility to support <java-symbol>.
Public, Private, Undefined.
Public means it is accessible from outside and requires an ID assigned.
Private means that we explicitly want this to be a symbol (show up in R.java), but not visible
to other packages. No ID required.
Undefined is any normal resource. When --private-symbols is specified in the link phase,
these resources will not show up in R.java.
Change-Id: Icba89221e08e685dee7683786aa7112baf28c856
diff --git a/tools/aapt2/Debug.cpp b/tools/aapt2/Debug.cpp
index 84f4385..d864f66 100644
--- a/tools/aapt2/Debug.cpp
+++ b/tools/aapt2/Debug.cpp
@@ -124,17 +124,18 @@
}
for (const ResourceEntry* entry : sortedEntries) {
- ResourceId id = {
- package->id ? package->id.value() : uint8_t(0),
- type->id ? type->id.value() : uint8_t(0),
- entry->id ? entry->id.value() : uint16_t(0)
- };
+ ResourceId id(package->id ? package->id.value() : uint8_t(0),
+ type->id ? type->id.value() : uint8_t(0),
+ entry->id ? entry->id.value() : uint16_t(0));
+ ResourceName name(package->name, type->type, entry->name);
- ResourceName name = { package->name, type->type, entry->name };
std::cout << " spec resource " << id << " " << name;
- if (entry->publicStatus.isPublic) {
- std::cout << " PUBLIC";
+ switch (entry->symbolStatus.state) {
+ case SymbolState::kPublic: std::cout << " PUBLIC"; break;
+ case SymbolState::kPrivate: std::cout << " _PRIVATE_"; break;
+ default: break;
}
+
std::cout << std::endl;
PrintVisitor visitor;