lintOptions for library projects

753 views
Skip to first unread message

Dal

unread,
Jan 16, 2014, 5:02:28 AM1/16/14
to adt...@googlegroups.com
Hi,

My current setup is as follows:
app/build.gradle
app/lint.xml
build.gradle
libraries/lib_a/build.gradle
libraries/lib_b/build.gradle

I have placed a lintOptions section inside app/build.gradle and if I run 'gradlew lint' at the root level, lint runs fine for the app itself (abortOnError is false), but it also tries to run lint on the libraries lib_a and lib_b where the default for abortOnError is true. I don't want to have to duplicate the lintOptions section in every library's build.gradle, so is there some way I can put the lintOptions at the top level, or just tell lint to run on the app project only?

Thanks,

Dal

Anton Rutkevich

unread,
Jan 19, 2014, 1:34:20 PM1/19/14
to adt...@googlegroups.com
Hi, Dal.

Yes, you can put lint options at the top level like this

// Apply library and application plugins to corresponding subprojects
project(':my-lib') {
    apply plugin: 'android-library'
}
project(':my-app') {
    apply plugin: 'android'
}
// Do some common stuff for both library and application
subprojects {
    android {
        lintOptions {
            // set to true to turn off analysis progress reporting by lint
            quiet false
            // if true, stop the gradle build if errors are found
            abortOnError false
            // Some other options
        }
    }
}

or you can run lint on your app project only with 

./gradlew :my-app:lintDebug 

.
Reply all
Reply to author
Forward
0 new messages