From dd6cd135a732d0e1adb536bb10e07d6d0436b43c Mon Sep 17 00:00:00 2001 From: Piotr Chabelski Date: Tue, 22 Oct 2024 16:39:47 +0200 Subject: [PATCH 1/3] Update Scala to 3.3.4 --- build.sc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sc b/build.sc index 6fc8744..6f3fe38 100644 --- a/build.sc +++ b/build.sc @@ -38,7 +38,7 @@ trait JavaMainClassNativeImage extends NativeImage { } object `scala3-graal-processor` extends ScalaModule { - def scalaVersion = "3.3.3" + def scalaVersion = "3.3.4" def mainClass = Some("scala.cli.graal.CoursierCacheProcessor") def ivyDeps = Agg( ivy"org.virtuslab.scala-cli::scala3-graal:1.5.1" @@ -46,7 +46,7 @@ object `scala3-graal-processor` extends ScalaModule { } object `java-class-name` extends ScalaModule with JavaMainClassNativeImage with JavaClassNamePublishModule { - def scalaVersion = "3.3.3" + def scalaVersion = "3.3.4" def nativeImageClassPath = T { // adapted from https://github.com/VirtusLab/scala-cli/blob/b19086697401827a6f8185040ceb248d8865bf21/build.sc#L732-L744 @@ -116,7 +116,7 @@ object `java-class-name` extends ScalaModule with JavaMainClassNativeImage with } object `java-class-name-tests` extends ScalaModule with SbtModule { - def scalaVersion = "3.3.3" + def scalaVersion = "3.3.4" trait Tests extends ScalaModule with super.SbtModuleTests with TestModule.Utest { def launcher: T[PathRef] def ivyDeps = super.ivyDeps() ++ Seq( From fae8a7b983fa0a36c62054c64b6c1f326f0a2c26 Mon Sep 17 00:00:00 2001 From: Piotr Chabelski Date: Wed, 23 Oct 2024 13:39:03 +0200 Subject: [PATCH 2/3] Pin all dependency versions in the Mill build --- build.sc | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/build.sc b/build.sc index 6f3fe38..37739be 100644 --- a/build.sc +++ b/build.sc @@ -12,6 +12,15 @@ import scala.concurrent.duration.DurationInt import java.io.File +object Versions { + def scala = "3.3.4" + def scalaCli = "1.5.1" + def graalVmVersion = "22.1.0" + def coursier = "2.1.14" + def osLib = "0.11.3" + def uTest = "0.8.4" +} + trait JavaMainClassNativeImage extends NativeImage { def nativeImageOptions = T{ @@ -20,8 +29,7 @@ trait JavaMainClassNativeImage extends NativeImage { ) } def nativeImagePersist = System.getenv("CI") != null - def graalVmVersion = "22.1.0" - def nativeImageGraalVmJvmId = s"graalvm-java17:$graalVmVersion" + def nativeImageGraalVmJvmId = s"graalvm-java17:${Versions.graalVmVersion}" def nativeImageName = "java-class-name" def nativeImageMainClass = "scala.cli.javaclassname.JavaClassName" @@ -38,15 +46,15 @@ trait JavaMainClassNativeImage extends NativeImage { } object `scala3-graal-processor` extends ScalaModule { - def scalaVersion = "3.3.4" + def scalaVersion = Versions.scala def mainClass = Some("scala.cli.graal.CoursierCacheProcessor") def ivyDeps = Agg( - ivy"org.virtuslab.scala-cli::scala3-graal:1.5.1" + ivy"org.virtuslab.scala-cli::scala3-graal:${Versions.scalaCli}" ) } object `java-class-name` extends ScalaModule with JavaMainClassNativeImage with JavaClassNamePublishModule { - def scalaVersion = "3.3.4" + def scalaVersion = Versions.scala def nativeImageClassPath = T { // adapted from https://github.com/VirtusLab/scala-cli/blob/b19086697401827a6f8185040ceb248d8865bf21/build.sc#L732-L744 @@ -70,10 +78,10 @@ object `java-class-name` extends ScalaModule with JavaMainClassNativeImage with cp.split(File.pathSeparator).toSeq.map(p => mill.PathRef(os.Path(p))) } def ivyDeps = super.ivyDeps() ++ Seq( - ivy"org.scala-lang::scala3-compiler:${scalaVersion()}" + ivy"org.scala-lang::scala3-compiler:${Versions.scala}" ) def compileIvyDeps = super.compileIvyDeps() ++ Seq( - ivy"org.graalvm.nativeimage:svm:$graalVmVersion" + ivy"org.graalvm.nativeimage:svm:${Versions.graalVmVersion}" ) object static extends JavaMainClassNativeImage { @@ -91,7 +99,7 @@ object `java-class-name` extends ScalaModule with JavaMainClassNativeImage with Some( NativeImage.linuxStaticParams( "scala-cli-base-musl:latest", - s"https://github.com/coursier/coursier/releases/download/v$csDockerVersion/cs-x86_64-pc-linux.gz" + s"https://github.com/coursier/coursier/releases/download/v${Versions.coursier}/cs-x86_64-pc-linux.gz" ) ) } @@ -109,19 +117,19 @@ object `java-class-name` extends ScalaModule with JavaMainClassNativeImage with def nativeImageDockerParams = Some( NativeImage.linuxMostlyStaticParams( "ubuntu:18.04", // TODO Pin that? - s"https://github.com/coursier/coursier/releases/download/v$csDockerVersion/cs-x86_64-pc-linux.gz" + s"https://github.com/coursier/coursier/releases/download/v${Versions.coursier}/cs-x86_64-pc-linux.gz" ) ) } } object `java-class-name-tests` extends ScalaModule with SbtModule { - def scalaVersion = "3.3.4" + def scalaVersion = Versions.scala trait Tests extends ScalaModule with super.SbtModuleTests with TestModule.Utest { def launcher: T[PathRef] def ivyDeps = super.ivyDeps() ++ Seq( - ivy"com.lihaoyi::os-lib:0.11.3", - ivy"com.lihaoyi::utest:0.8.4" + ivy"com.lihaoyi::os-lib:${Versions.osLib}", + ivy"com.lihaoyi::utest:${Versions.uTest}" ) def testFramework = "utest.runner.Framework" def forkEnv = super.forkEnv() ++ Seq( @@ -141,8 +149,6 @@ object `java-class-name-tests` extends ScalaModule with SbtModule { } } -def csDockerVersion = "2.1.14" - def publishVersion0 = T { val state = VcsVersion.vcsState() if (state.commitsSinceLastTag > 0) { From aa1062823cdd439a62c42db94871b66fc6a48563 Mon Sep 17 00:00:00 2001 From: Piotr Chabelski Date: Wed, 13 Nov 2024 14:32:48 +0100 Subject: [PATCH 3/3] Cap JLine version at 3.25.0 --- build.sc | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/build.sc b/build.sc index 37739be..a11f069 100644 --- a/build.sc +++ b/build.sc @@ -19,6 +19,7 @@ object Versions { def coursier = "2.1.14" def osLib = "0.11.3" def uTest = "0.8.4" + def jline = "3.25.0" } trait JavaMainClassNativeImage extends NativeImage { @@ -45,17 +46,30 @@ trait JavaMainClassNativeImage extends NativeImage { } } -object `scala3-graal-processor` extends ScalaModule { - def scalaVersion = Versions.scala - def mainClass = Some("scala.cli.graal.CoursierCacheProcessor") - def ivyDeps = Agg( - ivy"org.virtuslab.scala-cli::scala3-graal:${Versions.scalaCli}" +trait JavaClassNameModule extends ScalaModule { + override def scalaVersion = Versions.scala + override def transitiveIvyDeps = T { + super.transitiveIvyDeps() + .map(_.exclude("org.jline" -> "jline-reader")) + .map(_.exclude("org.jline" -> "jline-terminal")) + .map(_.exclude("org.jline" -> "jline-terminal-jna")) + } + def jlineDeps = Agg( + ivy"org.jline:jline-reader:${Versions.jline}", + ivy"org.jline:jline-terminal:${Versions.jline}", + ivy"org.jline:jline-terminal-jna:${Versions.jline}" ) + override def ivyDeps = super.ivyDeps() ++ jlineDeps } -object `java-class-name` extends ScalaModule with JavaMainClassNativeImage with JavaClassNamePublishModule { - def scalaVersion = Versions.scala +object `scala3-graal-processor` extends JavaClassNameModule { + override def mainClass = Some("scala.cli.graal.CoursierCacheProcessor") + override def ivyDeps = jlineDeps ++ Agg( + ivy"org.virtuslab.scala-cli::scala3-graal:${Versions.scalaCli}" + ) +} +object `java-class-name` extends JavaClassNameModule with JavaMainClassNativeImage with JavaClassNamePublishModule { def nativeImageClassPath = T { // adapted from https://github.com/VirtusLab/scala-cli/blob/b19086697401827a6f8185040ceb248d8865bf21/build.sc#L732-L744 @@ -77,10 +91,10 @@ object `java-class-name` extends ScalaModule with JavaMainClassNativeImage with System.err.println(s" $f") cp.split(File.pathSeparator).toSeq.map(p => mill.PathRef(os.Path(p))) } - def ivyDeps = super.ivyDeps() ++ Seq( + override def ivyDeps = super.ivyDeps() ++ jlineDeps ++ Agg( ivy"org.scala-lang::scala3-compiler:${Versions.scala}" ) - def compileIvyDeps = super.compileIvyDeps() ++ Seq( + override def compileIvyDeps = super.compileIvyDeps() ++ Agg( ivy"org.graalvm.nativeimage:svm:${Versions.graalVmVersion}" ) @@ -123,11 +137,10 @@ object `java-class-name` extends ScalaModule with JavaMainClassNativeImage with } } -object `java-class-name-tests` extends ScalaModule with SbtModule { - def scalaVersion = Versions.scala +object `java-class-name-tests` extends JavaClassNameModule with SbtModule { trait Tests extends ScalaModule with super.SbtModuleTests with TestModule.Utest { def launcher: T[PathRef] - def ivyDeps = super.ivyDeps() ++ Seq( + def ivyDeps = super.ivyDeps() ++ jlineDeps ++ Seq( ivy"com.lihaoyi::os-lib:${Versions.osLib}", ivy"com.lihaoyi::utest:${Versions.uTest}" )