How can I run gradlew lintDebug
on both the Android app and the Java module?
Here is an example project setup:
root-project
|- android-app
|- java-library
Here is what I have done so far:
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(":$project.name:lintDebug")) {
rootProject.subprojects.each { subprojects ->
// Do not add the same sources twice for this project
if (subprojects.name == project.name) {
return
}
// Append other modules source directories to this one
android.sourceSets.main.java.srcDirs += subprojects.files("./src/main/java")
}
}
}
Adding this code snippet into the android-app
module allows you to run gradlew :android-app:lintDebug
in order to run lint on both modules source files.