Skip to content

Commit

Permalink
Read minor latest scala version from constants
Browse files Browse the repository at this point in the history
  • Loading branch information
lwronski committed Sep 5, 2022
1 parent 96e2eee commit be1a8c8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
16 changes: 16 additions & 0 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,23 @@ class TastyLib(val crossScalaVersion: String) extends ScalaCliCrossSbtModule
else Nil
}
)
def constantsFile = T.persistent {
val dir = T.dest / "constants"
val dest = dir / "Constants.scala"
val code =
s"""package scala.build.tastylib.internal
|
|/** Build-time constants. Generated by mill. */
|object Constants {
| def latestSupportedScala = "${Scala.defaultInternal}"
|}
|""".stripMargin
if (!os.isFile(dest) || os.read(dest) != code)
os.write.over(dest, code, createFolders = true)
PathRef(dir)
}

def generatedSources = super.generatedSources() ++ Seq(constantsFile())
}

object `local-repo` extends LocalRepo {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package scala.build.tastylib

import scala.build.tastylib.internal.Constants

object TastyVersions {

// Every time tasty version is updated, please update LatestSupportedScala as well!
final val MajorVersion: Int = 28
final val MinorVersion: Int = 1
final val ExperimentalVersion: Int = 0

object LatestSupportedScala {
final val MajorVersion: Int = 3
final val MinorVersion: Int = 1
final val MinorVersion: Int = Constants.latestSupportedScala.split('.')(1).toInt
}

def shouldRunPreprocessor(
Expand Down

0 comments on commit be1a8c8

Please sign in to comment.