I'm slowly migrating a big project from groovy to ...
# community-support
c
I'm slowly migrating a big project from groovy to kts. I'm trying to migrate this
Copy code
allprojects {
  allprojects {
    tasks.withType(JavaCompile).tap {
      configureEach {
        options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked"
      }
    }
  }
}
I want to just delete it because i dont know what it does. this is in the root build file in an android project. No one on the team seems to know why it was needed, but people dont want to remove it 😂 the allprojects within allprojects is just weird to me. I'm not sure if these are even valid lint flags (what linter? android-lint? or does java have a linter?)
r
those compiler args are valid but you should remove one of the allprojects closures.
c
alright. soooo
Copy code
allprojects {
  tasks.withType<JavaCompile>().configureEach {
    options.compilerArgs.addAll(listOf("-Xlint:deprecation", "-Xlint:unchecked"))
  }
}
should do the trick? or should I be doing
Copy code
allprojects {
subprojects {
tasks.withType...
}
}
r
the first one
c
thanks for the sanity check ❤️
v
Actually, you should do neither, as it does cross project configuration and thus is discouraged bad practice. The flags are fine if you want them.
-Xlint:deprecation
makes the Java compiler complain (as warnings) about usage of deprecated methods and classes,
-Xlint:unchecked
does the same for unchecked casts. But like always, better have it in some convention plugin that is applied to all relevant projects.
c
every time i try to put a convention plugin together (even with following the docs) i fail. so this will have to do for now. but ultimately my goal will be to remove it because i dont think it gives us anything/no one knows where these lint warnings even show lol
v
They are warnings of the Java Compiler. They are shown in the Java Compiler output. And if you enable "warnings are errors", you can even make the Java Compiler fail on findings.
Convention plugins are usually quite trivial to create. Feel free to ask about problems you have with then, that's what we have a community for. :-)
c
I'll make sure to repost ❤️ The help from everyone is always appreciated as it always seems like I'm just a hair off from getting something right vs shooting myself in the foot. lol
👌 1