From a6fe345be955368a13aea76aefb4db821aad11df Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Wed, 9 Dec 2015 15:20:52 -0800 Subject: AAPT2: Fix overlay support Supports the tag and mimics old AAPT behavior of not allowing new resources defined unless was used or --auto-add-overlay was specified. Change-Id: I9b461137357617ade37fd7045b418b8e6450b9c4 --- tools/aapt2/ResourceUtils.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tools/aapt2/ResourceUtils.cpp') 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 @@ -554,5 +556,22 @@ std::unique_ptr 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 -- cgit v1.2.3-59-g8ed1b