Monday, June 22, 2015

Help with errorformat for Android/Gradle output

When developing Android applications with AndroidAnotations to auto-generate classes and with gradle as build system it is common to get errors like these:

/home/ryujin/Projects/KidInt/kidint-android/src/main/java/com/kidint/app/ChildResourceGridActivity.java:16: error: cannot find symbol
import com.kidint.app.adapter.ChildResourceAdapter_;
^
location: package com.kidint.app.adapter
/home/ryujin/Projects/KidInt/kidint-android/src/main/java/com/kidint/app/BookDetailActivity.java:18: error: cannot find symbol
import com.kidint.app.util.ChildResourceData_;
^
location: package com.kidint.app.util
/home/ryujin/Projects/KidInt/kidint-android/src/main/java/com/kidint/app/BookDetailActivity.java:25: error: cannot find symbol
import com.kidint.app.service.KidIntService_;
^
location: package com.kidint.app.service
/home/ryujin/Projects/KidInt/kidint-android/src/main/java/com/kidint/app/BookDetailActivity.java:26: error: cannot find symbol
import com.kidint.app.service.KidIntBookService_;
^
location: package com.kidint.app.service
/home/ryujin/Projects/KidInt/kidint-android/src/main/java/com/kidint/app/BookDetailActivity.java:27: error: cannot find symbol
import com.kidint.app.service.KidIntQuestionService_;
^
location: package com.kidint.app.service
/home/ryujin/Projects/KidInt/kidint-android/src/main/java/com/kidint/app/LoginFragment.java:34: error: cannot find symbol
import com.kidint.app.service.KidIntService_;
^
location: package com.kidint.app.service
/home/ryujin/Projects/KidInt/kidint-android/src/main/java/com/kidint/app/LoginFragment.java:60: error: cannot find symbol
@EFrgment(R.layout.kidint_login)
^
symbol: class EFrgment
/home/ryujin/Projects/KidInt/kidint-android/src/main/java/com/kidint/app/StatisticsFragment.java:29: error: cannot find symbol
import com.kidint.app.adapter.BookProfileRecyclerAdapter_;
^
location: package com.kidint.app.adapter


Experienced developers immediately can recognize that the only valid error above is the typo for the @EFragmet annotation and that all other errors are simply consequences of this single one.

The errorformat I use in vim is able to catch all these errors that results in a huge list in the quickfix window. I would really like to add a pattern to my errorformat to filter out all errors related to AndroidAnnotaions auto-generated classes (those that end with _).

My current errorformat:

CompilerSet errorformat=\%W%f:%l:\ %tarning:\ %m,%Z%p%*[%^~],%+C%.%#,
\%E%f:%l:\ %trror:\ %m,%Z%p%*[%^~],%+C%.%#,
\%-G%.%#

I tried adding variations of the same pattern to remove the ones I do not want but it did not work. These are some examples of patterns I have used without success since they tend to remove all messages, including those that are valid errors:

1. \%-E%f:%l:\ %trror:\ %m,%Z%p^,%+C%.%#_,
2. \%-E%f:%l:\ %trror:\ %m_,%Z%p^,
3. \%-E%f:%l:\ %trror:\ %m,%Z%p^%.%#_,
4. \%-E%f:%l:\ %trror:\ %m,%Z%p^%.%#%*[_],

NOTE: I added these patters as the first one my multi patter errorformat. The whole pattern I use can be found on my [vim-android plugin][1]


[1]: https://github.com/hsanson/vim-android/blob/master/compiler/gradle.vim#L12

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: