Skip to content

Commit 39a9125

Browse files
authored
Merge pull request #2241 from lefou/mill-version-rev
2 parents 7f67e25 + 748560f commit 39a9125

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
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

modules/core/src/test/scala/org/scalasteward/core/edit/EditAlgTest.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,12 @@ class EditAlgTest extends FunSuite {
258258
newerVersions = Nel.of("0.9.9")
259259
)
260260
val original = Map(
261-
".mill-version" -> """0.9.5"""
261+
".mill-version" -> """0.9.5""",
262+
".travis.yml" -> """- TEST_MILL_VERSION=0.9.5"""
262263
)
263264
val expected = Map(
264-
".mill-version" -> """0.9.9"""
265+
".mill-version" -> """0.9.9""",
266+
".travis.yml" -> """- TEST_MILL_VERSION=0.9.5"""
265267
)
266268
assertEquals(runApplyUpdate(Repo("edit-alg", "test-10"), update, original), expected)
267269
}

0 commit comments

Comments
 (0)