From f09d8660d97907e5675d555eeb745a4c9ed29ce6 Mon Sep 17 00:00:00 2001 From: Joan Goyeau Date: Fri, 16 Jan 2026 11:12:00 -0500 Subject: [PATCH] Upgrade dependencies --- .scalafmt.conf | 8 +++---- build.mill | 18 +++++++-------- .../mill/git/GitTaggedDockerModule.scala | 11 +++++----- .../goyeau/mill/git/GitVersionModule.scala | 22 ++++++++----------- .../mill/git/GitVersionedPublishModule.scala | 3 +-- .../git/CustomProjectIntegrationTests.scala | 4 ++-- .../git/DockerProjectIntegrationTests.scala | 4 ++-- .../com/goyeau/mill/git/ExampleTests.scala | 4 ++-- .../git/PublishProjectIntegrationTests.scala | 4 ++-- .../test/src/com/goyeau/mill/git/Tester.scala | 6 ++--- 10 files changed, 37 insertions(+), 47 deletions(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index f06ae36..51e5258 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,10 +1,10 @@ -version = 3.9.6 -runner.dialect = scala213source3 -fileOverride."glob:**.mill".runner.dialect = scala3Future -project.git = true +version = 3.10.3 +runner.dialect = scala3 maxColumn = 120 align.preset = more assumeStandardLibraryStripMargin = true rewrite.rules = [AvoidInfix, RedundantBraces, RedundantParens, SortModifiers, Imports] rewrite.redundantBraces.stringInterpolation = true rewrite.imports.sort = original +rewrite.scala3.convertToNewSyntax = true +rewrite.scala3.removeOptionalBraces = oldSyntaxToo diff --git a/build.mill b/build.mill index b3b2317..94b1fe8 100644 --- a/build.mill +++ b/build.mill @@ -1,10 +1,10 @@ -//| mill-version: 1.0.1-native +//| mill-version: 1.0.6-native //| mill-jvm-version: 17 //| repositories: //| - https://central.sonatype.com/repository/maven-snapshots //| - https://oss.sonatype.org/content/repositories/snapshots //| mvnDeps: -//| - com.goyeau::mill-git::0.3.0 +//| - com.goyeau::mill-git::0.3.2 //| - com.goyeau::mill-scalafix::0.6.0 //| - org.typelevel::scalac-options:0.1.7 @@ -24,7 +24,7 @@ trait MillGitCross with GitVersionedPublishModule with SonatypeCentralPublishModule: val millVersion = crossValue - override def scalaVersion = "3.7.1" + override def scalaVersion = "3.7.4" override def scalacOptions = super.scalacOptions() ++ ScalacOptions.tokensForVersion( ScalaVersion.unsafeFromString(scalaVersion()), ScalacOptions.default + source3 ++ fatalWarningOptions @@ -34,20 +34,18 @@ trait MillGitCross mvn"com.lihaoyi::mill-libs-scalalib:$millVersion", mvn"com.lihaoyi::mill-contrib-docker:$millVersion" ) - override def mvnDeps = super.mvnDeps() ++ Seq(mvn"org.eclipse.jgit:org.eclipse.jgit:7.1.0.202411261347-r") + override def mvnDeps = super.mvnDeps() ++ Seq(mvn"org.eclipse.jgit:org.eclipse.jgit:7.5.0.202512021534-r") - object test extends ScalaTests with TestModule.Munit: + object test extends ScalaTests with TestModule.Munit with StyleModule: override def mvnDeps = Seq( - mvn"org.scalameta::munit::1.1.0", + mvn"org.scalameta::munit::1.2.1", mvn"com.lihaoyi::mill-testkit:$millVersion" ) override def forkEnv = Map("MILL_EXECUTABLE_PATH" -> millExecutable.assembly().path.toString) // Create a Mill executable configured for testing our plugin object millExecutable extends JavaModule: - override def mvnDeps = millVersion match - case version if version.startsWith("1.0") => Seq(mvn"com.lihaoyi:mill-runner-launcher_3:$millVersion") - case _ => Seq(mvn"com.lihaoyi:mill-dist:$millVersion") + override def mvnDeps = Seq(mvn"com.lihaoyi:mill-runner-launcher_3:$millVersion") override def mainClass = Some("mill.launcher.MillLauncherMain") end test @@ -65,5 +63,5 @@ end MillGitCross def millBinaryVersion(millVersion: String) = millVersion match case version if version.startsWith("0.12") => "0.11" // 0.12.x is binary compatible with 0.11.x - case version if version.startsWith("1.0") => "1" + case version if version.startsWith("1.") => "1" case _ => throw IllegalArgumentException(s"Unsupported Mill version: $millVersion") diff --git a/mill-git/src/com/goyeau/mill/git/GitTaggedDockerModule.scala b/mill-git/src/com/goyeau/mill/git/GitTaggedDockerModule.scala index 837838a..700c2b3 100644 --- a/mill-git/src/com/goyeau/mill/git/GitTaggedDockerModule.scala +++ b/mill-git/src/com/goyeau/mill/git/GitTaggedDockerModule.scala @@ -4,11 +4,10 @@ import mill.* import mill.contrib.docker.DockerModule import mill.scalalib.JavaModule -trait GitTaggedDockerModule extends DockerModule { outer: JavaModule => - trait GitTaggedDocker extends DockerConfig { - def tagLatest: T[Boolean] = false +trait GitTaggedDockerModule extends DockerModule: + outer: JavaModule => + trait GitTaggedDocker extends DockerConfig: + def tagLatest: T[Boolean] = false override def tags: T[Seq[String]] = super.tags().map(tag => s"$tag:${GitVersionModule.version()()}") ++ - (if (tagLatest()) super.tags().map(tag => s"$tag:latest") else Seq.empty) - } -} + (if tagLatest() then super.tags().map(tag => s"$tag:latest") else Seq.empty) diff --git a/mill-git/src/com/goyeau/mill/git/GitVersionModule.scala b/mill-git/src/com/goyeau/mill/git/GitVersionModule.scala index 57ba21d..ea260af 100644 --- a/mill-git/src/com/goyeau/mill/git/GitVersionModule.scala +++ b/mill-git/src/com/goyeau/mill/git/GitVersionModule.scala @@ -13,7 +13,7 @@ import scala.util.Failure as TryFailure import scala.util.Success as TrySuccess import scala.util.Try -object GitVersionModule extends ExternalModule { +object GitVersionModule extends ExternalModule: /** Version derived from git. */ @@ -26,36 +26,34 @@ object GitVersionModule extends ExternalModule { val git = Git.open(gitRoot.toIO) val status = git.status().call() val isDirty = status.hasUncommittedChanges || !status.getUntracked.isEmpty - val snapshotSuffix = if (withSnapshotSuffix) "-SNAPSHOT" else "" + val snapshotSuffix = if withSnapshotSuffix then "-SNAPSHOT" else "" def uncommitted() = s"${uncommittedHash(git, hashLength)}$snapshotSuffix" val describeResult = Try(git.describe().setTags(true).setMatch("v[0-9]*").setAlways(true).call()) - describeResult match { - case TryFailure(_) => Result.Success(uncommitted()) + describeResult match + case TryFailure(_) => Result.Success(uncommitted()) case TrySuccess(description) => val taggedRegex = """v(\d.*?)(?:-(\d+)-g([\da-f]+))?""".r val untaggedRegex = """([\da-f]+)""".r - description match { + description match case taggedRegex(tag, distance, hash) => val distanceHash = Option(distance).fold { - if (isDirty) s"-1-${uncommitted()}" + if isDirty then s"-1-${uncommitted()}" else "" } { distance => - if (isDirty) s"-${distance.toInt + 1}-${uncommitted()}" + if isDirty then s"-${distance.toInt + 1}-${uncommitted()}" else s"-$distance-${hash.take(hashLength)}$snapshotSuffix" } Result.Success(s"$tag$distanceHash") case untaggedRegex(hash) => - if (isDirty) Result.Success(uncommitted()) + if isDirty then Result.Success(uncommitted()) else Result.Success(s"${hash.take(hashLength)}$snapshotSuffix") case _ => Result.Failure(s"Unexpected git describe output: $description") - } - } } - private def uncommittedHash(git: Git, hashLength: Int): String = { + private def uncommittedHash(git: Git, hashLength: Int): String = val indexCopy = os.temp.dir() / "index" val _ = Try(copy(pwd / ".git" / "index", indexCopy, replaceExisting = true, createFolders = true)) @@ -69,7 +67,5 @@ object GitVersionModule extends ExternalModule { ) val cache = altGit.add().addFilepattern(".").call() cache.writeTree(altGit.getRepository.newObjectInserter()).abbreviate(hashLength).name() - } override lazy val millDiscover = Discover[this.type] -} diff --git a/mill-git/src/com/goyeau/mill/git/GitVersionedPublishModule.scala b/mill-git/src/com/goyeau/mill/git/GitVersionedPublishModule.scala index 5624f5c..e7e7d2d 100644 --- a/mill-git/src/com/goyeau/mill/git/GitVersionedPublishModule.scala +++ b/mill-git/src/com/goyeau/mill/git/GitVersionedPublishModule.scala @@ -3,6 +3,5 @@ package com.goyeau.mill.git import mill.* import mill.scalalib.PublishModule -trait GitVersionedPublishModule extends PublishModule { +trait GitVersionedPublishModule extends PublishModule: def publishVersion: T[String] = GitVersionModule.version()() -} diff --git a/mill-git/test/src/com/goyeau/mill/git/CustomProjectIntegrationTests.scala b/mill-git/test/src/com/goyeau/mill/git/CustomProjectIntegrationTests.scala index 44558f0..a990314 100644 --- a/mill-git/test/src/com/goyeau/mill/git/CustomProjectIntegrationTests.scala +++ b/mill-git/test/src/com/goyeau/mill/git/CustomProjectIntegrationTests.scala @@ -1,9 +1,10 @@ package com.goyeau.mill.git import munit.FunSuite + import scala.concurrent.duration.* -class CustomProjectIntegrationTests extends FunSuite { +class CustomProjectIntegrationTests extends FunSuite: override val munitTimeout: Duration = 2.minute test("Uncommitted changes") { @@ -101,4 +102,3 @@ class CustomProjectIntegrationTests extends FunSuite { s"${result.out} is not a version and distance from it, followed by a 7 chars hash" ) } -} diff --git a/mill-git/test/src/com/goyeau/mill/git/DockerProjectIntegrationTests.scala b/mill-git/test/src/com/goyeau/mill/git/DockerProjectIntegrationTests.scala index 4a29d03..dacbae9 100644 --- a/mill-git/test/src/com/goyeau/mill/git/DockerProjectIntegrationTests.scala +++ b/mill-git/test/src/com/goyeau/mill/git/DockerProjectIntegrationTests.scala @@ -1,9 +1,10 @@ package com.goyeau.mill.git import munit.FunSuite + import scala.concurrent.duration.* -class DockerProjectIntegrationTests extends FunSuite { +class DockerProjectIntegrationTests extends FunSuite: override val munitTimeout: Duration = 2.minute test("Uncommitted changes") { @@ -130,4 +131,3 @@ class DockerProjectIntegrationTests extends FunSuite { s"${result.out} is not a version and distance from it, followed by a 7 chars hash" ) } -} diff --git a/mill-git/test/src/com/goyeau/mill/git/ExampleTests.scala b/mill-git/test/src/com/goyeau/mill/git/ExampleTests.scala index f992b2b..4f276c4 100644 --- a/mill-git/test/src/com/goyeau/mill/git/ExampleTests.scala +++ b/mill-git/test/src/com/goyeau/mill/git/ExampleTests.scala @@ -2,9 +2,10 @@ package com.goyeau.mill.git import mill.testkit.ExampleTester import munit.FunSuite + import scala.concurrent.duration.* -class ExampleTests extends FunSuite { +class ExampleTests extends FunSuite: override val munitTimeout: Duration = 2.minute test("Custom example") { @@ -15,4 +16,3 @@ class ExampleTests extends FunSuite { millExecutable = os.Path(sys.env("MILL_EXECUTABLE_PATH")) ) } -} diff --git a/mill-git/test/src/com/goyeau/mill/git/PublishProjectIntegrationTests.scala b/mill-git/test/src/com/goyeau/mill/git/PublishProjectIntegrationTests.scala index b7eb2ca..ac29fa3 100644 --- a/mill-git/test/src/com/goyeau/mill/git/PublishProjectIntegrationTests.scala +++ b/mill-git/test/src/com/goyeau/mill/git/PublishProjectIntegrationTests.scala @@ -1,9 +1,10 @@ package com.goyeau.mill.git import munit.FunSuite + import scala.concurrent.duration.* -class PublishProjectIntegrationTests extends FunSuite { +class PublishProjectIntegrationTests extends FunSuite: override val munitTimeout: Duration = 2.minute test("Uncommitted changes") { @@ -101,4 +102,3 @@ class PublishProjectIntegrationTests extends FunSuite { s"${result.out} is not a version and distance from it, followed by a 7 chars hash" ) } -} diff --git a/mill-git/test/src/com/goyeau/mill/git/Tester.scala b/mill-git/test/src/com/goyeau/mill/git/Tester.scala index 7723f66..e50ffae 100644 --- a/mill-git/test/src/com/goyeau/mill/git/Tester.scala +++ b/mill-git/test/src/com/goyeau/mill/git/Tester.scala @@ -3,13 +3,11 @@ package com.goyeau.mill.git import mill.testkit.IntegrationTester import os.RelPath -object Tester { - def create(project: RelPath) = { +object Tester: + def create(project: RelPath) = val resourceFolder = os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) new IntegrationTester( daemonMode = true, workspaceSourcePath = resourceFolder / project, millExecutable = os.Path(sys.env("MILL_EXECUTABLE_PATH")) ) - } -}