summaryrefslogtreecommitdiff
path: root/tools/aapt2/java/JavaClassGenerator.h
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2017-04-11 17:36:53 -0700
committerAdam Lesinski <adamlesinski@google.com>2017-04-11 17:40:02 -0700
commit418763ff54170484c527bf618ef2fad34fe63f97 (patch)
treefd7d16b9602e9487917058997bda65bed6551c85 /tools/aapt2/java/JavaClassGenerator.h
parentec8f35366851fcfea2d8b8e42821dda72bdca344 (diff)
AAPT2: Generate R.txt
In order to support a staged rollout of support for AAPT2, libraries being built the old way (merged into a single resource directory) still need to make use of the generated R.txt AAPT emitted. Do the same as AAPT. Test: manual Change-Id: Iaac1e824ddbd67e4efbab7692cddc1e4aa052f5a
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator.h')
-rw-r--r--tools/aapt2/java/JavaClassGenerator.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/tools/aapt2/java/JavaClassGenerator.h b/tools/aapt2/java/JavaClassGenerator.h
index 45104301e7f5..18746ffc5a0a 100644
--- a/tools/aapt2/java/JavaClassGenerator.h
+++ b/tools/aapt2/java/JavaClassGenerator.h
@@ -59,7 +59,7 @@ struct JavaClassGeneratorOptions {
std::vector<std::string> javadoc_annotations;
};
-// Generates the R.java file for a resource table.
+// Generates the R.java file for a resource table and optionally an R.txt file.
class JavaClassGenerator {
public:
JavaClassGenerator(IAaptContext* context, ResourceTable* table,
@@ -69,10 +69,12 @@ class JavaClassGenerator {
// All symbols technically belong to a single package, but linked libraries will
// have their names mangled, denoting that they came from a different package.
// We need to generate these symbols in a separate file. Returns true on success.
- bool Generate(const android::StringPiece& package_name_to_generate, std::ostream* out);
+ bool Generate(const android::StringPiece& package_name_to_generate, std::ostream* out,
+ std::ostream* out_r_txt = nullptr);
bool Generate(const android::StringPiece& package_name_to_generate,
- const android::StringPiece& output_package_name, std::ostream* out);
+ const android::StringPiece& output_package_name, std::ostream* out,
+ std::ostream* out_r_txt = nullptr);
const std::string& getError() const;
@@ -88,13 +90,14 @@ class JavaClassGenerator {
bool ProcessType(const android::StringPiece& package_name_to_generate,
const ResourceTablePackage& package, const ResourceTableType& type,
- ClassDefinition* out_type_class_def, MethodDefinition* out_rewrite_method_def);
+ ClassDefinition* out_type_class_def, MethodDefinition* out_rewrite_method_def,
+ std::ostream* out_r_txt);
// Writes a resource to the R.java file, optionally writing out a rewrite rule for its package
// ID if `out_rewrite_method` is not nullptr.
void ProcessResource(const ResourceNameRef& name, const ResourceId& id,
const ResourceEntry& entry, ClassDefinition* out_class_def,
- MethodDefinition* out_rewrite_method);
+ MethodDefinition* out_rewrite_method, std::ostream* out_r_txt);
// Writes a styleable resource to the R.java file, optionally writing out a rewrite rule for
// its package ID if `out_rewrite_method` is not nullptr.
@@ -102,7 +105,8 @@ class JavaClassGenerator {
void ProcessStyleable(const ResourceNameRef& name, const ResourceId& id,
const Styleable& styleable,
const android::StringPiece& package_name_to_generate,
- ClassDefinition* out_class_def, MethodDefinition* out_rewrite_method);
+ ClassDefinition* out_class_def, MethodDefinition* out_rewrite_method,
+ std::ostream* out_r_txt);
IAaptContext* context_;
ResourceTable* table_;