@@ -936,7 +936,7 @@ object Build {
936936 dependsOn(dottyCompiler(Bootstrapped ) % " provided; compile->runtime; test->test" ).
937937 settings(commonBootstrappedSettings).
938938 settings(
939- moduleName := " scala -library" ,
939+ moduleName := " scala2 -library" ,
940940 javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
941941 Compile / scalacOptions ++= {
942942 Seq (" -sourcepath" , ((Compile / sourceManaged).value / " scala-library-src" ).toString)
@@ -1025,10 +1025,10 @@ object Build {
10251025 | """ .stripMargin)
10261026
10271027 }).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+ },
10321032 run := {
10331033 val log = streams.value.log
10341034 val args : Seq [String ] = spaceDelimited(" <arg>" ).parsed
@@ -1077,7 +1077,21 @@ object Build {
10771077 }
10781078 )
10791079
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+
10801091 /** 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.
10811095 *
10821096 * The tests are run with the bootstrapped compiler and the tasty inpector on the classpath.
10831097 * The classpath has the default `scala-library` and not `stdlib-bootstrapped`.
@@ -1088,11 +1102,23 @@ object Build {
10881102 */
10891103 lazy val `stdlib-bootstrapped-tasty-tests` = project.in(file(" stdlib-bootstrapped-tasty-tests" )).
10901104 withCommonSettings(Bootstrapped ).
1105+ dependsOn(dottyCompiler(Bootstrapped ) % " compile->compile" ).
10911106 dependsOn(`scala3-tasty-inspector` % " test->test" ).
1107+ dependsOn(`stdlib-bootstrapped-tasty`).
10921108 settings(commonBootstrappedSettings).
10931109 settings(
10941110 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+ },
10961122 )
10971123
10981124 lazy val `scala3-sbt-bridge` = project.in(file(" sbt-bridge/src" )).
0 commit comments