Skip to content

Commit 26f9dd0

Browse files
authored
Merge pull request #3536 from scala-steward-org/topic/use-one-mill-version-var
Use only one variable for `mill-version` files
2 parents eae30d0 + f297f74 commit 26f9dd0

File tree

4 files changed

+5
-12
lines changed

4 files changed

+5
-12
lines changed

docs/repo-specific-configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ updates.allowPreReleases = [ { groupId = "com.example", artifactId="foo" } ]
130130
updates.limit = 5
131131

132132
# The extensions of files that should be updated.
133-
# Default: [".mill",".mill-version",".sbt",".sbt.shared",".sc",".scala",".scalafmt.conf",".sdkmanrc",".yml","build.properties","mill-version","pom.xml"]
133+
# Default: [".mill",".sbt",".sbt.shared",".sc",".scala",".scalafmt.conf",".sdkmanrc",".yml","build.properties","mill-version","pom.xml"]
134134
updates.fileExtensions = [".scala", ".sbt", ".sbt.shared", ".sc", ".yml", ".md", ".markdown", ".txt"]
135135

136136
# If "on-conflicts", Scala Steward will update the PR it created to resolve conflicts as

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,8 @@ final class MillAlg[F[_]](defaultResolver: Resolver)(implicit
9393

9494
private def getMillVersion(buildRootDir: File): F[Option[Version]] =
9595
for {
96-
millVersionFileContent <- fileAlg.readFile(buildRootDir / millVersionName)
97-
millVersionFileInConfigContent <- fileAlg.readFile(
98-
buildRootDir / ".config" / millVersionNameInConfig
99-
)
96+
millVersionFileContent <- fileAlg.readFile(buildRootDir / s".$millVersionName")
97+
millVersionFileInConfigContent <- fileAlg.readFile(buildRootDir / ".config" / millVersionName)
10098
version = millVersionFileContent
10199
.orElse(millVersionFileInConfigContent)
102100
.flatMap(parser.parseMillVersion)
@@ -151,6 +149,5 @@ object MillAlg {
151149
update.groupId === millMainGroupId &&
152150
update.artifactIds.exists(_.name === millMainArtifactId.name)
153151

154-
val millVersionName = ".mill-version"
155-
val millVersionNameInConfig = "mill-version"
152+
val millVersionName = "mill-version"
156153
}

modules/core/src/main/scala/org/scalasteward/core/edit/update/Selector.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,7 @@ object Selector {
179179
versionPositions: List[VersionPosition]
180180
): List[VersionPosition] =
181181
if (MillAlg.isMillMainUpdate(update))
182-
versionPositions.filter(f =>
183-
f.version.path.endsWith(MillAlg.millVersionNameInConfig) ||
184-
f.version.path.endsWith(MillAlg.millVersionName)
185-
)
182+
versionPositions.filter(_.version.path.endsWith(MillAlg.millVersionName))
186183
else List.empty
187184

188185
private def sbtVersionPositions(

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ object UpdatesConfig {
107107
Set(
108108
".mill",
109109
MillAlg.millVersionName,
110-
MillAlg.millVersionNameInConfig,
111110
".sbt",
112111
".sbt.shared",
113112
".sc",

0 commit comments

Comments
 (0)