diff options
author | Adam Lesinski <adamlesinski@google.com> | 2015-10-16 14:37:48 -0700 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2015-10-22 12:52:49 -0700 |
commit | 9e10ac70155c993e7053323ad36beaea7bf7d54f (patch) | |
tree | 6d5ba83f2ff0e6ff0a0ac1fede1154902b3f14ab /tools/aapt2/ResourceTable.h | |
parent | 5359893effd12bac156505e1ad3a77a30d27cc0a (diff) |
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
Diffstat (limited to 'tools/aapt2/ResourceTable.h')
-rw-r--r-- | tools/aapt2/ResourceTable.h | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/tools/aapt2/ResourceTable.h b/tools/aapt2/ResourceTable.h index 60fed2f0e26b..be909361bef1 100644 --- a/tools/aapt2/ResourceTable.h +++ b/tools/aapt2/ResourceTable.h @@ -31,11 +31,17 @@ namespace aapt { +enum class SymbolState { + kUndefined, + kPublic, + kPrivate +}; + /** * The Public status of a resource. */ -struct Public { - bool isPublic = false; +struct Symbol { + SymbolState state = SymbolState::kUndefined; Source source; std::u16string comment; }; @@ -71,7 +77,7 @@ struct ResourceEntry { * Whether this resource is public (and must maintain the same * entry ID across builds). */ - Public publicStatus; + Symbol symbolStatus; /** * The resource's values for each configuration. @@ -100,7 +106,7 @@ struct ResourceTableType { * Whether this type is public (and must maintain the same * type ID across builds). */ - Public publicStatus; + Symbol symbolStatus; /** * List of resources for this type. @@ -171,10 +177,15 @@ public: const Source& source, std::unique_ptr<Value> value, IDiagnostics* diag); - bool markPublic(const ResourceNameRef& name, const ResourceId resId, const Source& source, - IDiagnostics* diag); - bool markPublicAllowMangled(const ResourceNameRef& name, const ResourceId resId, - const Source& source, IDiagnostics* diag); + bool addResourceAllowMangled(const ResourceNameRef& name, const ResourceId id, + const ConfigDescription& config, + const Source& source, std::unique_ptr<Value> value, + IDiagnostics* diag); + + bool setSymbolState(const ResourceNameRef& name, const ResourceId resId, const Source& source, + SymbolState state, IDiagnostics* diag); + bool setSymbolStateAllowMangled(const ResourceNameRef& name, const ResourceId resId, + const Source& source, SymbolState state, IDiagnostics* diag); struct SearchResult { ResourceTablePackage* package; ResourceTableType* type; @@ -217,8 +228,9 @@ private: const ConfigDescription& config, const Source& source, std::unique_ptr<Value> value, const char16_t* validChars, IDiagnostics* diag); - bool markPublicImpl(const ResourceNameRef& name, const ResourceId resId, - const Source& source, const char16_t* validChars, IDiagnostics* diag); + bool setSymbolStateImpl(const ResourceNameRef& name, const ResourceId resId, + const Source& source, SymbolState state, const char16_t* validChars, + IDiagnostics* diag); }; } // namespace aapt |