I want to see lint errors in the console and I want to configure to use java 7 just once instead of every module (we have 12 modules).
I put this into my root build.gradle:
allprojects {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation,unchecked"
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
}
and it does work for pure java projects (apply plugin: 'java' in its own build.gradle) but not for com.android.application and com.android.library modules.
I assume there is some more general "filter" than withType(JavaCompile) I would have to use but I can't find it. Gradle scripts are still magic to me. Poking around I tried JavaCompile's super class AbstractCompile but that didn't do the trick.
How can I avoid having to add
android {
…
compileOptions {
targetCompatibility 1.7
sourceCompatibility 1.7
}
}
for the Java version and whatever it would take for the compilerArgs to every Android module?
from How can I configure sourceCompatibility and compilerArgs for all modules, java, android application and android library?
No comments:
Post a Comment