diff --git a/.drone.yml b/.drone.yml index 7532a05f6950..712dfc3817e9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -23,7 +23,7 @@ pipeline: # We run tests in parallel. Tests run in a copy of the working directory to avoid conflict test: group: test - image: lampepfl/dotty:2018-08-31 + image: lampepfl/dotty:2018-09-14-2 commands: - cp -R . /tmp/1/ && cd /tmp/1/ - ./project/scripts/sbt ";compile ;test" @@ -31,7 +31,7 @@ pipeline: test_bootstrapped: group: test - image: lampepfl/dotty:2018-08-31 + image: lampepfl/dotty:2018-09-14-2 commands: - cp -R . /tmp/2/ && cd /tmp/2/ - ./project/scripts/sbt ";dotty-bootstrapped/compile ;dotty-bootstrapped/test" @@ -39,7 +39,7 @@ pipeline: test_sbt: group: test - image: lampepfl/dotty:2018-08-31 + image: lampepfl/dotty:2018-09-14-2 commands: - cp -R . /tmp/4/ && cd /tmp/4/ - ./project/scripts/sbt sbt-dotty/scripted @@ -49,7 +49,7 @@ pipeline: # DOCUMENTATION: documentation: - image: lampepfl/dotty:2018-08-31 + image: lampepfl/dotty:2018-09-14-2 commands: - ./project/scripts/genDocs secrets: [ bot_pass ] @@ -61,7 +61,7 @@ pipeline: # PUBLISHING: # Publishing expect NIGHTLYBUILD or RELEASEBUILD to be set. See dottyVersion in Build.scala publish_nightly: - image: lampepfl/dotty:2018-08-31 + image: lampepfl/dotty:2018-09-14-2 environment: - NIGHTLYBUILD=yes commands: @@ -72,7 +72,7 @@ pipeline: environment: nightly publish_release: - image: lampepfl/dotty:2018-08-31 + image: lampepfl/dotty:2018-09-14-2 environment: - RELEASEBUILD=yes commands: @@ -96,7 +96,7 @@ pipeline: event: tag publish_sbt_release: - image: lampepfl/dotty:2018-08-31 + image: lampepfl/dotty:2018-09-14-2 environment: - RELEASEBUILD=yes commands: diff --git a/project/Build.scala b/project/Build.scala index 8ada0ccab0a8..7b984cf2aef3 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -10,6 +10,7 @@ import complete.DefaultParsers._ import pl.project13.scala.sbt.JmhPlugin import pl.project13.scala.sbt.JmhPlugin.JmhKeys.Jmh import sbt.Package.ManifestAttributes +import sbt.plugins.SbtPlugin import sbt.ScriptedPlugin.autoImport._ import xerial.sbt.pack.PackPlugin import xerial.sbt.pack.PackPlugin.autoImport._ @@ -356,7 +357,6 @@ object Build { lazy val `dotty-bootstrapped` = project.asDottyRoot(Bootstrapped) lazy val `dotty-interfaces` = project.in(file("interfaces")). - disablePlugins(ScriptedPlugin). settings(commonScala2Settings). // Java-only project, so this is fine settings( // Do not append Scala versions to the generated artifacts @@ -530,7 +530,7 @@ object Build { // FIXME: Not needed, but should be on the compiler CP ("org.scala-lang.modules" %% "scala-xml" % "1.1.0").withDottyCompat(scalaVersion.value), "org.scala-lang" % "scala-library" % scalacVersion % "test", - Dependencies.compilerInterface(sbtVersion.value), + Dependencies.`compiler-interface`, "org.jline" % "jline-reader" % "3.9.0", // used by the REPL "org.jline" % "jline-terminal" % "3.9.0", "org.jline" % "jline-terminal-jna" % "3.9.0" // needed for Windows @@ -799,8 +799,8 @@ object Build { description := "sbt compiler bridge for Dotty", resolvers += Resolver.typesafeIvyRepo("releases"), // For org.scala-sbt:api libraryDependencies ++= Seq( - Dependencies.compilerInterface(sbtVersion.value) % Provided, - (Dependencies.zincApiinfo(sbtVersion.value) % Test).withDottyCompat(scalaVersion.value) + Dependencies.`compiler-interface` % Provided, + (Dependencies.`zinc-api-info` % Test).withDottyCompat(scalaVersion.value) ), // The sources should be published with crossPaths := false since they // need to be compiled by the project using the bridge. @@ -893,7 +893,7 @@ object Build { buildInfoPackage in Test := "dotty.tools.languageserver.util.server", BuildInfoPlugin.buildInfoScopedSettings(Test), BuildInfoPlugin.buildInfoDefaultSettings - ).disablePlugins(ScriptedPlugin) + ) lazy val `dotty-bench` = project.in(file("bench")).asDottyBench(NonBootstrapped) lazy val `dotty-bench-bootstrapped` = project.in(file("bench")).asDottyBench(Bootstrapped) @@ -928,6 +928,7 @@ object Build { // sbt plugin to use Dotty in your own build, see // https://github.com/lampepfl/dotty-example-project for usage. lazy val `sbt-dotty` = project.in(file("sbt-dotty")). + enablePlugins(SbtPlugin). settings(commonSettings). settings( version := { @@ -938,11 +939,10 @@ object Build { // Keep in sync with inject-sbt-dotty.sbt libraryDependencies ++= Seq( Dependencies.`jackson-databind`, - Dependencies.compilerInterface(sbtVersion.value) + Dependencies.`compiler-interface` ), unmanagedSourceDirectories in Compile += baseDirectory.value / "../language-server/src/dotty/tools/languageserver/config", - sbtPlugin := true, sbtTestDirectory := baseDirectory.value / "sbt-test", scriptedLaunchOpts ++= Seq( "-Dplugin.version=" + version.value, @@ -1253,7 +1253,6 @@ object Build { // FIXME: we do not aggregate `bin` because its tests delete jars, thus breaking other tests def asDottyRoot(implicit mode: Mode): Project = project.withCommonSettings. - disablePlugins(ScriptedPlugin). aggregate(`dotty-interfaces`, dottyLibrary, dottyCompiler, dottyDoc, dottySbtBridgeReference). bootstrappedAggregate(`scala-library`, `scala-compiler`, `scala-reflect`, scalap, `dotty-language-server`). dependsOn(dottyCompiler). @@ -1263,13 +1262,11 @@ object Build { ) def asDottyCompiler(implicit mode: Mode): Project = project.withCommonSettings. - disablePlugins(ScriptedPlugin). dependsOn(`dotty-interfaces`). dependsOn(dottyLibrary). settings(dottyCompilerSettings) def asDottyLibrary(implicit mode: Mode): Project = project.withCommonSettings. - disablePlugins(ScriptedPlugin). settings(dottyLibrarySettings). bootstrappedSettings( // Needed so that the library sources are visible when `dotty.tools.dotc.core.Definitions#init` is called. @@ -1277,24 +1274,20 @@ object Build { ) def asDottyDoc(implicit mode: Mode): Project = project.withCommonSettings. - disablePlugins(ScriptedPlugin). dependsOn(dottyCompiler, dottyCompiler % "test->test"). settings(dottyDocSettings) def asDottySbtBridge(implicit mode: Mode): Project = project.withCommonSettings. - disablePlugins(ScriptedPlugin). dependsOn(dottyCompiler % Provided). dependsOn(dottyDoc % Provided). settings(dottySbtBridgeSettings) def asDottyBench(implicit mode: Mode): Project = project.withCommonSettings. - disablePlugins(ScriptedPlugin). dependsOn(dottyCompiler). settings(commonBenchmarkSettings). enablePlugins(JmhPlugin) def asDist(implicit mode: Mode): Project = project. - disablePlugins(ScriptedPlugin). enablePlugins(PackPlugin). withCommonSettings. dependsOn(`dotty-interfaces`, dottyCompiler, dottyLibrary, dottyDoc). diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 7e52dbc95bd3..bd835b00b2d9 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -10,6 +10,7 @@ object Dependencies { val `jackson-dataformat-yaml` = "com.fasterxml.jackson.dataformat" % "jackson-dataformat-yaml" % jacksonVersion - def compilerInterface(sbtVersion: String) = "org.scala-sbt" % "compiler-interface" % sbtVersion - def zincApiinfo(sbtVersion: String) = "org.scala-sbt" %% "zinc-apiinfo" % sbtVersion + private val zincVersion = "1.2.2" + val `compiler-interface` = "org.scala-sbt" % "compiler-interface" % zincVersion + val `zinc-api-info` = "org.scala-sbt" %% "zinc-apiinfo" % zincVersion } diff --git a/project/build.properties b/project/build.properties index d6e35076cc16..0cd8b07982e1 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.1.6 +sbt.version=1.2.3 diff --git a/project/inject-sbt-dotty.sbt b/project/inject-sbt-dotty.sbt index a73be671d462..d2962d3d901e 100644 --- a/project/inject-sbt-dotty.sbt +++ b/project/inject-sbt-dotty.sbt @@ -7,7 +7,7 @@ unmanagedSourceDirectories in Compile += baseDirectory.value / "../sbt-dotty/src // Keep in sync with `sbt-dotty` config in Build.scala libraryDependencies ++= Seq( Dependencies.`jackson-databind`, - Dependencies.compilerInterface(sbtVersion.value) + Dependencies.`compiler-interface` ) unmanagedSourceDirectories in Compile += baseDirectory.value / "../language-server/src/dotty/tools/languageserver/config" diff --git a/sbt-bridge/src/xsbt/DelegatingReporter.scala b/sbt-bridge/src/xsbt/DelegatingReporter.scala index 6ac533a9cb13..d97af019837d 100644 --- a/sbt-bridge/src/xsbt/DelegatingReporter.scala +++ b/sbt-bridge/src/xsbt/DelegatingReporter.scala @@ -29,7 +29,7 @@ final class DelegatingReporter(delegate: xsbti.Reporter) extends Reporter } val position = - if (false && cont.pos.exists) { // Disabled because it duplicates the information printed by Dotty + if (cont.pos.exists) { val pos = cont.pos val src = pos.source new Position { @@ -46,13 +46,14 @@ final class DelegatingReporter(delegate: xsbti.Reporter) extends Reporter } else noPosition - val sb = new StringBuilder() - sb.append(messageAndPos(cont.contained(), cont.pos, diagnosticLevel(cont))) - if (ctx.shouldExplain(cont) && cont.contained().explanation.nonEmpty) { - sb.append(explanation(cont.contained())) + val message = cont.contained() + val rendered = new StringBuilder() + rendered.append(messageAndPos(message, cont.pos, diagnosticLevel(cont))) + if (ctx.shouldExplain(cont) && message.explanation.nonEmpty) { + rendered.append(explanation(message)) } - delegate.log(Problem(position, sb.toString(), severity)) + delegate.log(Problem(position, message.msg, severity, rendered.toString)) } private[this] def maybe[T](opt: Option[T]): Optional[T] = opt match { diff --git a/sbt-bridge/src/xsbt/Problem.scala b/sbt-bridge/src/xsbt/Problem.scala index f92d8c284f89..991dbc2bf308 100644 --- a/sbt-bridge/src/xsbt/Problem.scala +++ b/sbt-bridge/src/xsbt/Problem.scala @@ -1,12 +1,12 @@ package xsbt +import java.util.Optional import xsbti.{Position, Severity} final case class Problem(override val position: Position, override val message: String, - override val severity: Severity) extends xsbti.Problem { + override val severity: Severity, + rendered0: String) extends xsbti.Problem { override val category = "" - override def toString = s"[$severity] $position: $message" - + override val rendered = Optional.of(rendered0) } -