@@ -209,10 +209,14 @@ object Build {
209
209
testOptions in Test += Tests .Argument (TestFrameworks .JUnit , " -a" , " -v" )
210
210
)
211
211
212
- // Settings used for projects compiled only with Scala 2
213
- lazy val commonScala2Settings = commonSettings ++ Seq (
212
+ // Settings used for projects compiled only with Java
213
+ lazy val commonJavaSettings = commonSettings ++ Seq (
214
214
version := dottyVersion,
215
- scalaVersion := scalacVersion
215
+ scalaVersion := scalacVersion,
216
+ // Do not append Scala versions to the generated artifacts
217
+ crossPaths := false ,
218
+ // Do not depend on the Scala library
219
+ autoScalaLibrary := false
216
220
)
217
221
218
222
// Settings used when compiling dotty using Scala 2
@@ -351,13 +355,6 @@ object Build {
351
355
// currently refers to dotty in its scripted task and "aggregate" does not take by-name
352
356
// parameters: https://github.com/sbt/sbt/issues/2200
353
357
lazy val dottySbtBridgeRef = LocalProject (" dotty-sbt-bridge" )
354
- // Same thing for the bootstrapped version
355
- lazy val dottySbtBridgeBootstrappedRef = LocalProject (" dotty-sbt-bridge-bootstrapped" )
356
-
357
- def dottySbtBridgeReference (implicit mode : Mode ): LocalProject = mode match {
358
- case NonBootstrapped => dottySbtBridgeRef
359
- case _ => dottySbtBridgeBootstrappedRef
360
- }
361
358
362
359
// The root project:
363
360
// - aggregates other projects so that "compile", "test", etc are run on all projects at once.
@@ -367,12 +364,8 @@ object Build {
367
364
lazy val `dotty-bootstrapped` = project.asDottyRoot(Bootstrapped )
368
365
369
366
lazy val `dotty-interfaces` = project.in(file(" interfaces" )).
370
- settings(commonScala2Settings). // Java-only project, so this is fine
367
+ settings(commonJavaSettings).
371
368
settings(
372
- // Do not append Scala versions to the generated artifacts
373
- crossPaths := false ,
374
- // Do not depend on the Scala library
375
- autoScalaLibrary := false ,
376
369
// Remove javac invalid options in Compile doc
377
370
javacOptions in (Compile , doc) --= Seq (" -Xlint:unchecked" , " -Xlint:deprecation" )
378
371
)
@@ -790,18 +783,6 @@ object Build {
790
783
case Bootstrapped => `dotty-library-bootstrapped`
791
784
}
792
785
793
- // until sbt/sbt#2402 is fixed (https://github.com/sbt/sbt/issues/2402)
794
- lazy val cleanSbtBridge = TaskKey [Unit ](" cleanSbtBridge" , " delete dotty-sbt-bridge cache" )
795
-
796
- def cleanSbtBridgeImpl (): Unit = {
797
- val home = System .getProperty(" user.home" )
798
- val sbtOrg = " org.scala-sbt"
799
- val bridgePattern = s " *dotty-sbt-bridge* $dottyVersion* "
800
-
801
- IO .delete((file(home) / " .sbt" / " 1.0" / " zinc" / sbtOrg * bridgePattern).get)
802
- IO .delete((file(home) / " .sbt" / " boot" * " scala-*" / sbtOrg / " sbt" * " *" * bridgePattern).get)
803
- }
804
-
805
786
lazy val dottySbtBridgeSettings = Seq (
806
787
cleanSbtBridge := {
807
788
cleanSbtBridgeImpl()
@@ -831,24 +812,44 @@ object Build {
831
812
parallelExecution in Test := false
832
813
)
833
814
834
- lazy val `dotty-sbt-bridge` = project.in(file(" sbt-bridge" )).asDottySbtBridge(NonBootstrapped )
835
- lazy val `dotty-sbt-bridge-bootstrapped` = project.in(file(" sbt-bridge" )).asDottySbtBridge(Bootstrapped )
836
- .settings(
837
- // Tweak -Yscala2-unpickler to allow some sbt dependencies used in tests
838
- /*
839
- scalacOptions in Test := {
840
- val oldOptions = (scalacOptions in Test).value
841
- val i = oldOptions.indexOf("-Yscala2-unpickler")
842
- assert(i != -1)
843
- val oldValue = oldOptions(i + 1)
844
-
845
- val attList = (dependencyClasspath in Test).value
846
- val sbtIo = findLib(attList, "org.scala-sbt/io")
847
- val zincApiInfo = findLib(attList, "zinc-apiinfo")
848
-
849
- oldOptions.updated(i + 1, s"$sbtIo:$zincApiInfo:$oldValue")
850
- }
851
- */
815
+ // Needed until https://github.com/sbt/sbt/issues/2402 is fixed.
816
+ lazy val cleanSbtBridge = TaskKey [Unit ](" cleanSbtBridge" , " delete dotty-sbt-bridge cache" )
817
+
818
+ def cleanSbtBridgeImpl (): Unit = {
819
+ val home = System .getProperty(" user.home" )
820
+ val sbtOrg = " org.scala-sbt"
821
+ val bridgePattern = s " *dotty-sbt-bridge* $dottyVersion* "
822
+
823
+ IO .delete((file(home) / " .sbt" / " 1.0" / " zinc" / sbtOrg * bridgePattern).get)
824
+ IO .delete((file(home) / " .sbt" / " boot" * " scala-*" / sbtOrg / " sbt" * " *" * bridgePattern).get)
825
+ }
826
+
827
+ lazy val `dotty-sbt-bridge` = project.in(file(" sbt-bridge" )).
828
+ dependsOn(dottyCompiler(NonBootstrapped ) % Provided ).
829
+ dependsOn(dottyDoc(NonBootstrapped ) % Provided ).
830
+ settings(commonJavaSettings).
831
+ settings(
832
+ cleanSbtBridge := {
833
+ cleanSbtBridgeImpl()
834
+ },
835
+ compile in Compile := {
836
+ val log = streams.value.log
837
+ val prev = (previousCompile in Compile ).value.analysis.orElse(null )
838
+ val cur = (compile in Compile ).value
839
+ if (prev != cur) {
840
+ log.info(" Cleaning the dotty-sbt-bridge cache because it was recompiled." )
841
+ cleanSbtBridgeImpl()
842
+ }
843
+ cur
844
+ },
845
+ description := " sbt compiler bridge for Dotty" ,
846
+ libraryDependencies ++= Seq (
847
+ Dependencies .`compiler-interface` % Provided ,
848
+ (Dependencies .`zinc-api-info` % Test ).withDottyCompat(scalaVersion.value)
849
+ ),
850
+
851
+ fork in Test := true ,
852
+ parallelExecution in Test := false
852
853
)
853
854
854
855
lazy val `dotty-language-server` = project.in(file(" language-server" )).
@@ -1007,7 +1008,7 @@ object Build {
1007
1008
scriptedLaunchOpts ++= ivyPaths.value.ivyHome.map(" -Dsbt.ivy.home=" + _.getAbsolutePath).toList,
1008
1009
scriptedBufferLog := true ,
1009
1010
scripted := scripted.dependsOn(
1010
- publishLocal in `dotty-sbt-bridge-bootstrapped `,
1011
+ publishLocal in `dotty-sbt-bridge`,
1011
1012
publishLocal in `dotty-interfaces`,
1012
1013
publishLocal in `dotty-compiler-bootstrapped`,
1013
1014
publishLocal in `dotty-library-bootstrapped`,
@@ -1275,7 +1276,7 @@ object Build {
1275
1276
1276
1277
// FIXME: we do not aggregate `bin` because its tests delete jars, thus breaking other tests
1277
1278
def asDottyRoot (implicit mode : Mode ): Project = project.withCommonSettings.
1278
- aggregate(`dotty-interfaces`, dottyLibrary, dottyCompiler, dottyDoc, dottySbtBridgeReference ).
1279
+ aggregate(`dotty-interfaces`, dottyLibrary, dottyCompiler, dottyDoc, `dotty-sbt-bridge` ).
1279
1280
bootstrappedAggregate(`scala-library`, `scala-compiler`, `scala-reflect`, scalap, `dotty-language-server`).
1280
1281
dependsOn(dottyCompiler).
1281
1282
dependsOn(dottyLibrary).
@@ -1299,11 +1300,6 @@ object Build {
1299
1300
dependsOn(dottyCompiler, dottyCompiler % " test->test" ).
1300
1301
settings(dottyDocSettings)
1301
1302
1302
- def asDottySbtBridge (implicit mode : Mode ): Project = project.withCommonSettings.
1303
- dependsOn(dottyCompiler % Provided ).
1304
- dependsOn(dottyDoc % Provided ).
1305
- settings(dottySbtBridgeSettings)
1306
-
1307
1303
def asDottyBench (implicit mode : Mode ): Project = project.withCommonSettings.
1308
1304
dependsOn(dottyCompiler).
1309
1305
settings(commonBenchmarkSettings).
0 commit comments