@@ -922,15 +922,17 @@ object Build {
922
922
javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value
923
923
)
924
924
925
- /** Scala library compiled by dotty using the latest published sources of the library */
925
+ /** Scala library compiled by dotty using the latest published sources of the 2.13 library
926
+ * and the current Scala 3 library sources.
927
+ *
928
+ * This version of the library is not binary compatible with the Scala 2 compiled library.
929
+ * It compiles every file as Scala 3 sources.
930
+ */
926
931
lazy val `stdlib-bootstrapped` = project.in(file(" stdlib-bootstrapped" )).
927
932
withCommonSettings(Bootstrapped ).
928
933
dependsOn(dottyCompiler(Bootstrapped ) % " provided; compile->runtime; test->test" ).
929
- settings(commonBootstrappedSettings ).
934
+ settings(commonStdlibBootstrappedSettings ).
930
935
settings(
931
- moduleName := " scala-library" ,
932
- javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
933
- Compile / scalacOptions += " -Yerased-terms" ,
934
936
Compile / scalacOptions ++= {
935
937
Seq (
936
938
" -sourcepath" ,
@@ -940,36 +942,6 @@ object Build {
940
942
).mkString(File .pathSeparator),
941
943
)
942
944
},
943
- Compile / doc / scalacOptions += " -Ydocument-synthetic-types" ,
944
- scalacOptions -= " -Xfatal-warnings" ,
945
- ivyConfigurations += SourceDeps .hide,
946
- transitiveClassifiers := Seq (" sources" ),
947
- libraryDependencies +=
948
- (" org.scala-lang" % " scala-library" % stdlibVersion(Bootstrapped ) % " sourcedeps" ),
949
- (Compile / sourceGenerators) += Def .task {
950
- val s = streams.value
951
- val cacheDir = s.cacheDirectory
952
- val trgDir = (Compile / sourceManaged).value / " scala-library-src"
953
-
954
- val report = updateClassifiers.value
955
- val scalaLibrarySourcesJar = report.select(
956
- configuration = configurationFilter(" sourcedeps" ),
957
- module = (_ : ModuleID ).name == " scala-library" ,
958
- artifact = artifactFilter(`type` = " src" )).headOption.getOrElse {
959
- sys.error(s " Could not fetch scala-library sources " )
960
- }
961
-
962
- FileFunction .cached(cacheDir / s " fetchScalaLibrarySrc " ,
963
- FilesInfo .lastModified, FilesInfo .exists) { dependencies =>
964
- s.log.info(s " Unpacking scala-library sources to $trgDir... " )
965
- if (trgDir.exists)
966
- IO .delete(trgDir)
967
- IO .createDirectory(trgDir)
968
- IO .unzip(scalaLibrarySourcesJar, trgDir)
969
-
970
- ((trgDir ** " *.scala" ) +++ (trgDir ** " *.java" )).get.toSet
971
- } (Set (scalaLibrarySourcesJar)).toSeq
972
- }.taskValue,
973
945
(Compile / sourceGenerators) += Def .task {
974
946
val s = streams.value
975
947
val cacheDir = s.cacheDirectory
@@ -1000,6 +972,56 @@ object Build {
1000
972
1001
973
cachedFun(dottyLibSources.get.toSet).toSeq
1002
974
}.taskValue,
975
+ )
976
+
977
+ /** Scala 2 library compiled by dotty using the latest published sources of the library.
978
+ *
979
+ * This version of the library is not (yet) binary compatible with the Scala 2 compiled library.
980
+ */
981
+ lazy val `stdlib-2_13-bootstrapped` = project.in(file(" stdlib-2_13-bootstrapped" )).
982
+ withCommonSettings(Bootstrapped ).
983
+ dependsOn(dottyCompiler(Bootstrapped ) % " provided; compile->runtime; test->test" ).
984
+ settings(commonStdlibBootstrappedSettings).
985
+ settings(
986
+ Compile / scalacOptions ++= {
987
+ Seq (" -sourcepath" , ((Compile / sourceManaged).value / " scala-library-src" ).toString)
988
+ },
989
+ )
990
+
991
+ lazy val commonStdlibBootstrappedSettings =
992
+ commonBootstrappedSettings ++ Seq (
993
+ moduleName := " scala-library" ,
994
+ javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
995
+ Compile / doc / scalacOptions += " -Ydocument-synthetic-types" ,
996
+ scalacOptions -= " -Xfatal-warnings" ,
997
+ ivyConfigurations += SourceDeps .hide,
998
+ transitiveClassifiers := Seq (" sources" ),
999
+ libraryDependencies +=
1000
+ (" org.scala-lang" % " scala-library" % stdlibVersion(Bootstrapped ) % " sourcedeps" ),
1001
+ (Compile / sourceGenerators) += Def .task {
1002
+ val s = streams.value
1003
+ val cacheDir = s.cacheDirectory
1004
+ val trgDir = (Compile / sourceManaged).value / " scala-library-src"
1005
+
1006
+ val report = updateClassifiers.value
1007
+ val scalaLibrarySourcesJar = report.select(
1008
+ configuration = configurationFilter(" sourcedeps" ),
1009
+ module = (_ : ModuleID ).name == " scala-library" ,
1010
+ artifact = artifactFilter(`type` = " src" )).headOption.getOrElse {
1011
+ sys.error(s " Could not fetch scala-library sources " )
1012
+ }
1013
+
1014
+ FileFunction .cached(cacheDir / s " fetchScalaLibrarySrc " ,
1015
+ FilesInfo .lastModified, FilesInfo .exists) { dependencies =>
1016
+ s.log.info(s " Unpacking scala-library sources to $trgDir... " )
1017
+ if (trgDir.exists)
1018
+ IO .delete(trgDir)
1019
+ IO .createDirectory(trgDir)
1020
+ IO .unzip(scalaLibrarySourcesJar, trgDir)
1021
+
1022
+ ((trgDir ** " *.scala" ) +++ (trgDir ** " *.java" )).get.toSet
1023
+ } (Set (scalaLibrarySourcesJar)).toSeq
1024
+ }.taskValue,
1003
1025
(Compile / sources) ~= (_.filterNot(file =>
1004
1026
// sources from https://github.com/scala/scala/tree/2.13.x/src/library-aux
1005
1027
file.getPath.endsWith(" scala-library-src/scala/Any.scala" ) ||
@@ -1011,7 +1033,7 @@ object Build {
1011
1033
(Test / managedClasspath) ~= {
1012
1034
_.filterNot(file => file.data.getName == s " scala-library- ${stdlibVersion(Bootstrapped )}.jar " )
1013
1035
},
1014
- )
1036
+ )
1015
1037
1016
1038
/** Test the tasty generated by `stdlib-bootstrapped`
1017
1039
*
0 commit comments