From f3424e265cc5dfadc6f4ba61908ce3eedfeeffa8 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 14 Sep 2018 00:59:01 -0400 Subject: [PATCH 1/3] Formatting --- main-actions/src/main/scala/sbt/Package.scala | 42 +++++++++---------- main/src/main/scala/sbt/Main.scala | 2 +- .../scala/sbt/JUnitXmlTestsListener.scala | 6 ++- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/main-actions/src/main/scala/sbt/Package.scala b/main-actions/src/main/scala/sbt/Package.scala index e9735ce10..473a3ae57 100644 --- a/main-actions/src/main/scala/sbt/Package.scala +++ b/main-actions/src/main/scala/sbt/Package.scala @@ -27,12 +27,12 @@ import sbt.util.Tracked.{ inputChanged, outputChanged } sealed trait PackageOption /** - * == Package == - * - * This module provides an API to package jar files. - * - * @see [[https://docs.oracle.com/javase/tutorial/deployment/jar/index.html]] - */ + * == Package == + * + * This module provides an API to package jar files. + * + * @see [[https://docs.oracle.com/javase/tutorial/deployment/jar/index.html]] + */ object Package { final case class JarManifest(m: Manifest) extends PackageOption { assert(m != null) @@ -58,12 +58,12 @@ object Package { } /** - * The jar package configuration. Contains all relevant information to create a jar file. - * - * @param sources the jar contents - * @param jar the destination jar file - * @param options additional package information, e.g. jar manifest, main class or manifest attributes - */ + * The jar package configuration. Contains all relevant information to create a jar file. + * + * @param sources the jar contents + * @param jar the destination jar file + * @param options additional package information, e.g. jar manifest, main class or manifest attributes + */ final class Configuration( val sources: Seq[(File, String)], val jar: File, @@ -71,11 +71,11 @@ object Package { ) /** - * - * @param conf the package configuration that should be build - * @param cacheStoreFactory used for jar caching. We try to avoid rebuilds as much as possible - * @param log feedback for the user - */ + * + * @param conf the package configuration that should be build + * @param cacheStoreFactory used for jar caching. We try to avoid rebuilds as much as possible + * @param log feedback for the user + */ def apply(conf: Configuration, cacheStoreFactory: CacheStoreFactory, log: Logger): Unit = { val manifest = new Manifest val main = manifest.getMainAttributes @@ -109,10 +109,10 @@ object Package { } /** - * updates the manifest version is there is none present. - * - * @param main the current jar attributes - */ + * updates the manifest version is there is none present. + * + * @param main the current jar attributes + */ def setVersion(main: Attributes): Unit = { val version = Attributes.Name.MANIFEST_VERSION if (main.getValue(version) eq null) { diff --git a/main/src/main/scala/sbt/Main.scala b/main/src/main/scala/sbt/Main.scala index c2c523475..b684ff20b 100644 --- a/main/src/main/scala/sbt/Main.scala +++ b/main/src/main/scala/sbt/Main.scala @@ -824,7 +824,7 @@ object BuiltinCommands { if (version != app.id.version()) { state.log.warn(s"""sbt version mismatch, current: ${app.id .version()}, in build.properties: "$version", use 'reboot' to use the new value.""") - } + } ) } diff --git a/testing/src/main/scala/sbt/JUnitXmlTestsListener.scala b/testing/src/main/scala/sbt/JUnitXmlTestsListener.scala index 41ab2c5a7..731ab2211 100644 --- a/testing/src/main/scala/sbt/JUnitXmlTestsListener.scala +++ b/testing/src/main/scala/sbt/JUnitXmlTestsListener.scala @@ -226,8 +226,10 @@ class JUnitXmlTestsListener(val outputDir: String, logger: Logger) extends Tests d.truncatedTo(ChronoUnit.SECONDS).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME) private def writeSuite() = { - val legacyFile = new File(targetDir, s"${normalizeName(withTestSuite(_.name))}.xml").getAbsolutePath - val file = new File(targetDir, s"TEST-${normalizeName(withTestSuite(_.name))}.xml").getAbsolutePath + val legacyFile = + new File(targetDir, s"${normalizeName(withTestSuite(_.name))}.xml").getAbsolutePath + val file = + new File(targetDir, s"TEST-${normalizeName(withTestSuite(_.name))}.xml").getAbsolutePath // TODO would be nice to have a logger and log this with level debug // System.err.println("Writing JUnit XML test report: " + file) XML.save(legacyFile, withTestSuite(_.stop()), "UTF-8", true, null) From 426c31ae53eb1058c4ac3c8fead0e80087c92796 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 14 Sep 2018 00:02:02 -0400 Subject: [PATCH 2/3] Follow up on Position extension https://github.com/sbt/util/pull/173 added the ability to carry range position. This exposes it to the sbt server. --- .../internal/server/LanguageServerReporter.scala | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/main/src/main/scala/sbt/internal/server/LanguageServerReporter.scala b/main/src/main/scala/sbt/internal/server/LanguageServerReporter.scala index 28551be7c..644e01024 100644 --- a/main/src/main/scala/sbt/internal/server/LanguageServerReporter.scala +++ b/main/src/main/scala/sbt/internal/server/LanguageServerReporter.scala @@ -111,8 +111,19 @@ class LanguageServerReporter( } yield { val line = line0.toLong - 1L val pointer = pointer0.toLong + val r = ( + pos.startLine.toOption, + pos.startColumn.toOption, + pos.endLine.toOption, + pos.endColumn.toOption + ) match { + case (Some(sl), Some(sc), Some(el), Some(ec)) => + Range(Position(sl.toLong - 1, sc.toLong), Position(el.toLong - 1, ec.toLong)) + case _ => + Range(Position(line, pointer), Position(line, pointer + 1)) + } Diagnostic( - Range(start = Position(line, pointer), end = Position(line, pointer + 1)), + r, Option(toDiagnosticSeverity(problem.severity)), None, Option("sbt"), From 45c857d152171b7c459d8e2266e605adced01508 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 13 Sep 2018 14:26:16 -0400 Subject: [PATCH 3/3] Bump modules --- project/Dependencies.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index ca205d673..678b6b59b 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -9,9 +9,9 @@ object Dependencies { // sbt modules private val ioVersion = "1.2.1" - private val utilVersion = "1.2.0" - private val lmVersion = "1.2.0" - private val zincVersion = "1.2.1" + private val utilVersion = "1.2.2" + private val lmVersion = "1.2.1" + private val zincVersion = "1.2.2" private val sbtIO = "org.scala-sbt" %% "io" % ioVersion