From b9824967392e4b674881e5dcec4c4fbb05e6cd9b Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Sun, 5 Aug 2018 23:23:12 +0900 Subject: Add support for Dotty projects (#397) * Abstract over the scala compiler organization * Support using a locally published compiler Publishing locally with sbt means publishing ivy-style, which uses a different naming convention than maven, we now handle both cases. * Add minimal support for Dotty projects * Rewrite scalalib.Dep, introduce scalalib.CrossVersion Instead of Dep being a trait with three cases (Java/Scala/Point), it is now a case class where the cross field is an instance of the CrossVersion trait which has three cases (Constant/Binary/Full). This is more versatile since it allows for non-empty constant suffixes which will be used to implement withDottyCompat in the next commit. It's also a cleaner separation of concerns. We also deduplicate various pieces of codes that computed the artifact name: this is now always handled in Dep and CrossVersion. * Add simple way to use Scala 2 deps in a Dotty project This is similar to the withDottyCompat method in the sbt-dotty plugin. * Turn off the Dotty test on Java >= 9 --- integration/test/resources/acyclic/build.sc | 2 +- integration/test/resources/ammonite/build.sc | 8 ++++---- integration/test/resources/play-json/build.sc | 4 ++-- integration/test/resources/upickle/build.sc | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'integration') diff --git a/integration/test/resources/acyclic/build.sc b/integration/test/resources/acyclic/build.sc index ce69f05d..73a3cb99 100644 --- a/integration/test/resources/acyclic/build.sc +++ b/integration/test/resources/acyclic/build.sc @@ -20,7 +20,7 @@ class AcyclicModule(val crossScalaVersion: String) extends CrossSbtModule with P ) def ivyDeps = Agg( - ivy"org.scala-lang:scala-compiler:${scalaVersion()}" + ivy"${scalaOrganization()}:scala-compiler:${scalaVersion()}" ) object test extends Tests{ def forkWorkingDir = ammonite.ops.pwd / 'target / 'workspace / 'acyclic diff --git a/integration/test/resources/ammonite/build.sc b/integration/test/resources/ammonite/build.sc index 39134e3d..c26d5050 100644 --- a/integration/test/resources/ammonite/build.sc +++ b/integration/test/resources/ammonite/build.sc @@ -33,7 +33,7 @@ class TerminalModule(val crossScalaVersion: String) extends AmmModule{ ivy"com.lihaoyi::fansi:0.2.4" ) def compileIvyDeps = Agg( - ivy"org.scala-lang:scala-reflect:$crossScalaVersion" + ivy"${scalaOrganization()}:scala-reflect:$crossScalaVersion" ) object test extends Tests @@ -49,7 +49,7 @@ object amm extends Cross[MainModule](fullCrossScalaVersions:_*){ ivy"com.lihaoyi::fansi:0.2.4" ) def compileIvyDeps = Agg( - ivy"org.scala-lang:scala-reflect:$crossScalaVersion" + ivy"${scalaOrganization()}:scala-reflect:$crossScalaVersion" ) } @@ -75,8 +75,8 @@ object amm extends Cross[MainModule](fullCrossScalaVersions:_*){ class InterpModule(val crossScalaVersion: String) extends AmmModule{ def moduleDeps = Seq(ops(), amm.util(), amm.runtime()) def ivyDeps = Agg( - ivy"org.scala-lang:scala-compiler:$crossScalaVersion", - ivy"org.scala-lang:scala-reflect:$crossScalaVersion", + ivy"${scalaOrganization()}:scala-compiler:$crossScalaVersion", + ivy"${scalaOrganization()}:scala-reflect:$crossScalaVersion", ivy"com.lihaoyi::scalaparse:1.0.0", ivy"org.javassist:javassist:3.21.0-GA" ) diff --git a/integration/test/resources/play-json/build.sc b/integration/test/resources/play-json/build.sc index c60eefba..d4557011 100644 --- a/integration/test/resources/play-json/build.sc +++ b/integration/test/resources/play-json/build.sc @@ -61,7 +61,7 @@ abstract class PlayJson(val platformSegment: String) extends PlayJsonModule { ) def ivyDeps = Agg( - ivy"org.scala-lang:scala-reflect:${scalaVersion()}", + ivy"${scalaOrganization()}:scala-reflect:${scalaVersion()}", ivy"org.typelevel::macro-compat::1.1.1" ) @@ -69,7 +69,7 @@ abstract class PlayJson(val platformSegment: String) extends PlayJsonModule { def compileIvyDeps = Agg( macroParadise, - ivy"org.scala-lang:scala-compiler:${scalaVersion()}" + ivy"${scalaOrganization()}:scala-compiler:${scalaVersion()}" ) def scalacPluginIvyDeps = Agg(macroParadise) diff --git a/integration/test/resources/upickle/build.sc b/integration/test/resources/upickle/build.sc index 2ea7668d..1f5f2bed 100644 --- a/integration/test/resources/upickle/build.sc +++ b/integration/test/resources/upickle/build.sc @@ -23,8 +23,8 @@ trait UpickleModule extends CrossSbtModule with PublishModule{ ) def compileIvyDeps = Agg( ivy"com.lihaoyi::acyclic:0.1.5", - ivy"org.scala-lang:scala-reflect:${scalaVersion()}", - ivy"org.scala-lang:scala-compiler:${scalaVersion()}" + ivy"${scalaOrganization()}:scala-reflect:${scalaVersion()}", + ivy"${scalaOrganization()}:scala-compiler:${scalaVersion()}" ) def ivyDeps = Agg( ivy"com.lihaoyi::sourcecode::0.1.3" -- cgit v1.2.3