Skip to content

Commit 8d4015a

Browse files
committed
Add dotty-sbt-bridge-bootstrapped project
The regular dotty-sbt-bridge depends on `dotty-compiler` but we'd like to be able to publish only bootstrapped artifacts without depending on any non-bootstrapped artifacts.
1 parent 693f3f7 commit 8d4015a

File tree

2 files changed

+49
-36
lines changed

2 files changed

+49
-36
lines changed

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ val `dotty-bin-tests` = Build.`dotty-bin-tests`
1010
val `dotty-library` = Build.`dotty-library`
1111
val `dotty-library-bootstrapped` = Build.`dotty-library-bootstrapped`
1212
val `dotty-sbt-bridge` = Build.`dotty-sbt-bridge`
13+
val `dotty-sbt-bridge-bootstrapped` = Build.`dotty-sbt-bridge-bootstrapped`
1314
val sjsSandbox = Build.sjsSandbox
1415
val `dotty-bench` = Build.`dotty-bench`
1516
val `scala-library` = Build.`scala-library`

project/Build.scala

Lines changed: 48 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ object Build {
114114
// currently refers to dotty in its scripted task and "aggregate" does not take by-name
115115
// parameters: https://github.com/sbt/sbt/issues/2200
116116
lazy val dottySbtBridgeRef = LocalProject("dotty-sbt-bridge")
117+
// Same thing for the bootstrapped version
118+
lazy val dottySbtBridgeBootstrappedRef = LocalProject("dotty-sbt-bridge-bootstrapped")
117119

118120
// The root project:
119121
// - aggregates other projects so that "compile", "test", etc are run on all projects at once.
@@ -135,7 +137,8 @@ object Build {
135137

136138
// Meta project aggregating all bootstrapped projects
137139
lazy val `dotty-bootstrapped` = project.
138-
aggregate(`dotty-library-bootstrapped`, `dotty-compiler-bootstrapped`, `dotty-doc-bootstrapped`).
140+
aggregate(`dotty-library-bootstrapped`, `dotty-compiler-bootstrapped`, `dotty-doc-bootstrapped`,
141+
dottySbtBridgeBootstrappedRef).
139142
settings(commonSettings).
140143
settings(
141144
publishArtifact := false
@@ -549,44 +552,46 @@ object Build {
549552
// until sbt/sbt#2402 is fixed (https://github.com/sbt/sbt/issues/2402)
550553
lazy val cleanSbtBridge = TaskKey[Unit]("cleanSbtBridge", "delete dotty-sbt-bridge cache")
551554

552-
lazy val `dotty-sbt-bridge` = project.in(file("sbt-bridge")).
553-
dependsOn(`dotty-compiler`).
554-
settings(commonSettings).
555-
settings(
556-
cleanSbtBridge := {
557-
val dottySbtBridgeVersion = version.value
558-
val dottyVersion = (version in `dotty-compiler`).value
559-
val classVersion = System.getProperty("java.class.version")
560-
561-
val sbtV = sbtVersion.value
562-
val sbtOrg = "org.scala-sbt"
563-
val sbtScalaVersion = "2.10.6"
564-
565-
val home = System.getProperty("user.home")
566-
val org = organization.value
567-
val artifact = moduleName.value
555+
lazy val dottySbtBridgeSettings = Seq(
556+
cleanSbtBridge := {
557+
val dottySbtBridgeVersion = version.value
558+
val dottyVersion = (version in `dotty-compiler`).value
559+
val classVersion = System.getProperty("java.class.version")
560+
561+
val sbtV = sbtVersion.value
562+
val sbtOrg = "org.scala-sbt"
563+
val sbtScalaVersion = "2.10.6"
564+
565+
val home = System.getProperty("user.home")
566+
val org = organization.value
567+
val artifact = moduleName.value
568+
569+
IO.delete(file(home) / ".ivy2" / "cache" / sbtOrg / s"$org-$artifact-$dottySbtBridgeVersion-bin_${dottyVersion}__$classVersion")
570+
IO.delete(file(home) / ".sbt" / "boot" / s"scala-$sbtScalaVersion" / sbtOrg / "sbt" / sbtV / s"$org-$artifact-$dottySbtBridgeVersion-bin_${dottyVersion}__$classVersion")
571+
},
572+
publishLocal := (publishLocal.dependsOn(cleanSbtBridge)).value,
573+
description := "sbt compiler bridge for Dotty",
574+
resolvers += Resolver.typesafeIvyRepo("releases"), // For org.scala-sbt stuff
575+
libraryDependencies ++= Seq(
576+
"org.scala-sbt" % "interface" % sbtVersion.value,
577+
"org.scala-sbt" % "api" % sbtVersion.value % "test",
578+
"org.specs2" %% "specs2" % "2.3.11" % "test"
579+
),
580+
// The sources should be published with crossPaths := false since they
581+
// need to be compiled by the project using the bridge.
582+
crossPaths := false,
568583

569-
IO.delete(file(home) / ".ivy2" / "cache" / sbtOrg / s"$org-$artifact-$dottySbtBridgeVersion-bin_${dottyVersion}__$classVersion")
570-
IO.delete(file(home) / ".sbt" / "boot" / s"scala-$sbtScalaVersion" / sbtOrg / "sbt" / sbtV / s"$org-$artifact-$dottySbtBridgeVersion-bin_${dottyVersion}__$classVersion")
571-
},
572-
publishLocal := (publishLocal.dependsOn(cleanSbtBridge)).value,
573-
description := "sbt compiler bridge for Dotty",
574-
resolvers += Resolver.typesafeIvyRepo("releases"), // For org.scala-sbt stuff
575-
libraryDependencies ++= Seq(
576-
"org.scala-sbt" % "interface" % sbtVersion.value,
577-
"org.scala-sbt" % "api" % sbtVersion.value % "test",
578-
"org.specs2" %% "specs2" % "2.3.11" % "test"
579-
),
580-
// The sources should be published with crossPaths := false since they
581-
// need to be compiled by the project using the bridge.
582-
crossPaths := false,
584+
// Don't publish any binaries for the bridge because of the above
585+
publishArtifact in (Compile, packageBin) := false,
583586

584-
// Don't publish any binaries for the bridge because of the above
585-
publishArtifact in (Compile, packageBin) := false,
587+
fork in Test := true,
588+
parallelExecution in Test := false
589+
)
586590

587-
fork in Test := true,
588-
parallelExecution in Test := false
589-
).
591+
lazy val `dotty-sbt-bridge` = project.in(file("sbt-bridge")).
592+
dependsOn(`dotty-compiler`).
593+
settings(commonSettings).
594+
settings(dottySbtBridgeSettings).
590595
settings(ScriptedPlugin.scriptedSettings: _*).
591596
settings(
592597
ScriptedPlugin.sbtTestDirectory := baseDirectory.value / "sbt-test",
@@ -625,6 +630,13 @@ object DottyInjectedPlugin extends AutoPlugin {
625630
*/
626631
)
627632

633+
lazy val `dotty-sbt-bridge-bootstrapped` = project.in(file("sbt-bridge")).
634+
dependsOn(`dotty-compiler-bootstrapped`).
635+
settings(commonSettings).
636+
settings(commonBootstrappedSettings).
637+
settings(dottySbtBridgeSettings)
638+
639+
628640
/** A sandbox to play with the Scala.js back-end of dotty.
629641
*
630642
* This sandbox is compiled with dotty with support for Scala.js. It can be

0 commit comments

Comments
 (0)