Skip to content

Commit 720097e

Browse files
committed
Get rid of dotty-sbt-bridge-bootstrapped
Not needed now that the project is Java-only.
1 parent d5486aa commit 720097e

File tree

2 files changed

+49
-58
lines changed

2 files changed

+49
-58
lines changed

build.sbt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ val `dotty-compiler-bootstrapped` = Build.`dotty-compiler-bootstrapped`
88
val `dotty-library` = Build.`dotty-library`
99
val `dotty-library-bootstrapped` = Build.`dotty-library-bootstrapped`
1010
val `dotty-sbt-bridge` = Build.`dotty-sbt-bridge`
11-
val `dotty-sbt-bridge-bootstrapped` = Build.`dotty-sbt-bridge-bootstrapped`
1211
val `dotty-language-server` = Build.`dotty-language-server`
1312
val `dotty-bench` = Build.`dotty-bench`
1413
val `dotty-bench-bootstrapped` = Build.`dotty-bench-bootstrapped`

project/Build.scala

Lines changed: 49 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ object Build {
134134
"-language:existentials,higherKinds,implicitConversions"
135135
),
136136

137-
javacOptions ++= Seq("-Xlint:unchecked", "-Xlint:deprecation"),
137+
javacOptions in (Compile, compile) ++= Seq("-Xlint:unchecked", "-Xlint:deprecation"),
138138

139139
// Change this to true if you want to bootstrap using a published non-bootstrapped compiler
140140
bootstrapFromPublishedJars := false,
@@ -209,10 +209,14 @@ object Build {
209209
testOptions in Test += Tests.Argument(TestFrameworks.JUnit, "-a", "-v")
210210
)
211211

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(
214214
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
216220
)
217221

218222
// Settings used when compiling dotty using Scala 2
@@ -351,13 +355,6 @@ object Build {
351355
// currently refers to dotty in its scripted task and "aggregate" does not take by-name
352356
// parameters: https://github.com/sbt/sbt/issues/2200
353357
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-
}
361358

362359
// The root project:
363360
// - aggregates other projects so that "compile", "test", etc are run on all projects at once.
@@ -367,15 +364,7 @@ object Build {
367364
lazy val `dotty-bootstrapped` = project.asDottyRoot(Bootstrapped)
368365

369366
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)
379368

380369
private lazy val dottydocClasspath = Def.task {
381370
val jars = (packageAll in `dotty-compiler`).value
@@ -790,18 +779,6 @@ object Build {
790779
case Bootstrapped => `dotty-library-bootstrapped`
791780
}
792781

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-
805782
lazy val dottySbtBridgeSettings = Seq(
806783
cleanSbtBridge := {
807784
cleanSbtBridgeImpl()
@@ -831,24 +808,44 @@ object Build {
831808
parallelExecution in Test := false
832809
)
833810

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
852849
)
853850

854851
lazy val `dotty-language-server` = project.in(file("language-server")).
@@ -1007,7 +1004,7 @@ object Build {
10071004
scriptedLaunchOpts ++= ivyPaths.value.ivyHome.map("-Dsbt.ivy.home=" + _.getAbsolutePath).toList,
10081005
scriptedBufferLog := true,
10091006
scripted := scripted.dependsOn(
1010-
publishLocal in `dotty-sbt-bridge-bootstrapped`,
1007+
publishLocal in `dotty-sbt-bridge`,
10111008
publishLocal in `dotty-interfaces`,
10121009
publishLocal in `dotty-compiler-bootstrapped`,
10131010
publishLocal in `dotty-library-bootstrapped`,
@@ -1275,7 +1272,7 @@ object Build {
12751272

12761273
// FIXME: we do not aggregate `bin` because its tests delete jars, thus breaking other tests
12771274
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`).
12791276
bootstrappedAggregate(`scala-library`, `scala-compiler`, `scala-reflect`, scalap, `dotty-language-server`).
12801277
dependsOn(dottyCompiler).
12811278
dependsOn(dottyLibrary).
@@ -1299,11 +1296,6 @@ object Build {
12991296
dependsOn(dottyCompiler, dottyCompiler % "test->test").
13001297
settings(dottyDocSettings)
13011298

1302-
def asDottySbtBridge(implicit mode: Mode): Project = project.withCommonSettings.
1303-
dependsOn(dottyCompiler % Provided).
1304-
dependsOn(dottyDoc % Provided).
1305-
settings(dottySbtBridgeSettings)
1306-
13071299
def asDottyBench(implicit mode: Mode): Project = project.withCommonSettings.
13081300
dependsOn(dottyCompiler).
13091301
settings(commonBenchmarkSettings).

0 commit comments

Comments
 (0)