@@ -926,51 +926,78 @@ object Build {
926
926
lazy val `stdlib-bootstrapped` = project.in(file(" stdlib-bootstrapped" )).
927
927
withCommonSettings(Bootstrapped ).
928
928
dependsOn(dottyCompiler(Bootstrapped ) % " provided; compile->runtime; test->test" ).
929
- dependsOn(`scala3-tasty-inspector` % " test->test" ).
930
- settings(commonBootstrappedSettings).
929
+ settings(stdliBootstrappedCommonSettings).
931
930
settings(
932
- moduleName := " scala-library" ,
933
- javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
934
931
Compile / scalacOptions ++= {
935
932
Seq (
936
933
" -sourcepath" ,
937
934
Seq (
938
935
baseDirectory.value / " stdlib-bootstrapped" / " src" ,
939
936
(Compile / sourceManaged).value / " scala-library-src" ,
940
- (Compile / sourceManaged).value / " dotty-library-src" ,
941
937
).mkString(File .pathSeparator),
942
938
)
943
939
},
944
- Compile / doc / scalacOptions += " -Ydocument-synthetic-types" ,
945
- scalacOptions -= " -Xfatal-warnings" ,
946
- ivyConfigurations += SourceDeps .hide,
947
- transitiveClassifiers := Seq (" sources" ),
948
- libraryDependencies +=
949
- (" org.scala-lang" % " scala-library" % stdlibVersion(Bootstrapped ) % " sourcedeps" ),
950
- (Compile / sourceGenerators) += Def .task {
951
- val s = streams.value
952
- val cacheDir = s.cacheDirectory
953
- val trgDir = (Compile / sourceManaged).value / " scala-library-src"
954
-
955
- val report = updateClassifiers.value
956
- val scalaLibrarySourcesJar = report.select(
957
- configuration = configurationFilter(" sourcedeps" ),
958
- module = (_ : ModuleID ).name == " scala-library" ,
959
- artifact = artifactFilter(`type` = " src" )).headOption.getOrElse {
960
- sys.error(s " Could not fetch scala-library sources " )
940
+ run := {
941
+ val args : Seq [String ] = spaceDelimited(" <arg>" ).parsed
942
+ val reference = (Compile / sourceManaged).value / " scala-library-src"
943
+ args match {
944
+ case Seq (" list" ) =>
945
+ println(s " List of non-overriden files in $reference" )
946
+ reference.allPaths.get()
947
+ .flatMap(_.relativeTo(reference))
948
+ .filter(_.ext == " scala" )
949
+ .sorted
950
+ .foreach(println)
951
+ case Seq (cmd @ (" clone" | " overwrite" ), files* ) =>
952
+ println(" Cloning scala-library sources: " + files.mkString(" , " ))
953
+ for (file <- files) {
954
+ val referenceStdlibPaths = reference / file
955
+ val destination = baseDirectory.value / " src" / file
956
+ if (! referenceStdlibPaths.exists) {
957
+ println(" Not found " + referenceStdlibPaths)
958
+ } else if (destination.exists && cmd == " clone" ) {
959
+ println(s " Already exists $file. (use `overwrite` command to overwrite) " )
960
+ } else {
961
+ val action = if (cmd == " clone" ) " Cloning" else " Overwriting"
962
+ println(s " $action $file" )
963
+ IO .copyFile(referenceStdlibPaths, destination)
964
+ }
965
+ }
966
+ case _ =>
967
+ println(
968
+ """ Usage:
969
+ |> stdlib-bootstrapped/run list
970
+ | -- lists all files that are not overriden in stdlib-bootstrapped/src
971
+ |
972
+ |> stdlib-bootstrapped/run clone <sources>*
973
+ | -- clones the specified sources from the stdlib-bootstrapped/src
974
+ | -- example: stdlib-bootstrapped/run clone scala/Option.scala
975
+ |
976
+ |> stdlib-bootstrapped/run overwrite <sources>*
977
+ | -- (danger) overwrites the specified sources from the stdlib-bootstrapped/src
978
+ |""" .stripMargin)
961
979
}
980
+ }
981
+ )
962
982
963
- FileFunction .cached(cacheDir / s " fetchScalaLibrarySrc " ,
964
- FilesInfo .lastModified, FilesInfo .exists) { dependencies =>
965
- s.log.info(s " Unpacking scala-library sources to $trgDir... " )
966
- if (trgDir.exists)
967
- IO .delete(trgDir)
968
- IO .createDirectory(trgDir)
969
- IO .unzip(scalaLibrarySourcesJar, trgDir)
970
-
971
- ((trgDir ** " *.scala" ) +++ (trgDir ** " *.java" )).get.toSet
972
- } (Set (scalaLibrarySourcesJar)).toSeq
973
- }.taskValue,
983
+ /** Scala library compiled by dotty using the latest published sources of the library
984
+ * and the current Scala 3 livrary sources
985
+ */
986
+ lazy val `stdlib-full-bootstrapped` = project.in(file(" stdlib-full-bootstrapped" )).
987
+ withCommonSettings(Bootstrapped ).
988
+ dependsOn(dottyCompiler(Bootstrapped ) % " provided; compile->runtime; test->test" ).
989
+ settings(stdliBootstrappedCommonSettings).
990
+ settings(
991
+ Compile / scalacOptions ++= {
992
+ Seq (
993
+ " -sourcepath" ,
994
+ Seq (
995
+ baseDirectory.value / " stdlib-bootstrapped" / " src" ,
996
+ (Compile / sourceManaged).value / " scala-library-src" ,
997
+ (Compile / sourceManaged).value / " dotty-library-src" ,
998
+ ).mkString(File .pathSeparator),
999
+ )
1000
+ },
974
1001
(Compile / sourceGenerators) += Def .task {
975
1002
val s = streams.value
976
1003
val cacheDir = s.cacheDirectory
@@ -1001,6 +1028,43 @@ object Build {
1001
1028
1002
1029
cachedFun(dottyLibSources.get.toSet).toSeq
1003
1030
}.taskValue,
1031
+ )
1032
+
1033
+ lazy val stdliBootstrappedCommonSettings =
1034
+ commonBootstrappedSettings ++
1035
+ Seq (
1036
+ moduleName := " scala-library" ,
1037
+ javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
1038
+ Compile / doc / scalacOptions += " -Ydocument-synthetic-types" ,
1039
+ scalacOptions -= " -Xfatal-warnings" ,
1040
+ ivyConfigurations += SourceDeps .hide,
1041
+ transitiveClassifiers := Seq (" sources" ),
1042
+ libraryDependencies +=
1043
+ (" org.scala-lang" % " scala-library" % stdlibVersion(Bootstrapped ) % " sourcedeps" ),
1044
+ (Compile / sourceGenerators) += Def .task {
1045
+ val s = streams.value
1046
+ val cacheDir = s.cacheDirectory
1047
+ val trgDir = (Compile / sourceManaged).value / " scala-library-src"
1048
+
1049
+ val report = updateClassifiers.value
1050
+ val scalaLibrarySourcesJar = report.select(
1051
+ configuration = configurationFilter(" sourcedeps" ),
1052
+ module = (_ : ModuleID ).name == " scala-library" ,
1053
+ artifact = artifactFilter(`type` = " src" )).headOption.getOrElse {
1054
+ sys.error(s " Could not fetch scala-library sources " )
1055
+ }
1056
+
1057
+ FileFunction .cached(cacheDir / s " fetchScalaLibrarySrc " ,
1058
+ FilesInfo .lastModified, FilesInfo .exists) { dependencies =>
1059
+ s.log.info(s " Unpacking scala-library sources to $trgDir... " )
1060
+ if (trgDir.exists)
1061
+ IO .delete(trgDir)
1062
+ IO .createDirectory(trgDir)
1063
+ IO .unzip(scalaLibrarySourcesJar, trgDir)
1064
+
1065
+ ((trgDir ** " *.scala" ) +++ (trgDir ** " *.java" )).get.toSet
1066
+ } (Set (scalaLibrarySourcesJar)).toSeq
1067
+ }.taskValue,
1004
1068
(Compile / sources) ~= (_.filterNot(file =>
1005
1069
// sources from https://github.com/scala/scala/tree/2.13.x/src/library-aux
1006
1070
file.getPath.endsWith(" scala-library-src/scala/Any.scala" ) ||
@@ -1021,56 +1085,15 @@ object Build {
1021
1085
(Test / managedClasspath) ~= {
1022
1086
_.filterNot(file => file.data.getName == s " scala-library- ${stdlibVersion(Bootstrapped )}.jar " )
1023
1087
},
1088
+ mimaCheckDirection := " backward" ,
1024
1089
mimaPreviousArtifacts +=
1025
1090
(" org.scala-lang" % " scala-library" % stdlibVersion(Bootstrapped )),
1026
- mimaCheckDirection := " backward" ,
1027
1091
mimaExcludeAnnotations ++= Seq (
1028
1092
" scala.annotation.experimental" ,
1029
1093
" scala.annotation.specialized" ,
1030
1094
" scala.annotation.unspecialized" ,
1031
- ),
1095
+ ),
1032
1096
mimaBinaryIssueFilters ++= MiMaFilters .LibraryBootstrapped ,
1033
- run := {
1034
- val args : Seq [String ] = spaceDelimited(" <arg>" ).parsed
1035
- val reference = (Compile / sourceManaged).value / " scala-library-src"
1036
- args match {
1037
- case Seq (" list" ) =>
1038
- println(s " List of non-overriden files in $reference" )
1039
- reference.allPaths.get()
1040
- .flatMap(_.relativeTo(reference))
1041
- .filter(_.ext == " scala" )
1042
- .sorted
1043
- .foreach(println)
1044
- case Seq (cmd @ (" clone" | " overwrite" ), files* ) =>
1045
- println(" Cloning scala-library sources: " + files.mkString(" , " ))
1046
- for (file <- files) {
1047
- val referenceStdlibPaths = reference / file
1048
- val destination = baseDirectory.value / " src" / file
1049
- if (! referenceStdlibPaths.exists) {
1050
- println(" Not found " + referenceStdlibPaths)
1051
- } else if (destination.exists && cmd == " clone" ) {
1052
- println(s " Already exists $file. (use `overwrite` command to overwrite) " )
1053
- } else {
1054
- val action = if (cmd == " clone" ) " Cloning" else " Overwriting"
1055
- println(s " $action $file" )
1056
- IO .copyFile(referenceStdlibPaths, destination)
1057
- }
1058
- }
1059
- case _ =>
1060
- println(
1061
- """ Usage:
1062
- |> stdlib-bootstrapped/run list
1063
- | -- lists all files that are not overriden in stdlib-bootstrapped/src
1064
- |
1065
- |> stdlib-bootstrapped/run clone <sources>*
1066
- | -- clones the specified sources from the stdlib-bootstrapped/src
1067
- | -- example: stdlib-bootstrapped/run clone scala/Option.scala
1068
- |
1069
- |> stdlib-bootstrapped/run overwrite <sources>*
1070
- | -- (danger) overwrites the specified sources from the stdlib-bootstrapped/src
1071
- |""" .stripMargin)
1072
- }
1073
- }
1074
1097
)
1075
1098
1076
1099
/** Test the tasty generated by `stdlib-bootstrapped`
@@ -1088,7 +1111,7 @@ object Build {
1088
1111
settings(commonBootstrappedSettings).
1089
1112
settings(
1090
1113
javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
1091
- javaOptions += " -Ddotty.scala.library=" + (`stdlib-bootstrapped` / Compile / packageBin).value.getAbsolutePath
1114
+ javaOptions += " -Ddotty.scala.library=" + (`stdlib-full- bootstrapped` / Compile / packageBin).value.getAbsolutePath
1092
1115
)
1093
1116
1094
1117
lazy val `scala3-sbt-bridge` = project.in(file(" sbt-bridge/src" )).
0 commit comments