@@ -176,9 +176,15 @@ object Build {
176176 // Use the TASTy jar from `scala2-library-tasty` in the classpath
177177 // This only works with `scala3-bootstrapped/scalac` and tests in `scala3-bootstrapped`
178178 //
179- // Enable in SBT with: set ThisBuild/Build.useScala2LibraryTasty := true
179+ // Enable in SBT with: ` set ThisBuild/Build.useScala2LibraryTasty := true`
180180 val useScala2LibraryTasty = settingKey[Boolean ](" Use the TASTy jar from `scala2-library-tasty` in the classpath" )
181181
182+ // Use the TASTy jar from `scala2-library-cc-tasty` in the classpath
183+ // This only works with `scala3-bootstrapped/scalac` and tests in `scala3-bootstrapped`
184+ //
185+ // Enable in SBT with: `set ThisBuild/Build.useScala2LibraryCCTasty := true`
186+ val useScala2LibraryCCTasty = settingKey[Boolean ](" Use the TASTy jar from `scala2-library-cc-tasty` in the classpath" )
187+
182188 // Used to compile files similar to ./bin/scalac script
183189 val scalac = inputKey[Unit ](" run the compiler using the correct classpath, or the user supplied classpath" )
184190
@@ -226,6 +232,7 @@ object Build {
226232 outputStrategy := Some (StdoutOutput ),
227233
228234 useScala2LibraryTasty := false ,
235+ useScala2LibraryCCTasty := false ,
229236
230237 // enable verbose exception messages for JUnit
231238 (Test / testOptions) += Tests .Argument (TestFrameworks .JUnit , " -a" , " -v" , " -s" ),
@@ -653,7 +660,18 @@ object Build {
653660 Seq .empty
654661 }
655662
656- scala2LibraryTasty ++ Seq (
663+ val scala2LibraryCCTasty = jars.get(" scala2-library-cc-tasty" ) match {
664+ case Some (scala2LibraryCCTastyJar) if useScala2LibraryCCTasty.value =>
665+ if (useScala2LibraryTasty.value) {
666+ log.warn(" Both useScala2LibraryTasty and useScala2LibraryCCTasty are set (ignoring useScala2LibraryCCTasty)" )
667+ Seq .empty
668+ } else Seq (" -Ddotty.tests.tasties.scalaLibrary=" + scala2LibraryCCTastyJar)
669+ case _ =>
670+ if (useScala2LibraryCCTasty.value) log.warn(" useScala2LibraryCCTasty is ignored on non-bootstrapped compiler" )
671+ Seq .empty
672+ }
673+
674+ scala2LibraryTasty ++ scala2LibraryCCTasty ++ Seq (
657675 " -Ddotty.tests.dottyCompilerManagedSources=" + managedSrcDir,
658676 " -Ddotty.tests.classes.dottyInterfaces=" + jars(" scala3-interfaces" ),
659677 " -Ddotty.tests.classes.dottyLibrary=" + jars(" scala3-library" ),
@@ -876,6 +894,7 @@ object Build {
876894 " scala3-tasty-inspector" -> (LocalProject (" scala3-tasty-inspector" ) / Compile / packageBin).value.getAbsolutePath,
877895 " tasty-core" -> (LocalProject (" tasty-core-bootstrapped" ) / Compile / packageBin).value.getAbsolutePath,
878896 " scala2-library-tasty" -> (LocalProject (" scala2-library-tasty" ) / Compile / packageBin).value.getAbsolutePath,
897+ " scala2-library-cc-tasty" -> (LocalProject (" scala2-library-cc-tasty" ) / Compile / packageBin).value.getAbsolutePath,
879898 )
880899 },
881900
@@ -1004,8 +1023,21 @@ object Build {
10041023 withCommonSettings(Bootstrapped ).
10051024 dependsOn(dottyCompiler(Bootstrapped ) % " provided; compile->runtime; test->test" ).
10061025 settings(commonBootstrappedSettings).
1007- settings(
1008- moduleName := " scala2-library" ,
1026+ settings(scala2LibraryBootstrappedSettings).
1027+ settings(moduleName := " scala2-library" )
1028+
1029+ /** Scala 2 library compiled by dotty using the latest published sources of the library.
1030+ *
1031+ * This version of the library is not (yet) TASTy/binary compatible with the Scala 2 compiled library.
1032+ */
1033+ lazy val `scala2-library-cc` = project.in(file(" scala2-library-cc" )).
1034+ withCommonSettings(Bootstrapped ).
1035+ dependsOn(dottyCompiler(Bootstrapped ) % " provided; compile->runtime; test->test" ).
1036+ settings(commonBootstrappedSettings).
1037+ settings(scala2LibraryBootstrappedSettings).
1038+ settings(moduleName := " scala2-library-cc" )
1039+
1040+ lazy val scala2LibraryBootstrappedSettings = Seq (
10091041 javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
10101042 Compile / scalacOptions ++= {
10111043 Seq (" -sourcepath" , ((Compile / sourceManaged).value / " scala-library-src" ).toString)
@@ -1089,13 +1121,13 @@ object Build {
10891121 | - final val MinorVersion = $minorVersion
10901122 | - final val ExperimentalVersion = 0
10911123 | * Clean everything to generate a compiler with those new TASTy versions
1092- | * Run scala2-library-bootstrapped /tastyMiMaReportIssues
1124+ | * Run ${name.value} /tastyMiMaReportIssues
10931125 | """ .stripMargin)
10941126
10951127 }).value,
10961128 Compile / exportJars := true ,
10971129 artifactName := { (sv : ScalaVersion , module : ModuleID , artifact : Artifact ) =>
1098- " scala2-library -" + dottyVersion + " ." + artifact.extension
1130+ moduleName.value + " -" + dottyVersion + " ." + artifact.extension
10991131 },
11001132 run := {
11011133 val log = streams.value.log
@@ -1133,18 +1165,18 @@ object Build {
11331165 println(
11341166 s """ Usage:
11351167 |> $projectName/run list
1136- | -- lists all files that are not overriden in scala2-library-bootstrapped /src
1168+ | -- lists all files that are not overriden in ${name.value} /src
11371169 |
11381170 |> $projectName/run clone <sources>*
1139- | -- clones the specified sources from the scala2-library-bootstrapped /src
1171+ | -- clones the specified sources from the ${name.value} /src
11401172 | -- example: $projectName/run clone scala/Option.scala
11411173 |
11421174 |> $projectName/run overwrite <sources>*
1143- | -- (danger) overwrites the specified sources from the scala2-library-bootstrapped /src
1175+ | -- (danger) overwrites the specified sources from the ${name.value} /src
11441176 | """ .stripMargin)
11451177 }
11461178 }
1147- )
1179+ )
11481180
11491181 /** Packages the TASTy files of `scala2-library-bootstrapped` in a jar */
11501182 lazy val `scala2-library-tasty` = project.in(file(" scala2-library-tasty" )).
@@ -1157,6 +1189,17 @@ object Build {
11571189 },
11581190 )
11591191
1192+ /** Packages the TASTy files of `scala2-library-cc` in a jar */
1193+ lazy val `scala2-library-cc-tasty` = project.in(file(" scala2-library-cc-tasty" )).
1194+ withCommonSettings(Bootstrapped ).
1195+ settings(
1196+ exportJars := true ,
1197+ Compile / packageBin / mappings := {
1198+ (`scala2-library-cc` / Compile / packageBin / mappings).value
1199+ .filter(_._2.endsWith(" .tasty" ))
1200+ },
1201+ )
1202+
11601203 /** Test the tasty generated by `scala2-library-bootstrapped`
11611204 *
11621205 * The sources in src are compiled using TASTy from scala2-library-tasty but then run
0 commit comments