Skip to content

Commit 804f1cc

Browse files
authored
Merge pull request #3234 from scala-steward-org/topic/use-default-resolver-in-millalg
Use default resolver in `MillAlg`
2 parents 2960ec5 + bc21afe commit 804f1cc

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

modules/core/src/main/scala/org/scalasteward/core/application/Context.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ object Context {
216216
implicit val pullRequestRepository: PullRequestRepository[F] =
217217
new PullRequestRepository[F](pullRequestsStore)
218218
implicit val scalafixCli: ScalafixCli[F] = new ScalafixCli[F]
219-
implicit val scalafmtAlg: ScalafmtAlg[F] = new ScalafmtAlg[F](config)
219+
implicit val scalafmtAlg: ScalafmtAlg[F] = new ScalafmtAlg[F](config.defaultResolver)
220220
implicit val selfCheckAlg: SelfCheckAlg[F] = new SelfCheckAlg[F](config)
221221
implicit val coursierAlg: CoursierAlg[F] = CoursierAlg.create[F]
222222
implicit val versionsCache: VersionsCache[F] =
@@ -225,7 +225,7 @@ object Context {
225225
implicit val mavenAlg: MavenAlg[F] = new MavenAlg[F](config)
226226
implicit val sbtAlg: SbtAlg[F] = new SbtAlg[F](config)
227227
implicit val scalaCliAlg: ScalaCliAlg[F] = new ScalaCliAlg[F]
228-
implicit val millAlg: MillAlg[F] = new MillAlg[F]
228+
implicit val millAlg: MillAlg[F] = new MillAlg[F](config.defaultResolver)
229229
implicit val buildToolDispatcher: BuildToolDispatcher[F] = new BuildToolDispatcher[F]
230230
implicit val refreshErrorAlg: RefreshErrorAlg[F] =
231231
new RefreshErrorAlg[F](refreshErrorStore, config.refreshBackoffPeriod)

modules/core/src/main/scala/org/scalasteward/core/buildtool/mill/MillAlg.scala

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import org.scalasteward.core.io.{FileAlg, ProcessAlg, WorkspaceAlg}
2727
import org.scalasteward.core.util.Nel
2828
import org.typelevel.log4cats.Logger
2929

30-
final class MillAlg[F[_]](implicit
30+
final class MillAlg[F[_]](defaultResolver: Resolver)(implicit
3131
fileAlg: FileAlg[F],
3232
logger: Logger[F],
3333
processAlg: ProcessAlg[F],
@@ -66,7 +66,7 @@ final class MillAlg[F[_]](implicit
6666
)
6767
dependencies = parsed.map(module => Scope(module.dependencies, module.repositories))
6868
millBuildDeps = millBuildVersion.toSeq.map(version =>
69-
Scope(List(millMainArtifact(version)), List(millMainResolver))
69+
Scope(List(millMainArtifact(version)), List(defaultResolver))
7070
)
7171
millPluginDeps <- millBuildVersion match {
7272
case None => F.pure(Seq.empty[Scope[List[Dependency]]])
@@ -95,9 +95,9 @@ final class MillAlg[F[_]](implicit
9595
buildRootDir: File
9696
): F[Seq[Scope[List[Dependency]]]] =
9797
for {
98-
buildConent <- fileAlg.readFile(buildRootDir / "build.sc")
99-
deps = buildConent.toList.map(content =>
100-
Scope(parser.parseMillPluginDeps(content, millVersion), List(millMainResolver))
98+
buildContent <- fileAlg.readFile(buildRootDir / "build.sc")
99+
deps = buildContent.toList.map(content =>
100+
Scope(parser.parseMillPluginDeps(content, millVersion), List(defaultResolver))
101101
)
102102
} yield deps
103103
}
@@ -129,7 +129,6 @@ object MillAlg {
129129

130130
val extractDeps: String = "org.scalasteward.mill.plugin.StewardPlugin/extractDeps"
131131

132-
private val millMainResolver: Resolver = Resolver.mavenCentral
133132
private val millMainGroupId = GroupId("com.lihaoyi")
134133
private val millMainArtifactId = ArtifactId("mill-main", "mill-main_2.13")
135134

modules/core/src/main/scala/org/scalasteward/core/scalafmt/ScalafmtAlg.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,15 @@ import cats.Monad
2020
import cats.data.OptionT
2121
import cats.syntax.all._
2222
import io.circe.ParsingFailure
23-
import org.scalasteward.core.application.Config
2423
import org.scalasteward.core.buildtool.BuildRoot
25-
import org.scalasteward.core.data.{Scope, Version}
24+
import org.scalasteward.core.data.{Resolver, Scope, Version}
2625
import org.scalasteward.core.io.process.SlurpOptions
2726
import org.scalasteward.core.io.{FileAlg, ProcessAlg, WorkspaceAlg}
2827
import org.scalasteward.core.scalafmt.ScalafmtAlg.{opts, parseScalafmtConf}
2928
import org.scalasteward.core.util.Nel
3029
import org.typelevel.log4cats.Logger
3130

32-
final class ScalafmtAlg[F[_]](config: Config)(implicit
31+
final class ScalafmtAlg[F[_]](defaultResolver: Resolver)(implicit
3332
fileAlg: FileAlg[F],
3433
logger: Logger[F],
3534
processAlg: ProcessAlg[F],
@@ -49,7 +48,7 @@ final class ScalafmtAlg[F[_]](config: Config)(implicit
4948

5049
def getScopedScalafmtDependency(buildRoot: BuildRoot): F[Option[Scope.Dependencies]] =
5150
OptionT(getScalafmtVersion(buildRoot))
52-
.map(version => Scope(List(scalafmtDependency(version)), List(config.defaultResolver)))
51+
.map(version => Scope(List(scalafmtDependency(version)), List(defaultResolver)))
5352
.value
5453

5554
def reformatChanged(buildRoot: BuildRoot): F[Unit] =

0 commit comments

Comments
 (0)