File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -165,4 +165,22 @@ subprojects {
165165 quiet = false
166166 }
167167 }
168+
169+ pluginManager. withPlugin(' scala' ) {
170+ String scalaVersion = System . getProperty(" scalaVersion" ) != null ? System . getProperty(" scalaVersion" ) : System . getProperty(" defaultScalaVersion" )
171+ tasks. withType(ScalaCompile ). configureEach { scalaCompile ->
172+ if (scalaVersion?. startsWith(" 2.12" )) {
173+ scalaCompile. scalaCompileOptions. additionalParameters = [
174+ // Scala 2.12 does not support treating unused imports as errors individually,
175+ // so we only enable warnings for unused imports when using Scala 2.12.
176+ " -Ywarn-unused:imports" ,
177+ ]
178+ } else if (scalaVersion?. startsWith(" 2.13" )) {
179+ scalaCompile. scalaCompileOptions. additionalParameters = [
180+ " -Wconf:cat=unused:error" ,
181+ " -Wunused:imports"
182+ ]
183+ }
184+ }
185+ }
168186}
You can’t perform that action at this time.
0 commit comments