diff options
| author | 2016-01-11 10:42:19 -0800 | |
|---|---|---|
| committer | 2016-01-11 10:42:19 -0800 | |
| commit | 979ccb2e6f3f1f7f00a448eb440a85daf033dc9e (patch) | |
| tree | fd2e294460c4832e1a450ed333b80a545cfdfc7e /tools/aapt2/ResourceParser.cpp | |
| parent | e5b386d2bbfa0fdf6439850191a24dfc17ee50c3 (diff) | |
AAPT2: Warn when positional arguments exist and --legacy is on
This is normally an error, but old AAPT didn't check for it correctly,
so many projects violate this. With --legacy, this becomes a warning.
Change-Id: I23647e029930e11b719591cd38609e1b43247e20
Diffstat (limited to 'tools/aapt2/ResourceParser.cpp')
| -rw-r--r-- | tools/aapt2/ResourceParser.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/aapt2/ResourceParser.cpp b/tools/aapt2/ResourceParser.cpp index e1f9642d27d7..5e7d3ec4c1e0 100644 --- a/tools/aapt2/ResourceParser.cpp +++ b/tools/aapt2/ResourceParser.cpp @@ -582,10 +582,15 @@ bool ResourceParser::parseString(xml::XmlPullParser* parser, ParsedResource* out if (formatted && translateable) { if (!util::verifyJavaStringFormat(*stringValue->value)) { - mDiag->error(DiagMessage(outResource->source) - << "multiple substitutions specified in non-positional format; " - "did you mean to add the formatted=\"false\" attribute?"); - return false; + DiagMessage msg(outResource->source); + msg << "multiple substitutions specified in non-positional format; " + "did you mean to add the formatted=\"false\" attribute?"; + if (mOptions.errorOnPositionalArguments) { + mDiag->error(msg); + return false; + } + + mDiag->warn(msg); } } |