@@ -936,7 +936,7 @@ object Build {
936
936
dependsOn(dottyCompiler(Bootstrapped ) % " provided; compile->runtime; test->test" ).
937
937
settings(commonBootstrappedSettings).
938
938
settings(
939
- moduleName := " scala -library" ,
939
+ moduleName := " scala2 -library" ,
940
940
javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
941
941
Compile / scalacOptions ++= {
942
942
Seq (" -sourcepath" , ((Compile / sourceManaged).value / " scala-library-src" ).toString)
@@ -1025,10 +1025,10 @@ object Build {
1025
1025
| """ .stripMargin)
1026
1026
1027
1027
}).value,
1028
- // TODO package only TASTy files.
1029
- // We first need to check that a project can depend on a JAR that only contains TASTy files.
1030
- // Compile / exportJars := true,
1031
- // Compile / packageBin / mappings ~= { _.filter(_._2.endsWith(".tasty")) },
1028
+ Compile / exportJars := true ,
1029
+ artifactName := { ( sv : ScalaVersion , module : ModuleID , artifact : Artifact ) =>
1030
+ " scala2-library- " + dottyVersion + " . " + artifact.extension
1031
+ },
1032
1032
run := {
1033
1033
val log = streams.value.log
1034
1034
val args : Seq [String ] = spaceDelimited(" <arg>" ).parsed
@@ -1077,7 +1077,21 @@ object Build {
1077
1077
}
1078
1078
)
1079
1079
1080
+ /** Packages the TASTy files of `stdlib-bootstrapped` in a jar */
1081
+ lazy val `stdlib-bootstrapped-tasty` = project.in(file(" stdlib-bootstrapped-tasty" )).
1082
+ withCommonSettings(Bootstrapped ).
1083
+ settings(
1084
+ exportJars := true ,
1085
+ Compile / packageBin / mappings := {
1086
+ (`stdlib-bootstrapped` / Compile / packageBin / mappings).value
1087
+ .filter(_._2.endsWith(" .tasty" ))
1088
+ },
1089
+ )
1090
+
1080
1091
/** Test the tasty generated by `stdlib-bootstrapped`
1092
+ *
1093
+ * The sources in src are compiled using TASTy from stdlib-bootstrapped-tasty but then run
1094
+ * with the scala-library compiled be Scala 2.
1081
1095
*
1082
1096
* The tests are run with the bootstrapped compiler and the tasty inpector on the classpath.
1083
1097
* The classpath has the default `scala-library` and not `stdlib-bootstrapped`.
@@ -1088,11 +1102,23 @@ object Build {
1088
1102
*/
1089
1103
lazy val `stdlib-bootstrapped-tasty-tests` = project.in(file(" stdlib-bootstrapped-tasty-tests" )).
1090
1104
withCommonSettings(Bootstrapped ).
1105
+ dependsOn(dottyCompiler(Bootstrapped ) % " compile->compile" ).
1091
1106
dependsOn(`scala3-tasty-inspector` % " test->test" ).
1107
+ dependsOn(`stdlib-bootstrapped-tasty`).
1092
1108
settings(commonBootstrappedSettings).
1093
1109
settings(
1094
1110
javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
1095
- javaOptions += " -Ddotty.scala.library=" + (`stdlib-bootstrapped` / Compile / packageBin).value.getAbsolutePath
1111
+ Test / javaOptions += " -Ddotty.scala.library=" + (`stdlib-bootstrapped` / Compile / packageBin).value.getAbsolutePath,
1112
+ Compile / compile / fullClasspath ~= {
1113
+ _.filterNot(file => file.data.getName == s " scala-library- ${stdlibVersion(Bootstrapped )}.jar " )
1114
+ },
1115
+ Compile / compile / dependencyClasspath := {
1116
+ // make sure that the scala2-library (tasty of `stdlib-bootstrapped-tasty`) is listed before the scala-library (classfiles)
1117
+ val (bootstrappedLib, otherLibs) =
1118
+ (Compile / compile / dependencyClasspath).value
1119
+ .partition(_.data.getName == s " scala2-library- ${dottyVersion}.jar " )
1120
+ bootstrappedLib ++ otherLibs
1121
+ },
1096
1122
)
1097
1123
1098
1124
lazy val `scala3-sbt-bridge` = project.in(file(" sbt-bridge/src" )).
0 commit comments