Skip to content

Commit

Permalink
ScalafmtDynamic: download even current build
Browse files Browse the repository at this point in the history
Because the -dynamic module doesn't include the necessary -core.

This is follow-up to scalameta#2839; prior to that change, current had been used
for CliTest with "core" option but that was fixed in scalameta#2873 to detect the
current build and use the core runner.
  • Loading branch information
kitbellew committed Nov 11, 2021
1 parent 2778b8c commit c38586c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,8 @@ final case class ScalafmtDynamic(
): FormatEval[ScalafmtReflectConfig] = {
for {
version <- readVersion(configPath)
current = ScalafmtReflect.current
fmtReflect <-
if (version == current.version) Right(current)
else resolveFormatter(configPath, version)
// can't use current build directly, -dynamic doesn't include -core
fmtReflect <- resolveFormatter(configPath, version)
config <- fmtReflect.parseConfig(configPath).toEither.left.map {
case ex: ScalafmtDynamicError => ex
case ex => new UnknownConfigError(configPath, ex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,3 @@ case class ScalafmtReflect(
module.get(null)
}
}

object ScalafmtReflect {

lazy val current = ScalafmtReflect(
getClass.getClassLoader,
ScalafmtVersion.parse(BuildInfo.stable).get
)

}

0 comments on commit c38586c

Please sign in to comment.