Skip to content

Commit 5cc877a

Browse files
committed
compile tasty-core with scala 2 also
1 parent 9b64292 commit 5cc877a

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ val `dotty-bench` = Build.`dotty-bench`
1616
val `dotty-bench-bootstrapped` = Build.`dotty-bench-bootstrapped`
1717
val `tasty-core` = Build.`tasty-core`
1818
val `tasty-core-bootstrapped` = Build.`tasty-core-bootstrapped`
19+
val `tasty-core-scala2` = Build.`tasty-core-scala2`
1920
val `scala-library` = Build.`scala-library`
2021
val `scala-compiler` = Build.`scala-compiler`
2122
val `scala-reflect` = Build.`scala-reflect`

project/Build.scala

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,13 @@ object Build {
252252
autoScalaLibrary := false
253253
)
254254

255+
lazy val commonScala2Settings = commonSettings ++ Seq(
256+
scalaVersion := stdlibVersion(Bootstrapped),
257+
moduleName ~= { _.stripSuffix("-scala2") },
258+
version := dottyVersion,
259+
target := baseDirectory.value / ".." / "out" / "scala-2" / name.value,
260+
)
261+
255262
// Settings used when compiling dotty with the reference compiler
256263
lazy val commonNonBootstrappedSettings = commonDottySettings ++ Seq(
257264
unmanagedSourceDirectories in Compile += baseDirectory.value / "src-non-bootstrapped",
@@ -749,14 +756,15 @@ object Build {
749756
)
750757

751758
lazy val tastyCoreSettings = Seq(
752-
scalacOptions := {
753-
val (language, other) = scalacOptions.value.partition(_.startsWith("-language:"))
759+
scalacOptions ~= { old =>
760+
val (language, other) = old.partition(_.startsWith("-language:"))
754761
other :+ (language.headOption.map(_ + ",Scala2Compat").getOrElse("-language:Scala2Compat"))
755762
}
756763
)
757764

758765
lazy val `tasty-core` = project.in(file("tasty")).asTastyCore(NonBootstrapped)
759766
lazy val `tasty-core-bootstrapped`: Project = project.in(file("tasty")).asTastyCore(Bootstrapped)
767+
lazy val `tasty-core-scala2`: Project = project.in(file("tasty")).asTastyCoreScala2
760768

761769
def tastyCore(implicit mode: Mode): Project = mode match {
762770
case NonBootstrapped => `tasty-core`
@@ -1310,6 +1318,8 @@ object Build {
13101318
dependsOn(dottyLibrary).
13111319
settings(tastyCoreSettings)
13121320

1321+
def asTastyCoreScala2: Project = project.settings(commonScala2Settings)
1322+
13131323
def asDottyDoc(implicit mode: Mode): Project = project.withCommonSettings.
13141324
dependsOn(dottyCompiler, dottyCompiler % "test->test").
13151325
settings(dottyDocSettings)

0 commit comments

Comments
 (0)