diff --git a/modules/core/src/main/scala/org/scalasteward/core/buildtool/mill/MillAlg.scala b/modules/core/src/main/scala/org/scalasteward/core/buildtool/mill/MillAlg.scala index 7d674c1bf3..b5bda86701 100644 --- a/modules/core/src/main/scala/org/scalasteward/core/buildtool/mill/MillAlg.scala +++ b/modules/core/src/main/scala/org/scalasteward/core/buildtool/mill/MillAlg.scala @@ -58,13 +58,7 @@ final class MillAlg[F[_]](defaultResolver: Resolver)(implicit for { buildRootDir <- workspaceAlg.buildRootDir(buildRoot) millBuildVersion <- getMillVersion(buildRootDir) - extracted <- - if (isMillVersionGreaterOrEqual011(millBuildVersion)) runMill(buildRootDir) - else runMillUnder011(buildRootDir, millBuildVersion) - parsed <- F.fromEither( - parser.parseModules(extracted.dropWhile(!_.startsWith("{")).mkString("\n")) - ) - dependencies = parsed.map(module => Scope(module.dependencies, module.repositories)) + dependencies <- getProjectDependencies(buildRootDir, millBuildVersion) millBuildDeps = millBuildVersion.toSeq.map(version => Scope(List(millMainArtifact(version)), List(defaultResolver)) ) @@ -74,6 +68,20 @@ final class MillAlg[F[_]](defaultResolver: Resolver)(implicit } } yield dependencies ++ millBuildDeps ++ millPluginDeps + private def getProjectDependencies( + buildRootDir: File, + millBuildVersion: Option[Version] + ): F[List[Scope.Dependencies]] = + for { + extracted <- + if (isMillVersionGreaterOrEqual011(millBuildVersion)) runMill(buildRootDir) + else runMillUnder011(buildRootDir, millBuildVersion) + parsed <- F.fromEither( + parser.parseModules(extracted.dropWhile(!_.startsWith("{")).mkString("\n")) + ) + dependencies = parsed.map(module => Scope(module.dependencies, module.repositories)) + } yield dependencies + override def runMigration(buildRoot: BuildRoot, migration: ScalafixMigration): F[Unit] = logger.warn( s"Scalafix migrations are currently not supported in $name projects, see https://github.com/scala-steward-org/scala-steward/issues/2838 for details" diff --git a/modules/core/src/main/scala/org/scalasteward/core/buildtool/scalacli/ScalaCliAlg.scala b/modules/core/src/main/scala/org/scalasteward/core/buildtool/scalacli/ScalaCliAlg.scala index 6de5d15c6f..1d79e0f252 100644 --- a/modules/core/src/main/scala/org/scalasteward/core/buildtool/scalacli/ScalaCliAlg.scala +++ b/modules/core/src/main/scala/org/scalasteward/core/buildtool/scalacli/ScalaCliAlg.scala @@ -70,6 +70,9 @@ final class ScalaCliAlg[F[_]](implicit } override def getDependencies(buildRoot: BuildRoot): F[List[Scope.Dependencies]] = + getDependenciesViaSbtExport(buildRoot) + + private def getDependenciesViaSbtExport(buildRoot: BuildRoot): F[List[Scope.Dependencies]] = for { buildRootDir <- workspaceAlg.buildRootDir(buildRoot) exportDir = "tmp-sbt-build-for-scala-steward"