@@ -176,9 +176,15 @@ object Build {
176
176
// Use the TASTy jar from `scala2-library-tasty` in the classpath
177
177
// This only works with `scala3-bootstrapped/scalac` and tests in `scala3-bootstrapped`
178
178
//
179
- // Enable in SBT with: set ThisBuild/Build.useScala2LibraryTasty := true
179
+ // Enable in SBT with: ` set ThisBuild/Build.useScala2LibraryTasty := true`
180
180
val useScala2LibraryTasty = settingKey[Boolean ](" Use the TASTy jar from `scala2-library-tasty` in the classpath" )
181
181
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
+
182
188
// Used to compile files similar to ./bin/scalac script
183
189
val scalac = inputKey[Unit ](" run the compiler using the correct classpath, or the user supplied classpath" )
184
190
@@ -226,6 +232,7 @@ object Build {
226
232
outputStrategy := Some (StdoutOutput ),
227
233
228
234
useScala2LibraryTasty := false ,
235
+ useScala2LibraryCCTasty := false ,
229
236
230
237
// enable verbose exception messages for JUnit
231
238
(Test / testOptions) += Tests .Argument (TestFrameworks .JUnit , " -a" , " -v" , " -s" ),
@@ -653,7 +660,18 @@ object Build {
653
660
Seq .empty
654
661
}
655
662
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 (
657
675
" -Ddotty.tests.dottyCompilerManagedSources=" + managedSrcDir,
658
676
" -Ddotty.tests.classes.dottyInterfaces=" + jars(" scala3-interfaces" ),
659
677
" -Ddotty.tests.classes.dottyLibrary=" + jars(" scala3-library" ),
@@ -876,6 +894,7 @@ object Build {
876
894
" scala3-tasty-inspector" -> (LocalProject (" scala3-tasty-inspector" ) / Compile / packageBin).value.getAbsolutePath,
877
895
" tasty-core" -> (LocalProject (" tasty-core-bootstrapped" ) / Compile / packageBin).value.getAbsolutePath,
878
896
" 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,
879
898
)
880
899
},
881
900
@@ -1004,8 +1023,21 @@ object Build {
1004
1023
withCommonSettings(Bootstrapped ).
1005
1024
dependsOn(dottyCompiler(Bootstrapped ) % " provided; compile->runtime; test->test" ).
1006
1025
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 (
1009
1041
javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
1010
1042
Compile / scalacOptions ++= {
1011
1043
Seq (" -sourcepath" , ((Compile / sourceManaged).value / " scala-library-src" ).toString)
@@ -1088,13 +1120,13 @@ object Build {
1088
1120
| - final val MinorVersion = $minorVersion
1089
1121
| - final val ExperimentalVersion = 0
1090
1122
| * Clean everything to generate a compiler with those new TASTy versions
1091
- | * Run scala2-library-bootstrapped /tastyMiMaReportIssues
1123
+ | * Run ${name.value} /tastyMiMaReportIssues
1092
1124
| """ .stripMargin)
1093
1125
1094
1126
}).value,
1095
1127
Compile / exportJars := true ,
1096
1128
artifactName := { (sv : ScalaVersion , module : ModuleID , artifact : Artifact ) =>
1097
- " scala2-library -" + dottyVersion + " ." + artifact.extension
1129
+ moduleName.value + " -" + dottyVersion + " ." + artifact.extension
1098
1130
},
1099
1131
run := {
1100
1132
val log = streams.value.log
@@ -1132,18 +1164,18 @@ object Build {
1132
1164
println(
1133
1165
s """ Usage:
1134
1166
|> $projectName/run list
1135
- | -- lists all files that are not overriden in scala2-library-bootstrapped /src
1167
+ | -- lists all files that are not overriden in ${name.value} /src
1136
1168
|
1137
1169
|> $projectName/run clone <sources>*
1138
- | -- clones the specified sources from the scala2-library-bootstrapped /src
1170
+ | -- clones the specified sources from the ${name.value} /src
1139
1171
| -- example: $projectName/run clone scala/Option.scala
1140
1172
|
1141
1173
|> $projectName/run overwrite <sources>*
1142
- | -- (danger) overwrites the specified sources from the scala2-library-bootstrapped /src
1174
+ | -- (danger) overwrites the specified sources from the ${name.value} /src
1143
1175
| """ .stripMargin)
1144
1176
}
1145
1177
}
1146
- )
1178
+ )
1147
1179
1148
1180
/** Packages the TASTy files of `scala2-library-bootstrapped` in a jar */
1149
1181
lazy val `scala2-library-tasty` = project.in(file(" scala2-library-tasty" )).
@@ -1156,6 +1188,17 @@ object Build {
1156
1188
},
1157
1189
)
1158
1190
1191
+ /** Packages the TASTy files of `scala2-library-cc` in a jar */
1192
+ lazy val `scala2-library-cc-tasty` = project.in(file(" scala2-library-cc-tasty" )).
1193
+ withCommonSettings(Bootstrapped ).
1194
+ settings(
1195
+ exportJars := true ,
1196
+ Compile / packageBin / mappings := {
1197
+ (`scala2-library-cc` / Compile / packageBin / mappings).value
1198
+ .filter(_._2.endsWith(" .tasty" ))
1199
+ },
1200
+ )
1201
+
1159
1202
/** Test the tasty generated by `scala2-library-bootstrapped`
1160
1203
*
1161
1204
* The sources in src are compiled using TASTy from scala2-library-tasty but then run
0 commit comments