diff options
author | Adam Lesinski <adamlesinski@google.com> | 2015-12-09 15:20:52 -0800 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2015-12-10 16:24:15 -0800 |
commit | a6fe345be955368a13aea76aefb4db821aad11df (patch) | |
tree | c5385f798a6e1fb674f6f13c0f323726258618ca /tools/aapt2/ResourceUtils.cpp | |
parent | 01655232371d7c7ea5b58ccf66ad99917072018a (diff) |
AAPT2: Fix overlay support
Supports the <add-resource> tag and mimics old AAPT behavior of
not allowing new resources defined unless <add-resource> was used
or --auto-add-overlay was specified.
Change-Id: I9b461137357617ade37fd7045b418b8e6450b9c4
Diffstat (limited to 'tools/aapt2/ResourceUtils.cpp')
-rw-r--r-- | tools/aapt2/ResourceUtils.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/aapt2/ResourceUtils.cpp b/tools/aapt2/ResourceUtils.cpp index ffe6595cf0b6..36c3e702574e 100644 --- a/tools/aapt2/ResourceUtils.cpp +++ b/tools/aapt2/ResourceUtils.cpp @@ -14,8 +14,10 @@ * limitations under the License. */ +#include "NameMangler.h" #include "ResourceUtils.h" #include "flatten/ResourceTypeExtensions.h" +#include "util/Files.h" #include "util/Util.h" #include <androidfw/ResourceTypes.h> @@ -554,5 +556,22 @@ std::unique_ptr<Item> parseItemForAttribute( return {}; } +std::string buildResourceFileName(const ResourceFile& resFile, const NameMangler* mangler) { + std::stringstream out; + out << "res/" << resFile.name.type; + if (resFile.config != ConfigDescription{}) { + out << "-" << resFile.config; + } + out << "/"; + + if (mangler && mangler->shouldMangle(resFile.name.package)) { + out << NameMangler::mangleEntry(resFile.name.package, resFile.name.entry); + } else { + out << resFile.name.entry; + } + out << file::getExtension(resFile.source.path); + return out.str(); +} + } // namespace ResourceUtils } // namespace aapt |