On Wed, Jul 30, 2014 at 11:08 PM, Roman Mazur <[email protected]> wrote:

> Although docs about creation of custom lint checks exist
> <http://tools.android.com/tips/lint/writing-a-lint-check>,
> I cannot get the idea how to add some checks to my Android app/library
> organized with Gradle.
>
> Look at the BasePlugin source tells me that there is a plan to compile
> src/lint/java sources, but it's not implemented yet.
>

You can take a look at https://android-review.googlesource.com/#/c/80781/
which does it.

Providing I implement the compilation task myself, is there a way to
> customize the lint execution task to use my jar with custom checks?
>

What the above task does is compile a special folder (src/lint) with a
classpath set up to point to the libraries you need for compiling lint
rules (e.g. lint-api.jar, asm, etc) and it then builds lint.jar, and copies
this to a particular place.

The really important part is that that lint.jar is then packaged into the
*.aar file for the library.

Lint will already automatically include custom rules provided by any AARs
that your project depends on.

In short, if you bundle your lint.jar custom rules jar file into your
library AAR file (for example by manually compiling it, and then manually
using jar to insert it into your AAR), the rules should automatically be
run.

-- Tor

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

Reply via email to