@@ -173,6 +173,12 @@ object Build {
173173 // Run tests with filter through vulpix test suite
174174 val testCompilation = inputKey[Unit ](" runs integration test with the supplied filter" )
175175
176+ // Use the TASTy jar from `scala2-library-tasty` in the classpath
177+ // This only works with `scala3-bootstrapped/scalac` and tests in `scala3-bootstrapped`
178+ //
179+ // Enable in SBT with: set ThisBuild/Build.useScala2LibraryTasty := true
180+ val useScala2LibraryTasty = settingKey[Boolean ](" Use the TASTy jar from `scala2-library-tasty` in the classpath" )
181+
176182 // Used to compile files similar to ./bin/scalac script
177183 val scalac = inputKey[Unit ](" run the compiler using the correct classpath, or the user supplied classpath" )
178184
@@ -219,6 +225,8 @@ object Build {
219225
220226 outputStrategy := Some (StdoutOutput ),
221227
228+ useScala2LibraryTasty := false ,
229+
222230 // enable verbose exception messages for JUnit
223231 (Test / testOptions) += Tests .Argument (TestFrameworks .JUnit , " -a" , " -v" , " -s" ),
224232 )
@@ -633,7 +641,11 @@ object Build {
633641 val externalDeps = externalCompilerClasspathTask.value
634642 val jars = packageAll.value
635643
636- Seq (
644+ val scala2LibraryTasty =
645+ if (useScala2LibraryTasty.value) Seq (" -Ddotty.tests.tasties.scalaLibrary=" + jars(" scala2-library-tasty" ))
646+ else Seq .empty
647+
648+ scala2LibraryTasty ++ Seq (
637649 " -Ddotty.tests.dottyCompilerManagedSources=" + managedSrcDir,
638650 " -Ddotty.tests.classes.dottyInterfaces=" + jars(" scala3-interfaces" ),
639651 " -Ddotty.tests.classes.dottyLibrary=" + jars(" scala3-library" ),
@@ -729,11 +741,9 @@ object Build {
729741 val args0 : List [String ] = spaceDelimited(" <arg>" ).parsed.toList
730742 val decompile = args0.contains(" -decompile" )
731743 val printTasty = args0.contains(" -print-tasty" )
732- val useScala2LibraryTasty = args0.contains(" -Yscala2-library-tasty" )
733744 val debugFromTasty = args0.contains(" -Ythrough-tasty" )
734745 val args = args0.filter(arg => arg != " -repl" && arg != " -decompile" &&
735- arg != " -with-compiler" && arg != " -Ythrough-tasty" && arg != " -print-tasty"
736- && arg != " -Yscala2-library-tasty" )
746+ arg != " -with-compiler" && arg != " -Ythrough-tasty" && arg != " -print-tasty" )
737747 val main =
738748 if (decompile) " dotty.tools.dotc.decompiler.Main"
739749 else if (printTasty) " dotty.tools.dotc.core.tasty.TastyPrinter"
@@ -742,10 +752,10 @@ object Build {
742752
743753 var extraClasspath =
744754 scalaLibTastyOpt match {
745- case Some (scalaLibTasty) if useScala2LibraryTasty =>
755+ case Some (scalaLibTasty) if useScala2LibraryTasty.value =>
746756 Seq (scalaLibTasty, scalaLib, dottyLib)
747757 case _ =>
748- if (useScala2LibraryTasty) log.error( " -Yscala2-library-tasty can only be used with a bootstrapped compiler" )
758+ if (useScala2LibraryTasty.value ) log.warn( " useScala2LibraryTasty is ignored on non- bootstrapped compiler" )
749759 Seq (scalaLib, dottyLib)
750760 }
751761
0 commit comments