@@ -134,7 +134,7 @@ object Build {
134
134
" -language:existentials,higherKinds,implicitConversions"
135
135
),
136
136
137
- javacOptions ++= Seq (" -Xlint:unchecked" , " -Xlint:deprecation" ),
137
+ javacOptions in ( Compile , compile) ++= Seq (" -Xlint:unchecked" , " -Xlint:deprecation" ),
138
138
139
139
// Change this to true if you want to bootstrap using a published non-bootstrapped compiler
140
140
bootstrapFromPublishedJars := false ,
@@ -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,15 +364,7 @@ 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
371
- 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
- // Remove javac invalid options in Compile doc
377
- javacOptions in (Compile , doc) --= Seq (" -Xlint:unchecked" , " -Xlint:deprecation" )
378
- )
367
+ settings(commonJavaSettings)
379
368
380
369
private lazy val dottydocClasspath = Def .task {
381
370
val jars = (packageAll in `dotty-compiler`).value
@@ -790,18 +779,6 @@ object Build {
790
779
case Bootstrapped => `dotty-library-bootstrapped`
791
780
}
792
781
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
782
lazy val dottySbtBridgeSettings = Seq (
806
783
cleanSbtBridge := {
807
784
cleanSbtBridgeImpl()
@@ -831,24 +808,44 @@ object Build {
831
808
parallelExecution in Test := false
832
809
)
833
810
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
- */
811
+ // Needed until https://github.com/sbt/sbt/issues/2402 is fixed.
812
+ lazy val cleanSbtBridge = TaskKey [Unit ](" cleanSbtBridge" , " delete dotty-sbt-bridge cache" )
813
+
814
+ def cleanSbtBridgeImpl (): Unit = {
815
+ val home = System .getProperty(" user.home" )
816
+ val sbtOrg = " org.scala-sbt"
817
+ val bridgePattern = s " *dotty-sbt-bridge* $dottyVersion* "
818
+
819
+ IO .delete((file(home) / " .sbt" / " 1.0" / " zinc" / sbtOrg * bridgePattern).get)
820
+ IO .delete((file(home) / " .sbt" / " boot" * " scala-*" / sbtOrg / " sbt" * " *" * bridgePattern).get)
821
+ }
822
+
823
+ lazy val `dotty-sbt-bridge` = project.in(file(" sbt-bridge" )).
824
+ dependsOn(dottyCompiler(NonBootstrapped ) % Provided ).
825
+ dependsOn(dottyDoc(NonBootstrapped ) % Provided ).
826
+ settings(commonJavaSettings).
827
+ settings(
828
+ cleanSbtBridge := {
829
+ cleanSbtBridgeImpl()
830
+ },
831
+ compile in Compile := {
832
+ val log = streams.value.log
833
+ val prev = (previousCompile in Compile ).value.analysis.orElse(null )
834
+ val cur = (compile in Compile ).value
835
+ if (prev != cur) {
836
+ log.info(" Cleaning the dotty-sbt-bridge cache because it was recompiled." )
837
+ cleanSbtBridgeImpl()
838
+ }
839
+ cur
840
+ },
841
+ description := " sbt compiler bridge for Dotty" ,
842
+ libraryDependencies ++= Seq (
843
+ Dependencies .`compiler-interface` % Provided ,
844
+ (Dependencies .`zinc-api-info` % Test ).withDottyCompat(scalaVersion.value)
845
+ ),
846
+
847
+ fork in Test := true ,
848
+ parallelExecution in Test := false
852
849
)
853
850
854
851
lazy val `dotty-language-server` = project.in(file(" language-server" )).
@@ -1007,7 +1004,7 @@ object Build {
1007
1004
scriptedLaunchOpts ++= ivyPaths.value.ivyHome.map(" -Dsbt.ivy.home=" + _.getAbsolutePath).toList,
1008
1005
scriptedBufferLog := true ,
1009
1006
scripted := scripted.dependsOn(
1010
- publishLocal in `dotty-sbt-bridge-bootstrapped `,
1007
+ publishLocal in `dotty-sbt-bridge`,
1011
1008
publishLocal in `dotty-interfaces`,
1012
1009
publishLocal in `dotty-compiler-bootstrapped`,
1013
1010
publishLocal in `dotty-library-bootstrapped`,
@@ -1275,7 +1272,7 @@ object Build {
1275
1272
1276
1273
// FIXME: we do not aggregate `bin` because its tests delete jars, thus breaking other tests
1277
1274
def asDottyRoot (implicit mode : Mode ): Project = project.withCommonSettings.
1278
- aggregate(`dotty-interfaces`, dottyLibrary, dottyCompiler, dottyDoc, dottySbtBridgeReference ).
1275
+ aggregate(`dotty-interfaces`, dottyLibrary, dottyCompiler, dottyDoc, `dotty-sbt-bridge` ).
1279
1276
bootstrappedAggregate(`scala-library`, `scala-compiler`, `scala-reflect`, scalap, `dotty-language-server`).
1280
1277
dependsOn(dottyCompiler).
1281
1278
dependsOn(dottyLibrary).
@@ -1299,11 +1296,6 @@ object Build {
1299
1296
dependsOn(dottyCompiler, dottyCompiler % " test->test" ).
1300
1297
settings(dottyDocSettings)
1301
1298
1302
- def asDottySbtBridge (implicit mode : Mode ): Project = project.withCommonSettings.
1303
- dependsOn(dottyCompiler % Provided ).
1304
- dependsOn(dottyDoc % Provided ).
1305
- settings(dottySbtBridgeSettings)
1306
-
1307
1299
def asDottyBench (implicit mode : Mode ): Project = project.withCommonSettings.
1308
1300
dependsOn(dottyCompiler).
1309
1301
settings(commonBenchmarkSettings).
0 commit comments