@@ -922,69 +922,13 @@ 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 */
926
- lazy val `stdlib-bootstrapped` = project.in(file(" stdlib-bootstrapped" )).
927
- withCommonSettings(Bootstrapped ).
928
- dependsOn(dottyCompiler(Bootstrapped ) % " provided; compile->runtime; test->test" ).
929
- settings(stdliBootstrappedCommonSettings).
930
- settings(
931
- Compile / scalacOptions ++= {
932
- Seq (
933
- " -sourcepath" ,
934
- Seq (
935
- baseDirectory.value / " stdlib-bootstrapped" / " src" ,
936
- (Compile / sourceManaged).value / " scala-library-src" ,
937
- ).mkString(File .pathSeparator),
938
- )
939
- },
940
- mimaCheckDirection := " both" ,
941
- mimaBinaryIssueFilters ++= MiMaFilters .LibraryBootstrappedForward ,
942
- libraryDependencies += // For jar packaging
943
- (" org.scala-lang" % " scala-library" % stdlibVersion(Bootstrapped )),
944
- exportJars := true ,
945
- Compile / packageBin / artifactName := { (sv : ScalaVersion , module : ModuleID , artifact : Artifact ) =>
946
- artifact.name + " -" + stdlibVersion(Bootstrapped ) + " -" + module.revision + " ." + artifact.extension
947
- },
948
- Compile / packageBin / mappings := {
949
- val s = streams.value
950
- val report = updateClassifiers.value
951
- val scalaLibraryJar =
952
- // FIXME
953
- report.select(
954
- configuration = configurationFilter(" sourcedeps" ),
955
- module = (_ : ModuleID ).name == " scala-library" ,
956
- artifact = artifactFilter(`type` = " src" )).headOption.getOrElse {
957
- sys.error(s " Could not fetch scala-library sources " )
958
- }.getParentFile / " scala-library-2.13.10.jar"
959
- val cacheDir = s.cacheDirectory
960
- val trgDir = (Compile / sourceManaged).value / " scala-library-bin"
961
- FileFunction .cached(cacheDir / " fetchScalaLibraryBin" ,
962
- FilesInfo .lastModified, FilesInfo .exists) { dependencies =>
963
- s.log.info(s " Unpacking scala-library classfiles to $trgDir... " )
964
- if (trgDir.exists)
965
- IO .delete(trgDir)
966
- IO .createDirectory(trgDir)
967
- IO .unzip(scalaLibraryJar, trgDir)
968
-
969
- (trgDir ** " *.class" ).get.toSet
970
- } (Set (scalaLibraryJar)).toSeq
971
- val allScalaLibraryJarFiles =
972
- trgDir.allPaths.get().filterNot(_.getName.endsWith(" .MF" )) // TODO use parts of the old manifest?
973
- val allScalaLibraryJarMappings : Seq [(java.io.File , String )] =
974
- allScalaLibraryJarFiles.zip(allScalaLibraryJarFiles.map(_.relativeTo(trgDir).get.getPath))
975
-
976
- val tastyFileMappings : Seq [(java.io.File , String )] =
977
- (Compile / packageBin / mappings).value.filter(_._1.getName.endsWith(" .tasty" ))
978
-
979
- allScalaLibraryJarMappings ++ tastyFileMappings
980
- }
981
-
982
- )
983
-
984
925
/** Scala library compiled by dotty using the latest published sources of the library
985
- * and the current Scala 3 livrary sources
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.
986
930
*/
987
- lazy val `stdlib-full- bootstrapped` = project.in(file(" stdlib-full -bootstrapped" )).
931
+ lazy val `stdlib-bootstrapped` = project.in(file(" stdlib-bootstrapped" )).
988
932
withCommonSettings(Bootstrapped ).
989
933
dependsOn(dottyCompiler(Bootstrapped ) % " provided; compile->runtime; test->test" ).
990
934
settings(stdliBootstrappedCommonSettings).
@@ -1031,6 +975,81 @@ object Build {
1031
975
}.taskValue,
1032
976
)
1033
977
978
+ /** Scala 2 library compiled by dotty using the latest published sources of the library.
979
+ *
980
+ * This version of the library is compiled by Scala 3 while being binary compatible with Scala 2.
981
+ */
982
+ lazy val `stdlib-bootstrapped-compat` = project.in(file(" stdlib-bootstrapped-compat" )).
983
+ withCommonSettings(Bootstrapped ).
984
+ dependsOn(dottyCompiler(Bootstrapped ) % " provided; compile->runtime; test->test" ).
985
+ settings(stdliBootstrappedCommonSettings).
986
+ settings(
987
+ Compile / scalacOptions ++= {
988
+ Seq (
989
+ " -sourcepath" ,
990
+ Seq (
991
+ baseDirectory.value / " stdlib-bootstrapped" / " src" ,
992
+ (Compile / sourceManaged).value / " scala-library-src" ,
993
+ ).mkString(File .pathSeparator),
994
+ )
995
+ },
996
+ mimaCheckDirection := " both" ,
997
+ mimaBinaryIssueFilters ++= MiMaFilters .LibraryBootstrappedForward ,
998
+ )
999
+
1000
+ /** Re-packages stdlib compiled be Scala 2 adding TASTy generated by `stdlib-bootstrapped-compat` */
1001
+ lazy val `stdlib-with-tasty` = project.in(file(" stdlib-with-tasty" )).
1002
+ withCommonSettings(Bootstrapped ).
1003
+ dependsOn(`stdlib-bootstrapped-compat`).
1004
+ settings(commonBootstrappedSettings).
1005
+ settings(
1006
+ moduleName := " scala-library" ,
1007
+ exportJars := true ,
1008
+ Compile / packageBin / artifactName := { (sv : ScalaVersion , module : ModuleID , artifact : Artifact ) =>
1009
+ artifact.name + " -" + stdlibVersion(Bootstrapped ) + " -" + module.revision + " ." + artifact.extension
1010
+ },
1011
+ (Compile / packageBin / mappings) := {
1012
+ val allScalaLibraryJarMappings : Seq [(java.io.File , String )] = {
1013
+ val s = streams.value
1014
+ val report = updateClassifiers.value
1015
+ val scalaLibraryJar =
1016
+ // FIXME
1017
+ report.select(
1018
+ configuration = configurationFilter(" compile" ),
1019
+ module = (_ : ModuleID ).name == " scala-library" ,
1020
+ artifact = artifactFilter(`type` = " src" ))
1021
+ .headOption.getOrElse {
1022
+ sys.error(s " Could not fetch scala-library sources " )
1023
+ }.getParentFile / " scala-library-2.13.10.jar"
1024
+ val cacheDir = s.cacheDirectory
1025
+ val trgDir = (Compile / sourceManaged).value / " scala-library-bin" // FIXME not really managed sources
1026
+ FileFunction .cached(cacheDir / " fetchScalaLibraryBin" ,
1027
+ FilesInfo .lastModified, FilesInfo .exists) { dependencies =>
1028
+ s.log.info(s " Unpacking scala-library classfiles to $trgDir... " )
1029
+ if (trgDir.exists)
1030
+ IO .delete(trgDir)
1031
+ IO .createDirectory(trgDir)
1032
+ IO .unzip(scalaLibraryJar, trgDir)
1033
+ (trgDir ** " *" ).get.toSet
1034
+ } (Set (scalaLibraryJar)).toSeq
1035
+ val allScalaLibraryJarFiles =
1036
+ trgDir.allPaths.get().filterNot(_.getName.endsWith(" .MF" )) // TODO use parts of the old manifest?
1037
+ allScalaLibraryJarFiles.zip(allScalaLibraryJarFiles.map(_.relativeTo(trgDir).get.getPath))
1038
+ }
1039
+ val tastyFileMappings =
1040
+ (`stdlib-bootstrapped-compat` / Compile / packageBin / mappings).value
1041
+ .filter(_._1.getName.endsWith(" .tasty" ))
1042
+ allScalaLibraryJarMappings ++ tastyFileMappings
1043
+ },
1044
+ mimaCurrentClassfiles :=
1045
+ mimaCurrentClassfiles.value.getParentFile() /
1046
+ (moduleName.value + " -" + stdlibVersion(Bootstrapped ) + " -" + scalaVersion.value.replace(" -nonbootstrapped" , " " ) + " .jar" ),
1047
+ mimaPreviousArtifacts +=
1048
+ (" org.scala-lang" % " scala-library" % stdlibVersion(Bootstrapped )),
1049
+ mimaCheckDirection := " both" ,
1050
+ mimaBinaryIssueFilters := Seq (),
1051
+ )
1052
+
1034
1053
lazy val stdliBootstrappedCommonSettings =
1035
1054
commonBootstrappedSettings ++
1036
1055
Seq (
@@ -1094,7 +1113,7 @@ object Build {
1094
1113
" scala.annotation.unspecialized" ,
1095
1114
),
1096
1115
mimaCheckDirection := " backward" ,
1097
- mimaBinaryIssueFilters ++= MiMaFilters .LibraryBootstrapped ,
1116
+ mimaBinaryIssueFilters ++= MiMaFilters .LibraryBootstrappedBackwards ,
1098
1117
run := {
1099
1118
val args : Seq [String ] = spaceDelimited(" <arg>" ).parsed
1100
1119
val reference = (Compile / sourceManaged).value / " scala-library-src"
@@ -1154,7 +1173,7 @@ object Build {
1154
1173
settings(commonBootstrappedSettings).
1155
1174
settings(
1156
1175
javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
1157
- javaOptions += " -Ddotty.scala.library=" + (`stdlib-full- bootstrapped` / Compile / packageBin).value.getAbsolutePath
1176
+ javaOptions += " -Ddotty.scala.library=" + (`stdlib-bootstrapped` / Compile / packageBin).value.getAbsolutePath
1158
1177
)
1159
1178
1160
1179
lazy val `scala3-sbt-bridge` = project.in(file(" sbt-bridge/src" )).
0 commit comments