Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Short-circuit when reading mill-version files #3541

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,10 @@ final class MillAlg[F[_]](defaultResolver: Resolver)(implicit
Some("https://github.com/scala-steward-org/scala-steward/issues/2838")

private def getMillVersion(buildRootDir: File): F[Option[Version]] =
for {
millVersionFileContent <- fileAlg.readFile(buildRootDir / s".$millVersionName")
millVersionFileInConfigContent <- fileAlg.readFile(buildRootDir / ".config" / millVersionName)
version = millVersionFileContent
.orElse(millVersionFileInConfigContent)
.flatMap(parser.parseMillVersion)
} yield version
List(
buildRootDir / s".$millVersionName",
buildRootDir / ".config" / millVersionName
).collectFirstSomeM(fileAlg.readFile).map(_.flatMap(parser.parseMillVersion))

private def getMillPluginDeps(
millVersion: Version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class MillAlgTest extends FunSuite {
val expected = initial.copy(
trace = Vector(
Cmd("read", s"$repoDir/.mill-version"),
Cmd("read", s"$repoDir/.config/mill-version"),
millCmd,
Cmd("read", s"$repoDir/build.sc")
)
Expand Down
Loading