Skip to content

Commit

Permalink
Add deprecated overload instead of using @nowarn
Browse files Browse the repository at this point in the history
  • Loading branch information
lolgab committed Sep 30, 2024
1 parent ad4b594 commit 1df01e0
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions mill-scalafix/src/com/goyeau/mill/scalafix/ScalafixModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import mill.define.Command
import scalafix.interfaces.Scalafix
import scalafix.interfaces.ScalafixError.*

import scala.annotation.nowarn
import scala.compat.java8.OptionConverters.*
import scala.jdk.CollectionConverters.*

Expand All @@ -30,7 +29,6 @@ trait ScalafixModule extends ScalaModule {
filesToFix(sources()).map(_.path),
classpath = (compileClasspath() ++ localClasspath() ++ Seq(semanticDbData())).iterator.toSeq.map(_.path),
scalaVersion(),
scalafixScalaBinaryVersion(): @nowarn("cat=deprecation"),
scalacOptions(),
scalafixIvyDeps(),
scalafixConfig(),
Expand All @@ -41,6 +39,7 @@ trait ScalafixModule extends ScalaModule {
}

object ScalafixModule {
@deprecated("Use overload without scalaBinaryVersion and with wd instead", since = "0.4.2")
def fixAction(
log: Logger,
repositories: Seq[Repository],
Expand All @@ -58,22 +57,19 @@ object ScalafixModule {
sources,
classpath,
scalaVersion,
scalaBinaryVersion,
scalacOptions,
scalafixIvyDeps,
scalafixConfig,
args,
os.pwd
)

@nowarn("msg=parameter scalaBinaryVersion in method fixAction is never used")
def fixAction(
log: Logger,
repositories: Seq[Repository],
sources: Seq[os.Path],
classpath: Seq[os.Path],
scalaVersion: String,
scalaBinaryVersion: String,
scalacOptions: Seq[String],
scalafixIvyDeps: Agg[Dep],
scalafixConfig: Option[os.Path],
Expand Down Expand Up @@ -128,4 +124,30 @@ object ScalafixModule {
if (os.isDir(pathRef.path)) os.walk(pathRef.path).filter(file => os.isFile(file) && (file.ext == "scala"))
else Seq(pathRef.path)
} yield PathRef(file)

@deprecated("Use overload without scalaBinaryVersion instead", since = "0.4.2")
def fixAction(
log: Logger,
repositories: Seq[Repository],
sources: Seq[os.Path],
classpath: Seq[os.Path],
scalaVersion: String,
scalaBinaryVersion: String,
scalacOptions: Seq[String],
scalafixIvyDeps: Agg[Dep],
scalafixConfig: Option[os.Path],
args: Seq[String],
wd: os.Path
): Result[Unit] = fixAction(
log,
repositories,
sources,
classpath,
scalaVersion,
scalacOptions,
scalafixIvyDeps,
scalafixConfig,
args,
wd
)
}

0 comments on commit 1df01e0

Please sign in to comment.