@@ -173,6 +173,12 @@ object Build {
173
173
// Run tests with filter through vulpix test suite
174
174
val testCompilation = inputKey[Unit ](" runs integration test with the supplied filter" )
175
175
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
+
176
182
// Used to compile files similar to ./bin/scalac script
177
183
val scalac = inputKey[Unit ](" run the compiler using the correct classpath, or the user supplied classpath" )
178
184
@@ -219,6 +225,8 @@ object Build {
219
225
220
226
outputStrategy := Some (StdoutOutput ),
221
227
228
+ useScala2LibraryTasty := false ,
229
+
222
230
// enable verbose exception messages for JUnit
223
231
(Test / testOptions) += Tests .Argument (TestFrameworks .JUnit , " -a" , " -v" , " -s" ),
224
232
)
@@ -633,7 +641,11 @@ object Build {
633
641
val externalDeps = externalCompilerClasspathTask.value
634
642
val jars = packageAll.value
635
643
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 (
637
649
" -Ddotty.tests.dottyCompilerManagedSources=" + managedSrcDir,
638
650
" -Ddotty.tests.classes.dottyInterfaces=" + jars(" scala3-interfaces" ),
639
651
" -Ddotty.tests.classes.dottyLibrary=" + jars(" scala3-library" ),
@@ -729,11 +741,9 @@ object Build {
729
741
val args0 : List [String ] = spaceDelimited(" <arg>" ).parsed.toList
730
742
val decompile = args0.contains(" -decompile" )
731
743
val printTasty = args0.contains(" -print-tasty" )
732
- val useScala2LibraryTasty = args0.contains(" -Yscala2-library-tasty" )
733
744
val debugFromTasty = args0.contains(" -Ythrough-tasty" )
734
745
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" )
737
747
val main =
738
748
if (decompile) " dotty.tools.dotc.decompiler.Main"
739
749
else if (printTasty) " dotty.tools.dotc.core.tasty.TastyPrinter"
@@ -742,10 +752,10 @@ object Build {
742
752
743
753
var extraClasspath =
744
754
scalaLibTastyOpt match {
745
- case Some (scalaLibTasty) if useScala2LibraryTasty =>
755
+ case Some (scalaLibTasty) if useScala2LibraryTasty.value =>
746
756
Seq (scalaLibTasty, scalaLib, dottyLib)
747
757
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" )
749
759
Seq (scalaLib, dottyLib)
750
760
}
751
761
0 commit comments