Skip to content

Commit b5931aa

Browse files
committed
Read minor latest scala version from constants
1 parent b4d2b3e commit b5931aa

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

build.sc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,23 @@ class TastyLib(val crossScalaVersion: String) extends ScalaCliCrossSbtModule
10341034
else Nil
10351035
}
10361036
)
1037+
def constantsFile = T.persistent {
1038+
val dir = T.dest / "constants"
1039+
val dest = dir / "Constants.scala"
1040+
val code =
1041+
s"""package scala.build.tastylib.internal
1042+
|
1043+
|/** Build-time constants. Generated by mill. */
1044+
|object Constants {
1045+
| def latestSupportedScala = "${Scala.defaultInternal}"
1046+
|}
1047+
|""".stripMargin
1048+
if (!os.isFile(dest) || os.read(dest) != code)
1049+
os.write.over(dest, code, createFolders = true)
1050+
PathRef(dir)
1051+
}
10371052

1053+
def generatedSources = super.generatedSources() ++ Seq(constantsFile())
10381054
}
10391055

10401056
object `local-repo` extends LocalRepo {

modules/tasty-lib/src/main/scala/scala/build/tastylib/TastyVersions.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
package scala.build.tastylib
22

3+
import scala.build.tastylib.internal.Constants
4+
35
object TastyVersions {
46

57
// Every time tasty version is updated, please update LatestSupportedScala as well!
6-
final val MajorVersion: Int = 28
7-
final val MinorVersion: Int = 1
8-
final val ExperimentalVersion: Int = 0
9-
108
object LatestSupportedScala {
119
final val MajorVersion: Int = 3
12-
final val MinorVersion: Int = 1
10+
final val MinorVersion: Int = Constants.latestSupportedScala.split('.')(1).toInt
1311
}
1412

1513
def shouldRunPreprocessor(

0 commit comments

Comments
 (0)