cb372/sbt-explicit-dependencies

Compiler plugin Silencer-lib is flagged as undeclared

Opened this issue · 1 comments

Compiler plugin https://github.com/ghik/silencer instructs to declare dependencies the following way:

libraryDependencies ++= Seq(
  compilerPlugin("com.github.ghik" % "silencer-plugin" % silencerVersion cross CrossVersion.full),
  "com.github.ghik" % "silencer-lib" % silencerVersion % Provided cross CrossVersion.full
)

Unfortunately, explicit dependencies then flags this as undeclared compile dependency.
We are using the filter to suppress the warning, but it would be nice if this would be handled somehow automatically.

I came up with this workaround that may help diagnose the issue:

    unusedCompileDependenciesFilter := moduleFilter() - moduleFilter(
      "com.github.ghik",
      "silencer-lib"
    ),
    undeclaredCompileDependenciesFilter := moduleFilter() - moduleFilter(
      "com.github.ghik",
      "silencer-lib" + "_" + scalaVersion.value
    ),

It seems that when you don't actually use silencer (but you included it in the classpath as provided, acording to silencer-lib README) sbt-explicit-dependencies complains about "com.github.ghik" % "silencer-lib" % "XXX" not being used. But when you actually use it, sbt-explicit-dependencies complains about "com.github.ghik" % "silencer-lib_2_12" % "XXX" not being declared but used.