diff options
author | Adam Lesinski <adamlesinski@google.com> | 2016-02-12 22:18:51 -0800 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2016-02-12 22:21:48 -0800 |
commit | e4bb9eb5af5b0899dc0921d5580220b20e15bd5a (patch) | |
tree | d522014811735f3bdba1f916d83dc699189a14b9 /tools/aapt2/java/JavaClassGenerator.cpp | |
parent | 59e04c6f92da584b322c87072f18e6cab4de4c60 (diff) |
AAPT2: Introduce notion of 'product' to ResourceTable
This allows us to preserve the various product definitions during the compile
phase, and allows us to select the product in the link phase.
This allows compiled files to remain product-independent, so that they do not need
to be recompiled when switching targets.
Bug:25958912
Change-Id: Iaa7eed25c834b67a39cdc9be43613e8b5ab6cdd7
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator.cpp')
-rw-r--r-- | tools/aapt2/java/JavaClassGenerator.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/tools/aapt2/java/JavaClassGenerator.cpp b/tools/aapt2/java/JavaClassGenerator.cpp index 7280f3a968a0..6e340a2a2742 100644 --- a/tools/aapt2/java/JavaClassGenerator.cpp +++ b/tools/aapt2/java/JavaClassGenerator.cpp @@ -23,7 +23,6 @@ #include "java/AnnotationProcessor.h" #include "java/ClassDefinitionWriter.h" #include "java/JavaClassGenerator.h" -#include "util/Comparators.h" #include "util/StringPiece.h" #include <algorithm> @@ -258,12 +257,12 @@ bool JavaClassGenerator::writeEntriesForClass(ClassDefinitionWriter* outClassDef } for (const auto& configValue : entry->values) { - processor.appendComment(configValue.value->getComment()); + processor.appendComment(configValue->value->getComment()); } // If this is an Attribute, append the format Javadoc. if (!entry->values.empty()) { - if (Attribute* attr = valueCast<Attribute>(entry->values.front().value.get())) { + if (Attribute* attr = valueCast<Attribute>(entry->values.front()->value.get())) { // We list out the available values for the given attribute. addAttributeFormatDoc(&processor, attr); } @@ -272,7 +271,7 @@ bool JavaClassGenerator::writeEntriesForClass(ClassDefinitionWriter* outClassDef if (type->type == ResourceType::kStyleable) { assert(!entry->values.empty()); const Styleable* styleable = static_cast<const Styleable*>( - entry->values.front().value.get()); + entry->values.front()->value.get()); writeStyleableEntryForClass(outClassDef, &processor, packageNameToGenerate, unmangledName, styleable); } else { @@ -311,11 +310,10 @@ bool JavaClassGenerator::generate(const StringPiece16& packageNameToGenerate, if (type->type == ResourceType::kAttr) { // Also include private attributes in this same class. - auto iter = std::lower_bound(package->types.begin(), package->types.end(), - ResourceType::kAttrPrivate, cmp::lessThanType); - if (iter != package->types.end() && (*iter)->type == ResourceType::kAttrPrivate) { + ResourceTableType* privType = package->findType(ResourceType::kAttrPrivate); + if (privType) { result = writeEntriesForClass(&classDef, packageNameToGenerate, - package.get(), iter->get()); + package.get(), privType); if (!result) { return false; } |