diff options
author | Tor Norbye <tnorbye@google.com> | 2013-10-04 07:47:45 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2013-10-04 07:47:45 -0700 |
commit | 92004ad5ef8f42f919bcabf8ccab3298d16ee9cb (patch) | |
tree | 9293ccc166ca807472f85d216549e34a5d048266 /android-gradle-jps | |
parent | 210b793c3d6cf02aeb02f43c84a2ebc062dc15f0 (diff) | |
download | idea-92004ad5ef8f42f919bcabf8ccab3298d16ee9cb.tar.gz |
Update error parser to account for error message change
In https://android-review.googlesource.com/#/c/67120/ the error
message format was changed a bit; this tweaks the error parser
to handle both types of formats (and adds a unit test.)
Change-Id: Id92580784342ff9febc38cf01ee91b122872ce95
Diffstat (limited to 'android-gradle-jps')
2 files changed, 30 insertions, 1 deletions
diff --git a/android-gradle-jps/src/com/android/tools/idea/jps/output/parser/androidPlugin/GradleBuildFailureParser.java b/android-gradle-jps/src/com/android/tools/idea/jps/output/parser/androidPlugin/GradleBuildFailureParser.java index 29001918365..d149950b664 100644 --- a/android-gradle-jps/src/com/android/tools/idea/jps/output/parser/androidPlugin/GradleBuildFailureParser.java +++ b/android-gradle-jps/src/com/android/tools/idea/jps/output/parser/androidPlugin/GradleBuildFailureParser.java @@ -131,7 +131,7 @@ public class GradleBuildFailureParser implements CompilerOutputParser { } else { if (currentLine.contains("no data file for changedFile")) { matcher = Pattern.compile("\\s*> In DataSet '.+', no data file for changedFile '(.+)'").matcher(currentLine); - if (matcher.matches()) { + if (matcher.find()) { file = matcher.group(1); } } diff --git a/android-gradle-jps/testSrc/com/android/tools/idea/jps/output/parser/GradleErrorOutputParserTest.java b/android-gradle-jps/testSrc/com/android/tools/idea/jps/output/parser/GradleErrorOutputParserTest.java index 281d0d5adeb..f1f6253aa9a 100644 --- a/android-gradle-jps/testSrc/com/android/tools/idea/jps/output/parser/GradleErrorOutputParserTest.java +++ b/android-gradle-jps/testSrc/com/android/tools/idea/jps/output/parser/GradleErrorOutputParserTest.java @@ -1150,6 +1150,35 @@ public class GradleErrorOutputParserTest extends TestCase { sourceFile.delete(); } + public void testChangedFile2() throws Exception { + createTempXmlFile(); + String output = + ":MyApp:compileReleaseRenderscript UP-TO-DATE\n" + + ":MyApp:mergeReleaseResources FAILED\n" + + "\n" + + "FAILURE: Build failed with an exception.\n" + + "\n" + + "* What went wrong:\n" + + "Execution failed for task ':MyApp:mergeReleaseResources'.\n" + + "> In DataSet 'main', no data file for changedFile '" + sourceFilePath + "'. This is an internal error in the incremental builds code; to work around it, try doing a full clean build.\n" + + "\n" + + "* Try:\n" + + "Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.\n" + + "\n" + + "BUILD FAILED\n" + + "\n" + + "Total time: 15.612 secs"; + + assertEquals("0: Info::MyApp:compileReleaseRenderscript UP-TO-DATE\n" + + "1: Info::MyApp:mergeReleaseResources FAILED\n" + + "2: Gradle:Error:Execution failed for task ':MyApp:mergeReleaseResources'.\n" + + "> In DataSet 'main', no data file for changedFile '" + sourceFilePath + "'. This is an internal error in the incremental builds code; to work around it, try doing a full clean build.\n" + + "\t" + sourceFilePath + ":-1:-1\n" + + "3: Info:BUILD FAILED\n" + + "4: Info:Total time: 15.612 secs\n", toString(parser.parseErrorOutput(output))); + sourceFile.delete(); + } + public void testMismatchedTag() throws Exception { // https://code.google.com/p/android/issues/detail?id=59824 createTempXmlFile(); |