Skip to content

Commit f7d664d

Browse files
committed
Only compile 2.13 library in stdlib-bootstrapped
1 parent fe08f5f commit f7d664d

File tree

2 files changed

+8
-42
lines changed

2 files changed

+8
-42
lines changed

project/Build.scala

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -922,23 +922,19 @@ object Build {
922922
javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value
923923
)
924924

925-
/** Scala library compiled by dotty using the latest published sources of the library */
925+
/** Scala 2 library compiled by dotty using the latest published sources of the library.
926+
*
927+
* This version of the library is not (yet) TASTy/binary compatible with the Scala 2 compiled library.
928+
*/
926929
lazy val `stdlib-bootstrapped` = project.in(file("stdlib-bootstrapped")).
927930
withCommonSettings(Bootstrapped).
928931
dependsOn(dottyCompiler(Bootstrapped) % "provided; compile->runtime; test->test").
929932
settings(commonBootstrappedSettings).
930933
settings(
931934
moduleName := "scala-library",
932935
javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
933-
Compile/scalacOptions += "-Yerased-terms",
934-
Compile/scalacOptions ++= {
935-
Seq(
936-
"-sourcepath",
937-
Seq(
938-
(Compile/sourceManaged).value / "scala-library-src",
939-
(Compile/sourceManaged).value / "dotty-library-src",
940-
).mkString(File.pathSeparator),
941-
)
936+
Compile / scalacOptions ++= {
937+
Seq("-sourcepath", ((Compile/sourceManaged).value / "scala-library-src").toString)
942938
},
943939
Compile / doc / scalacOptions += "-Ydocument-synthetic-types",
944940
scalacOptions -= "-Xfatal-warnings",
@@ -970,36 +966,6 @@ object Build {
970966
((trgDir ** "*.scala") +++ (trgDir ** "*.java")).get.toSet
971967
} (Set(scalaLibrarySourcesJar)).toSeq
972968
}.taskValue,
973-
(Compile / sourceGenerators) += Def.task {
974-
val s = streams.value
975-
val cacheDir = s.cacheDirectory
976-
val trgDir = (Compile / sourceManaged).value / "dotty-library-src"
977-
978-
// NOTE `sourceDirectory` is used for actual copying,
979-
// but `sources` are used as cache keys
980-
val dottyLibSourceDirs = (`scala3-library-bootstrapped`/Compile/unmanagedSourceDirectories).value
981-
def dottyLibSources = dottyLibSourceDirs.foldLeft(PathFinder.empty) { (pf, dir) =>
982-
if (!dir.exists) pf else pf +++ (dir ** "*.scala") +++ (dir ** "*.java")
983-
}
984-
985-
val cachedFun = FileFunction.cached(
986-
cacheDir / s"copyDottyLibrarySrc",
987-
FilesInfo.lastModified,
988-
FilesInfo.exists,
989-
) { _ =>
990-
if (trgDir.exists) IO.delete(trgDir)
991-
dottyLibSourceDirs.foreach { dir =>
992-
if (dir.exists) {
993-
s.log.info(s"Copying scala3-library sources from $dir to $trgDir...")
994-
IO.copyDirectory(dir, trgDir)
995-
}
996-
}
997-
998-
((trgDir ** "*.scala") +++ (trgDir ** "*.java")).get.toSet
999-
}
1000-
1001-
cachedFun(dottyLibSources.get.toSet).toSeq
1002-
}.taskValue,
1003969
(Compile / sources) ~= (_.filterNot(file =>
1004970
// sources from https://github.com/scala/scala/tree/2.13.x/src/library-aux
1005971
file.getPath.endsWith("scala-library-src/scala/Any.scala") ||
@@ -1011,7 +977,7 @@ object Build {
1011977
(Test / managedClasspath) ~= {
1012978
_.filterNot(file => file.data.getName == s"scala-library-${stdlibVersion(Bootstrapped)}.jar")
1013979
},
1014-
)
980+
)
1015981

1016982
/** Test the tasty generated by `stdlib-bootstrapped`
1017983
*

stdlib-bootstrapped/test/Main.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ enum Color:
55

66
object HelloWorld:
77
def main(args: Array[String]): Unit = {
8-
println("hello dotty.superbootstrapped!")
8+
println("hello 2.13 library bootstrapped")
99
println(Color.Red)
1010
println(Color.Green)
1111
println(Color.Blue)

0 commit comments

Comments
 (0)