Skip to content

Commit

Permalink
Use only one variable for mill-version files
Browse files Browse the repository at this point in the history
Using one variable is enough since `millVersionNameInConfig` was a
suffix of `millVersionName`.
  • Loading branch information
fthomas committed Jan 11, 2025
1 parent eae30d0 commit f297f74
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/repo-specific-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ updates.allowPreReleases = [ { groupId = "com.example", artifactId="foo" } ]
updates.limit = 5

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

# If "on-conflicts", Scala Steward will update the PR it created to resolve conflicts as
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,8 @@ final class MillAlg[F[_]](defaultResolver: Resolver)(implicit

private def getMillVersion(buildRootDir: File): F[Option[Version]] =
for {
millVersionFileContent <- fileAlg.readFile(buildRootDir / millVersionName)
millVersionFileInConfigContent <- fileAlg.readFile(
buildRootDir / ".config" / millVersionNameInConfig
)
millVersionFileContent <- fileAlg.readFile(buildRootDir / s".$millVersionName")
millVersionFileInConfigContent <- fileAlg.readFile(buildRootDir / ".config" / millVersionName)
version = millVersionFileContent
.orElse(millVersionFileInConfigContent)
.flatMap(parser.parseMillVersion)
Expand Down Expand Up @@ -151,6 +149,5 @@ object MillAlg {
update.groupId === millMainGroupId &&
update.artifactIds.exists(_.name === millMainArtifactId.name)

val millVersionName = ".mill-version"
val millVersionNameInConfig = "mill-version"
val millVersionName = "mill-version"
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,7 @@ object Selector {
versionPositions: List[VersionPosition]
): List[VersionPosition] =
if (MillAlg.isMillMainUpdate(update))
versionPositions.filter(f =>
f.version.path.endsWith(MillAlg.millVersionNameInConfig) ||
f.version.path.endsWith(MillAlg.millVersionName)
)
versionPositions.filter(_.version.path.endsWith(MillAlg.millVersionName))
else List.empty

private def sbtVersionPositions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ object UpdatesConfig {
Set(
".mill",
MillAlg.millVersionName,
MillAlg.millVersionNameInConfig,
".sbt",
".sbt.shared",
".sc",
Expand Down

0 comments on commit f297f74

Please sign in to comment.