Skip to content

Commit 1dd8e74

Browse files
committed
Revised .mill-version update support
1 parent 7f67e25 commit 1dd8e74

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ object MillAlg {
9090
private def millMainArtifact(version: String): Dependency =
9191
Dependency(millMainGroupId, millMainArtifactId, version)
9292

93-
def isMillMainUpdate(update: Update.Single): Boolean =
94-
update.groupId === millMainGroupId && update.artifactId.name === millMainArtifactId.name
93+
def isMillMainUpdate(update: Update): Boolean =
94+
update.groupId === millMainGroupId && update.artifactIds.exists(
95+
_.name === millMainArtifactId.name
96+
)
9597

9698
}

modules/core/src/main/scala/org/scalasteward/core/edit/UpdateHeuristic.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ object UpdateHeuristic {
214214
case update: Update.Single if isScalafmtUpdate(update) =>
215215
defaultReplaceVersion(_ => List("version"))(update)
216216
case update: Update.Single if MillAlg.isMillMainUpdate(update) =>
217+
// this is intended to update the `.mill-version`
217218
content => if (content === update.currentVersion) Some(update.nextVersion) else None
218219
case _ =>
219220
_ => None

modules/core/src/main/scala/org/scalasteward/core/io/package.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package org.scalasteward.core
1818

1919
import better.files.File
2020
import cats.syntax.all._
21+
import org.scalasteward.core.buildtool.mill.MillAlg
2122
import org.scalasteward.core.data.{GroupId, Update}
2223
import org.scalasteward.core.scalafmt.{scalafmtArtifactId, scalafmtConfName, scalafmtGroupId}
2324

@@ -31,9 +32,10 @@ package object io {
3132
file: File
3233
): Boolean =
3334
() match {
34-
case _ if isSbtUpdate(update) => file.name === "build.properties"
35-
case _ if isScalafmtCoreUpdate(update) => file.name === scalafmtConfName
36-
case _ => isGenericSourceFile(file, fileExtensions)
35+
case _ if isSbtUpdate(update) => file.name === "build.properties"
36+
case _ if isScalafmtCoreUpdate(update) => file.name === scalafmtConfName
37+
case _ if MillAlg.isMillMainUpdate(update) => file.name === ".mill-version"
38+
case _ => isGenericSourceFile(file, fileExtensions)
3739
}
3840

3941
private def isGenericSourceFile(file: File, fileExtensions: Set[String]): Boolean =

modules/core/src/main/scala/org/scalasteward/core/repoconfig/UpdatesConfig.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ final case class UpdatesConfig(
7474

7575
object UpdatesConfig {
7676
val defaultFileExtensions: Set[String] =
77-
Set(".mill-version", ".scala", ".sbt", ".sbt.shared", ".sc", ".yml", "pom.xml")
77+
Set(".scala", ".sbt", ".sbt.shared", ".sc", ".yml", "pom.xml")
7878

7979
implicit val updatesConfigEq: Eq[UpdatesConfig] =
8080
Eq.fromUniversalEquals

0 commit comments

Comments
 (0)