@@ -12,6 +12,16 @@ import scala.concurrent.duration.DurationInt
1212
1313import java .io .File
1414
15+ object Versions {
16+ def scala = " 3.3.4"
17+ def scalaCli = " 1.5.1"
18+ def graalVmVersion = " 22.1.0"
19+ def coursier = " 2.1.14"
20+ def osLib = " 0.11.3"
21+ def uTest = " 0.8.4"
22+ def jline = " 3.25.0"
23+ }
24+
1525trait JavaMainClassNativeImage extends NativeImage {
1626
1727 def nativeImageOptions = T {
@@ -20,8 +30,7 @@ trait JavaMainClassNativeImage extends NativeImage {
2030 )
2131 }
2232 def nativeImagePersist = System .getenv(" CI" ) != null
23- def graalVmVersion = " 22.1.0"
24- def nativeImageGraalVmJvmId = s " graalvm-java17: $graalVmVersion"
33+ def nativeImageGraalVmJvmId = s " graalvm-java17: ${Versions .graalVmVersion}"
2534 def nativeImageName = " java-class-name"
2635 def nativeImageMainClass = " scala.cli.javaclassname.JavaClassName"
2736
@@ -37,17 +46,30 @@ trait JavaMainClassNativeImage extends NativeImage {
3746 }
3847}
3948
40- object `scala3-graal-processor` extends ScalaModule {
41- def scalaVersion = " 3.3.3"
42- def mainClass = Some (" scala.cli.graal.CoursierCacheProcessor" )
43- def ivyDeps = Agg (
44- ivy " org.virtuslab.scala-cli::scala3-graal:1.5.1 "
49+ trait JavaClassNameModule extends ScalaModule {
50+ override def scalaVersion = Versions .scala
51+ override def transitiveIvyDeps = T {
52+ super .transitiveIvyDeps()
53+ .map(_.exclude(" org.jline" -> " jline-reader" ))
54+ .map(_.exclude(" org.jline" -> " jline-terminal" ))
55+ .map(_.exclude(" org.jline" -> " jline-terminal-jna" ))
56+ }
57+ def jlineDeps = Agg (
58+ ivy " org.jline:jline-reader: ${Versions .jline}" ,
59+ ivy " org.jline:jline-terminal: ${Versions .jline}" ,
60+ ivy " org.jline:jline-terminal-jna: ${Versions .jline}"
4561 )
62+ override def ivyDeps = super .ivyDeps() ++ jlineDeps
4663}
4764
48- object `java-class-name` extends ScalaModule with JavaMainClassNativeImage with JavaClassNamePublishModule {
49- def scalaVersion = " 3.3.3"
65+ object `scala3-graal-processor` extends JavaClassNameModule {
66+ override def mainClass = Some (" scala.cli.graal.CoursierCacheProcessor" )
67+ override def ivyDeps = jlineDeps ++ Agg (
68+ ivy " org.virtuslab.scala-cli::scala3-graal: ${Versions .scalaCli}"
69+ )
70+ }
5071
72+ object `java-class-name` extends JavaClassNameModule with JavaMainClassNativeImage with JavaClassNamePublishModule {
5173 def nativeImageClassPath = T {
5274 // adapted from https://github.com/VirtusLab/scala-cli/blob/b19086697401827a6f8185040ceb248d8865bf21/build.sc#L732-L744
5375
@@ -69,11 +91,11 @@ object `java-class-name` extends ScalaModule with JavaMainClassNativeImage with
6991 System .err.println(s " $f" )
7092 cp.split(File .pathSeparator).toSeq.map(p => mill.PathRef (os.Path (p)))
7193 }
72- def ivyDeps = super .ivyDeps() ++ Seq (
73- ivy " org.scala-lang::scala3-compiler: ${scalaVersion() }"
94+ override def ivyDeps = super .ivyDeps() ++ jlineDeps ++ Agg (
95+ ivy " org.scala-lang::scala3-compiler: ${Versions .scala }"
7496 )
75- def compileIvyDeps = super .compileIvyDeps() ++ Seq (
76- ivy " org.graalvm.nativeimage:svm: $graalVmVersion"
97+ override def compileIvyDeps = super .compileIvyDeps() ++ Agg (
98+ ivy " org.graalvm.nativeimage:svm: ${ Versions . graalVmVersion} "
7799 )
78100
79101 object static extends JavaMainClassNativeImage {
@@ -91,7 +113,7 @@ object `java-class-name` extends ScalaModule with JavaMainClassNativeImage with
91113 Some (
92114 NativeImage .linuxStaticParams(
93115 " scala-cli-base-musl:latest" ,
94- s " https://github.com/coursier/coursier/releases/download/v $csDockerVersion /cs-x86_64-pc-linux.gz "
116+ s " https://github.com/coursier/coursier/releases/download/v ${ Versions .coursier} /cs-x86_64-pc-linux.gz "
95117 )
96118 )
97119 }
@@ -109,19 +131,18 @@ object `java-class-name` extends ScalaModule with JavaMainClassNativeImage with
109131 def nativeImageDockerParams = Some (
110132 NativeImage .linuxMostlyStaticParams(
111133 " ubuntu:18.04" , // TODO Pin that?
112- s " https://github.com/coursier/coursier/releases/download/v $csDockerVersion /cs-x86_64-pc-linux.gz "
134+ s " https://github.com/coursier/coursier/releases/download/v ${ Versions .coursier} /cs-x86_64-pc-linux.gz "
113135 )
114136 )
115137 }
116138}
117139
118- object `java-class-name-tests` extends ScalaModule with SbtModule {
119- def scalaVersion = " 3.3.3"
140+ object `java-class-name-tests` extends JavaClassNameModule with SbtModule {
120141 trait Tests extends ScalaModule with super .SbtModuleTests with TestModule .Utest {
121142 def launcher : T [PathRef ]
122- def ivyDeps = super .ivyDeps() ++ Seq (
123- ivy " com.lihaoyi::os-lib:0.11.3 " ,
124- ivy " com.lihaoyi::utest:0.8.4 "
143+ def ivyDeps = super .ivyDeps() ++ jlineDeps ++ Seq (
144+ ivy " com.lihaoyi::os-lib: ${ Versions .osLib} " ,
145+ ivy " com.lihaoyi::utest: ${ Versions .uTest} "
125146 )
126147 def testFramework = " utest.runner.Framework"
127148 def forkEnv = super .forkEnv() ++ Seq (
@@ -141,8 +162,6 @@ object `java-class-name-tests` extends ScalaModule with SbtModule {
141162 }
142163}
143164
144- def csDockerVersion = " 2.1.14"
145-
146165def publishVersion0 = T {
147166 val state = VcsVersion .vcsState()
148167 if (state.commitsSinceLastTag > 0 ) {
0 commit comments