@@ -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
@@ -226,17 +230,9 @@ object Build {
226
230
version := dottyVersion,
227
231
scalaVersion := dottyNonBootstrappedVersion,
228
232
229
- // Avoid having to run `dotty-sbt-bridge/publishLocal` before compiling a bootstrapped project
230
- scalaCompilerBridgeSource :=
231
- (dottyOrganization %% " dotty-sbt-bridge" % dottyVersion)
232
- .artifacts(Artifact .sources(" dotty-sbt-bridge" ).withUrl(
233
- // We cannot use the `packageSrc` task because a setting cannot depend
234
- // on a task. Instead, we make `compile` below depend on the bridge `packageSrc`
235
- Some ((artifactPath in (`dotty-sbt-bridge`, Compile , packageSrc)).value.toURI.toURL))),
236
- compile in Compile := (compile in Compile )
237
- .dependsOn(packageSrc in (`dotty-sbt-bridge`, Compile ))
238
- .dependsOn(compile in (`dotty-sbt-bridge`, Compile ))
239
- .value,
233
+ scalaCompilerBridgeBinaryJar := {
234
+ Some ((packageBin in (`dotty-sbt-bridge`, Compile )).value)
235
+ },
240
236
241
237
// Use the same name as the non-bootstrapped projects for the artifacts
242
238
moduleName ~= { _.stripSuffix(" -bootstrapped" ) },
@@ -359,13 +355,6 @@ object Build {
359
355
// currently refers to dotty in its scripted task and "aggregate" does not take by-name
360
356
// parameters: https://github.com/sbt/sbt/issues/2200
361
357
lazy val dottySbtBridgeRef = LocalProject (" dotty-sbt-bridge" )
362
- // Same thing for the bootstrapped version
363
- lazy val dottySbtBridgeBootstrappedRef = LocalProject (" dotty-sbt-bridge-bootstrapped" )
364
-
365
- def dottySbtBridgeReference (implicit mode : Mode ): LocalProject = mode match {
366
- case NonBootstrapped => dottySbtBridgeRef
367
- case _ => dottySbtBridgeBootstrappedRef
368
- }
369
358
370
359
// The root project:
371
360
// - aggregates other projects so that "compile", "test", etc are run on all projects at once.
@@ -375,15 +364,7 @@ object Build {
375
364
lazy val `dotty-bootstrapped` = project.asDottyRoot(Bootstrapped )
376
365
377
366
lazy val `dotty-interfaces` = project.in(file(" interfaces" )).
378
- settings(commonScala2Settings). // Java-only project, so this is fine
379
- settings(
380
- // Do not append Scala versions to the generated artifacts
381
- crossPaths := false ,
382
- // Do not depend on the Scala library
383
- autoScalaLibrary := false ,
384
- // Remove javac invalid options in Compile doc
385
- javacOptions in (Compile , doc) --= Seq (" -Xlint:unchecked" , " -Xlint:deprecation" )
386
- )
367
+ settings(commonJavaSettings)
387
368
388
369
private lazy val dottydocClasspath = Def .task {
389
370
val jars = (packageAll in `dotty-compiler`).value
@@ -798,67 +779,19 @@ object Build {
798
779
case Bootstrapped => `dotty-library-bootstrapped`
799
780
}
800
781
801
- // until sbt/sbt#2402 is fixed (https://github.com/sbt/sbt/issues/2402)
802
- lazy val cleanSbtBridge = TaskKey [Unit ](" cleanSbtBridge" , " delete dotty-sbt-bridge cache" )
803
-
804
- def cleanSbtBridgeImpl (): Unit = {
805
- val home = System .getProperty(" user.home" )
806
- val sbtOrg = " org.scala-sbt"
807
- val bridgePattern = s " *dotty-sbt-bridge* $dottyVersion* "
808
-
809
- IO .delete((file(home) / " .sbt" / " 1.0" / " zinc" / sbtOrg * bridgePattern).get)
810
- IO .delete((file(home) / " .sbt" / " boot" * " scala-*" / sbtOrg / " sbt" * " *" * bridgePattern).get)
811
- }
812
-
813
- lazy val dottySbtBridgeSettings = Seq (
814
- cleanSbtBridge := {
815
- cleanSbtBridgeImpl()
816
- },
817
- compile in Compile := {
818
- val log = streams.value.log
819
- val prev = (previousCompile in Compile ).value.analysis.orElse(null )
820
- val cur = (compile in Compile ).value
821
- if (prev != cur) {
822
- log.info(" Cleaning the dotty-sbt-bridge cache because it was recompiled." )
823
- cleanSbtBridgeImpl()
824
- }
825
- cur
826
- },
827
- description := " sbt compiler bridge for Dotty" ,
828
- resolvers += Resolver .typesafeIvyRepo(" releases" ), // For org.scala-sbt:api
829
- libraryDependencies ++= Seq (
830
- Dependencies .`compiler-interface` % Provided ,
831
- (Dependencies .`zinc-api-info` % Test ).withDottyCompat(scalaVersion.value)
832
- ),
833
- // The sources should be published with crossPaths := false since they
834
- // need to be compiled by the project using the bridge.
835
- crossPaths := false ,
836
-
837
- // Don't publish any binaries for the bridge because of the above
838
- publishArtifact in (Compile , packageBin) := false ,
839
-
840
- fork in Test := true ,
841
- parallelExecution in Test := false
842
- )
782
+ lazy val `dotty-sbt-bridge` = project.in(file(" sbt-bridge" )).
783
+ dependsOn(dottyCompiler(NonBootstrapped ) % Provided ).
784
+ dependsOn(dottyDoc(NonBootstrapped ) % Provided ).
785
+ settings(commonJavaSettings).
786
+ settings(
787
+ description := " sbt compiler bridge for Dotty" ,
788
+ libraryDependencies ++= Seq (
789
+ Dependencies .`compiler-interface` % Provided ,
790
+ (Dependencies .`zinc-api-info` % Test ).withDottyCompat(scalaVersion.value)
791
+ ),
843
792
844
- lazy val `dotty-sbt-bridge` = project.in(file(" sbt-bridge" )).asDottySbtBridge(NonBootstrapped )
845
- lazy val `dotty-sbt-bridge-bootstrapped` = project.in(file(" sbt-bridge" )).asDottySbtBridge(Bootstrapped )
846
- .settings(
847
- // Tweak -Yscala2-unpickler to allow some sbt dependencies used in tests
848
- /*
849
- scalacOptions in Test := {
850
- val oldOptions = (scalacOptions in Test).value
851
- val i = oldOptions.indexOf("-Yscala2-unpickler")
852
- assert(i != -1)
853
- val oldValue = oldOptions(i + 1)
854
-
855
- val attList = (dependencyClasspath in Test).value
856
- val sbtIo = findLib(attList, "org.scala-sbt/io")
857
- val zincApiInfo = findLib(attList, "zinc-apiinfo")
858
-
859
- oldOptions.updated(i + 1, s"$sbtIo:$zincApiInfo:$oldValue")
860
- }
861
- */
793
+ fork in Test := true ,
794
+ parallelExecution in Test := false
862
795
)
863
796
864
797
lazy val `dotty-language-server` = project.in(file(" language-server" )).
@@ -1017,7 +950,7 @@ object Build {
1017
950
scriptedLaunchOpts ++= ivyPaths.value.ivyHome.map(" -Dsbt.ivy.home=" + _.getAbsolutePath).toList,
1018
951
scriptedBufferLog := true ,
1019
952
scripted := scripted.dependsOn(
1020
- publishLocal in `dotty-sbt-bridge-bootstrapped `,
953
+ publishLocal in `dotty-sbt-bridge`,
1021
954
publishLocal in `dotty-interfaces`,
1022
955
publishLocal in `dotty-compiler-bootstrapped`,
1023
956
publishLocal in `dotty-library-bootstrapped`,
@@ -1285,7 +1218,7 @@ object Build {
1285
1218
1286
1219
// FIXME: we do not aggregate `bin` because its tests delete jars, thus breaking other tests
1287
1220
def asDottyRoot (implicit mode : Mode ): Project = project.withCommonSettings.
1288
- aggregate(`dotty-interfaces`, dottyLibrary, dottyCompiler, dottyDoc, dottySbtBridgeReference ).
1221
+ aggregate(`dotty-interfaces`, dottyLibrary, dottyCompiler, dottyDoc, `dotty-sbt-bridge` ).
1289
1222
bootstrappedAggregate(`scala-library`, `scala-compiler`, `scala-reflect`, scalap, `dotty-language-server`).
1290
1223
dependsOn(dottyCompiler).
1291
1224
dependsOn(dottyLibrary).
@@ -1309,11 +1242,6 @@ object Build {
1309
1242
dependsOn(dottyCompiler, dottyCompiler % " test->test" ).
1310
1243
settings(dottyDocSettings)
1311
1244
1312
- def asDottySbtBridge (implicit mode : Mode ): Project = project.withCommonSettings.
1313
- dependsOn(dottyCompiler % Provided ).
1314
- dependsOn(dottyDoc % Provided ).
1315
- settings(dottySbtBridgeSettings)
1316
-
1317
1245
def asDottyBench (implicit mode : Mode ): Project = project.withCommonSettings.
1318
1246
dependsOn(dottyCompiler).
1319
1247
settings(commonBenchmarkSettings).
0 commit comments