Skip to content

Commit 5d5da23

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

File tree

2 files changed

+48
-53
lines changed

2 files changed

+48
-53
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: 48 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -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,12 +364,8 @@ 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
367+
settings(commonJavaSettings).
371368
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,
376369
//Remove javac invalid options in Compile doc
377370
javacOptions in (Compile, doc) --= Seq("-Xlint:unchecked", "-Xlint:deprecation")
378371
)
@@ -790,18 +783,6 @@ object Build {
790783
case Bootstrapped => `dotty-library-bootstrapped`
791784
}
792785

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-
805786
lazy val dottySbtBridgeSettings = Seq(
806787
cleanSbtBridge := {
807788
cleanSbtBridgeImpl()
@@ -831,24 +812,44 @@ object Build {
831812
parallelExecution in Test := false
832813
)
833814

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
852853
)
853854

854855
lazy val `dotty-language-server` = project.in(file("language-server")).
@@ -1007,7 +1008,7 @@ object Build {
10071008
scriptedLaunchOpts ++= ivyPaths.value.ivyHome.map("-Dsbt.ivy.home=" + _.getAbsolutePath).toList,
10081009
scriptedBufferLog := true,
10091010
scripted := scripted.dependsOn(
1010-
publishLocal in `dotty-sbt-bridge-bootstrapped`,
1011+
publishLocal in `dotty-sbt-bridge`,
10111012
publishLocal in `dotty-interfaces`,
10121013
publishLocal in `dotty-compiler-bootstrapped`,
10131014
publishLocal in `dotty-library-bootstrapped`,
@@ -1275,7 +1276,7 @@ object Build {
12751276

12761277
// FIXME: we do not aggregate `bin` because its tests delete jars, thus breaking other tests
12771278
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`).
12791280
bootstrappedAggregate(`scala-library`, `scala-compiler`, `scala-reflect`, scalap, `dotty-language-server`).
12801281
dependsOn(dottyCompiler).
12811282
dependsOn(dottyLibrary).
@@ -1299,11 +1300,6 @@ object Build {
12991300
dependsOn(dottyCompiler, dottyCompiler % "test->test").
13001301
settings(dottyDocSettings)
13011302

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

0 commit comments

Comments
 (0)