Automatically choose proper compiler bridge for dotty

Before this commit, using dotty in your sbt project required to add:
  scalaCompilerBridgeSource := ("ch.epfl.lamp" % "dotty-sbt-bridge" %
    scalaVersion.value % "component").sources()
in your build.sbt. We might as well automatically do this, this reduces
the boilerplate for using dotty in your project to:
  scalaOrganization := "ch.epfl.lamp"
  scalaVersion := "0.1.1-SNAPSHOT"
  scalaBinaryVersion := "2.11" // dotty itself is only published as a
                               // 2.11 artefact currently
This commit is contained in:
Guillaume Martres 2017-01-10 16:56:11 +01:00
parent 10b71ef1c4
commit 3c6db1ce5d
2 changed files with 18 additions and 1 deletions

View File

@ -236,7 +236,13 @@ object Defaults extends BuildCommon {
val _ = clean.value
IvyActions.cleanCachedResolutionCache(ivyModule.value, streams.value.log)
},
scalaCompilerBridgeSource := ModuleID(xsbti.ArtifactInfo.SbtOrganization, "compiler-interface", sbtVersion.value, Some("component")).sources()
scalaCompilerBridgeSource := {
if (ScalaInstance.isDotty(scalaVersion.value))
// Maintained at https://github.com/lampepfl/dotty/tree/master/sbt-bridge
ModuleID(scalaOrganization.value, "dotty-sbt-bridge", scalaVersion.value, Some("component")).sources()
else
ModuleID(xsbti.ArtifactInfo.SbtOrganization, "compiler-interface", sbtVersion.value, Some("component")).sources()
}
)
// must be a val: duplication detected by object identity
private[this] lazy val compileBaseGlobal: Seq[Setting[_]] = globalDefaults(Seq(

View File

@ -0,0 +1,11 @@
### Improvements
- When sbt detects that the project is compiled with dotty, it now automatically
set `scalaCompilerBridgeSource` correctly, this reduces the boilerplate needed
to make a dotty project. Note that dotty support in sbt is still considered
experimental and not officially supported, see [dotty.epfl.ch][dotty] for
more information. [#2902][2902] by [@smarter][@smarter]
[dotty]: http://dotty.epfl.ch/
[2902]: https://github.com/sbt/sbt/pull/2902
[@smarter]: https://github.com/smarter