@@ -922,91 +922,22 @@ 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 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
- */
931
- lazy val `stdlib-bootstrapped` = project.in(file(" stdlib-bootstrapped" )).
932
- withCommonSettings(Bootstrapped ).
933
- dependsOn(dottyCompiler(Bootstrapped ) % " provided; compile->runtime; test->test" ).
934
- settings(commonStdlibBootstrappedSettings).
935
- settings(
936
- Compile / scalacOptions ++= {
937
- Seq (
938
- " -sourcepath" ,
939
- Seq (
940
- (Compile / sourceManaged).value / " scala-library-src" ,
941
- (Compile / sourceManaged).value / " dotty-library-src" ,
942
- ).mkString(File .pathSeparator),
943
- )
944
- },
945
- (Compile / sourceGenerators) += Def .task {
946
- val s = streams.value
947
- val cacheDir = s.cacheDirectory
948
- val trgDir = (Compile / sourceManaged).value / " dotty-library-src"
949
-
950
- // NOTE `sourceDirectory` is used for actual copying,
951
- // but `sources` are used as cache keys
952
- val dottyLibSourceDirs = (`scala3-library-bootstrapped`/ Compile / unmanagedSourceDirectories).value
953
- def dottyLibSources = dottyLibSourceDirs.foldLeft(PathFinder .empty) { (pf, dir) =>
954
- if (! dir.exists) pf else pf +++ (dir ** " *.scala" ) +++ (dir ** " *.java" )
955
- }
956
-
957
- val cachedFun = FileFunction .cached(
958
- cacheDir / s " copyDottyLibrarySrc " ,
959
- FilesInfo .lastModified,
960
- FilesInfo .exists,
961
- ) { _ =>
962
- if (trgDir.exists) IO .delete(trgDir)
963
- dottyLibSourceDirs.foreach { dir =>
964
- if (dir.exists) {
965
- s.log.info(s " Copying scala3-library sources from $dir to $trgDir... " )
966
- IO .copyDirectory(dir, trgDir)
967
- }
968
- }
969
-
970
- ((trgDir ** " *.scala" ) +++ (trgDir ** " *.java" )).get.toSet
971
- }
972
-
973
- cachedFun(dottyLibSources.get.toSet).toSeq
974
- }.taskValue,
975
- )
976
-
977
925
/** Scala 2 library compiled by dotty using the latest published sources of the library.
978
926
*
979
- * This version of the library is not (yet) binary compatible with the Scala 2 compiled library.
927
+ * This version of the library is not (yet) TASTy/ binary compatible with the Scala 2 compiled library.
980
928
*/
981
- lazy val `stdlib-2_13- bootstrapped` = project.in(file(" stdlib-2_13 -bootstrapped" )).
929
+ lazy val `stdlib-bootstrapped` = project.in(file(" stdlib-bootstrapped" )).
982
930
withCommonSettings(Bootstrapped ).
983
931
dependsOn(dottyCompiler(Bootstrapped ) % " provided; compile->runtime; test->test" ).
984
- settings(commonStdlibBootstrappedSettings ).
932
+ settings(commonBootstrappedSettings ).
985
933
settings(
986
- scalacOptions += " -Yscala2-stdlib" ,
934
+ moduleName := " scala-library" ,
935
+ javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
987
936
Compile / scalacOptions ++= {
988
937
Seq (" -sourcepath" , ((Compile / sourceManaged).value / " scala-library-src" ).toString)
989
938
},
990
- // TODO package only TASTy files.
991
- // We first need to check that a project can depend on a JAR that only contains TASTy files.
992
- // Compile / exportJars := true,
993
- // Compile / packageBin / mappings ~= { _.filter(_._2.endsWith(".tasty")) },
994
- mimaCheckDirection := " both" ,
995
- mimaBackwardIssueFilters := MiMaFilters .StdlibBootstrappedBackwards ,
996
- mimaForwardIssueFilters := MiMaFilters .StdlibBootstrappedForward ,
997
- mimaPreviousArtifacts += " org.scala-lang" % " scala-library" % stdlibVersion(Bootstrapped ),
998
- mimaExcludeAnnotations ++= Seq (
999
- " scala.annotation.experimental" ,
1000
- " scala.annotation.specialized" ,
1001
- " scala.annotation.unspecialized" ,
1002
- ),
1003
- )
1004
-
1005
- lazy val commonStdlibBootstrappedSettings =
1006
- commonBootstrappedSettings ++ Seq (
1007
- moduleName := " scala-library" ,
1008
- javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
1009
939
Compile / doc / scalacOptions += " -Ydocument-synthetic-types" ,
940
+ scalacOptions += " -Yscala2-stdlib" ,
1010
941
scalacOptions -= " -Xfatal-warnings" ,
1011
942
ivyConfigurations += SourceDeps .hide,
1012
943
transitiveClassifiers := Seq (" sources" ),
@@ -1044,17 +975,30 @@ object Build {
1044
975
file.getPath.endsWith(" scala-library-src/scala/Nothing.scala" ) ||
1045
976
file.getPath.endsWith(" scala-library-src/scala/Null.scala" ) ||
1046
977
file.getPath.endsWith(" scala-library-src/scala/Singleton.scala" ))),
978
+ (Test / managedClasspath) ~= {
979
+ _.filterNot(file => file.data.getName == s " scala-library- ${stdlibVersion(Bootstrapped )}.jar " )
980
+ },
1047
981
(Compile / sources) := {
1048
982
val files = (Compile / sources).value
1049
983
val overwritenSourcesDir = (Compile / scalaSource).value
1050
984
val overwritenSources = files.flatMap(_.relativeTo(overwritenSourcesDir)).toSet
1051
985
val reference = (Compile / sourceManaged).value / " scala-library-src"
1052
986
files.filterNot(_.relativeTo(reference).exists(overwritenSources))
1053
987
},
1054
- (Test / managedClasspath) ~= {
1055
- _.filterNot(file => file.data.getName == s " scala-library- ${stdlibVersion(Bootstrapped )}.jar " )
1056
- },
1057
- )
988
+ // TODO package only TASTy files.
989
+ // We first need to check that a project can depend on a JAR that only contains TASTy files.
990
+ // Compile / exportJars := true,
991
+ // Compile / packageBin / mappings ~= { _.filter(_._2.endsWith(".tasty")) },
992
+ mimaCheckDirection := " both" ,
993
+ mimaBackwardIssueFilters := MiMaFilters .StdlibBootstrappedBackwards ,
994
+ mimaForwardIssueFilters := MiMaFilters .StdlibBootstrappedForward ,
995
+ mimaPreviousArtifacts += " org.scala-lang" % " scala-library" % stdlibVersion(Bootstrapped ),
996
+ mimaExcludeAnnotations ++= Seq (
997
+ " scala.annotation.experimental" ,
998
+ " scala.annotation.specialized" ,
999
+ " scala.annotation.unspecialized" ,
1000
+ ),
1001
+ )
1058
1002
1059
1003
/** Test the tasty generated by `stdlib-bootstrapped`
1060
1004
*
0 commit comments