summaryrefslogtreecommitdiff
path: root/tools/aapt2/java/AnnotationProcessor.cpp
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2016-04-07 13:24:59 -0700
committerAdam Lesinski <adamlesinski@google.com>2016-04-07 16:26:14 -0700
commit626b3dbf74f02ae630ae0089632f5962340694dc (patch)
tree21fda93c61d624b598b05cb0bd54a377a8975487 /tools/aapt2/java/AnnotationProcessor.cpp
parent41c1bb8f4a5a1f2f0a23d6cece525eaea50f57b3 (diff)
AAPT2: Clean up R JavaDoc generation
- Don't generate private attributes in public R.java - Strip out @SystemApi from comment when generating @android.annotation.SystemApi - Only emit a single line (up to the first period) of an attribute's comment within a styleable's attribute table. Change-Id: Id6316a6861540325934133958939a12074ad4428
Diffstat (limited to 'tools/aapt2/java/AnnotationProcessor.cpp')
-rw-r--r--tools/aapt2/java/AnnotationProcessor.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/tools/aapt2/java/AnnotationProcessor.cpp b/tools/aapt2/java/AnnotationProcessor.cpp
index ba744395ece0..b7e7f903a2b1 100644
--- a/tools/aapt2/java/AnnotationProcessor.cpp
+++ b/tools/aapt2/java/AnnotationProcessor.cpp
@@ -21,7 +21,7 @@
namespace aapt {
-void AnnotationProcessor::appendCommentLine(const std::string& comment) {
+void AnnotationProcessor::appendCommentLine(std::string& comment) {
static const std::string sDeprecated = "@deprecated";
static const std::string sSystemApi = "@SystemApi";
@@ -29,8 +29,14 @@ void AnnotationProcessor::appendCommentLine(const std::string& comment) {
mAnnotationBitMask |= kDeprecated;
}
- if (comment.find(sSystemApi) != std::string::npos) {
+ std::string::size_type idx = comment.find(sSystemApi);
+ if (idx != std::string::npos) {
mAnnotationBitMask |= kSystemApi;
+ comment.erase(comment.begin() + idx, comment.begin() + idx + sSystemApi.size());
+ }
+
+ if (util::trimWhitespace(comment).empty()) {
+ return;
}
if (!mHasComments) {
@@ -46,7 +52,8 @@ void AnnotationProcessor::appendComment(const StringPiece16& comment) {
for (StringPiece16 line : util::tokenize(comment, u'\n')) {
line = util::trimWhitespace(line);
if (!line.empty()) {
- appendCommentLine(util::utf16ToUtf8(line));
+ std::string utf8Line = util::utf16ToUtf8(line);
+ appendCommentLine(utf8Line);
}
}
}
@@ -55,7 +62,8 @@ void AnnotationProcessor::appendComment(const StringPiece& comment) {
for (StringPiece line : util::tokenize(comment, '\n')) {
line = util::trimWhitespace(line);
if (!line.empty()) {
- appendCommentLine(line.toString());
+ std::string utf8Line = line.toString();
+ appendCommentLine(utf8Line);
}
}
}