@@ -931,7 +931,7 @@ object Build {
931
931
dependsOn(dottyCompiler(Bootstrapped ) % " provided; compile->runtime; test->test" ).
932
932
settings(commonBootstrappedSettings).
933
933
settings(
934
- moduleName := " scala -library" ,
934
+ moduleName := " scala2 -library" ,
935
935
javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
936
936
Compile / scalacOptions ++= {
937
937
Seq (" -sourcepath" , ((Compile / sourceManaged).value / " scala-library-src" ).toString)
@@ -994,13 +994,27 @@ object Build {
994
994
" scala.annotation.specialized" ,
995
995
" scala.annotation.unspecialized" ,
996
996
),
997
- // TODO package only TASTy files.
998
- // We first need to check that a project can depend on a JAR that only contains TASTy files.
999
- // Compile / exportJars := true,
1000
- // Compile / packageBin / mappings ~= { _.filter(_._2.endsWith(".tasty")) },
997
+ Compile / exportJars := true ,
998
+ artifactName := { (sv : ScalaVersion , module : ModuleID , artifact : Artifact ) =>
999
+ " scala2-library-" + dottyVersion + " ." + artifact.extension
1000
+ }
1001
+ )
1002
+
1003
+ /** Packages the TASTy files of `stdlib-bootstrapped` in a jar */
1004
+ lazy val `stdlib-bootstrapped-tasty` = project.in(file(" stdlib-bootstrapped-tasty" )).
1005
+ withCommonSettings(Bootstrapped ).
1006
+ settings(
1007
+ exportJars := true ,
1008
+ Compile / packageBin / mappings := {
1009
+ (`stdlib-bootstrapped` / Compile / packageBin / mappings).value
1010
+ .filter(_._2.endsWith(" .tasty" ))
1011
+ },
1001
1012
)
1002
1013
1003
1014
/** Test the tasty generated by `stdlib-bootstrapped`
1015
+ *
1016
+ * The sources in src are compiled using TASTy from stdlib-bootstrapped-tasty but then run
1017
+ * with the scala-library compiled be Scala 2.
1004
1018
*
1005
1019
* The tests are run with the bootstrapped compiler and the tasty inpector on the classpath.
1006
1020
* The classpath has the default `scala-library` and not `stdlib-bootstrapped`.
@@ -1011,11 +1025,23 @@ object Build {
1011
1025
*/
1012
1026
lazy val `stdlib-bootstrapped-tasty-tests` = project.in(file(" stdlib-bootstrapped-tasty-tests" )).
1013
1027
withCommonSettings(Bootstrapped ).
1028
+ dependsOn(dottyCompiler(Bootstrapped ) % " compile->compile" ).
1014
1029
dependsOn(`scala3-tasty-inspector` % " test->test" ).
1030
+ dependsOn(`stdlib-bootstrapped-tasty`).
1015
1031
settings(commonBootstrappedSettings).
1016
1032
settings(
1017
1033
javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
1018
- javaOptions += " -Ddotty.scala.library=" + (`stdlib-bootstrapped` / Compile / packageBin).value.getAbsolutePath
1034
+ Test / javaOptions += " -Ddotty.scala.library=" + (`stdlib-bootstrapped` / Compile / packageBin).value.getAbsolutePath,
1035
+ Compile / compile / fullClasspath ~= {
1036
+ _.filterNot(file => file.data.getName == s " scala-library- ${stdlibVersion(Bootstrapped )}.jar " )
1037
+ },
1038
+ Compile / compile / dependencyClasspath := {
1039
+ // make sure that the scala2-library (tasty of `stdlib-bootstrapped-tasty`) is listed before the scala-library (classfiles)
1040
+ val (bootstrappedLib, otherLibs) =
1041
+ (Compile / compile / dependencyClasspath).value
1042
+ .partition(_.data.getName == s " scala2-library- ${dottyVersion}.jar " )
1043
+ bootstrappedLib ++ otherLibs
1044
+ },
1019
1045
)
1020
1046
1021
1047
lazy val `scala3-sbt-bridge` = project.in(file(" sbt-bridge/src" )).
0 commit comments