Merge pull request #4357 from eed3si9n/fport/rangepos

[fport] Follow up on Position extension
This commit is contained in:
eugene yokota 2018-09-14 04:58:02 -04:00 committed by GitHub
commit 54f5a67c33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 28 deletions

View File

@ -27,12 +27,12 @@ import sbt.util.Tracked.{ inputChanged, outputChanged }
sealed trait PackageOption sealed trait PackageOption
/** /**
* == Package == * == Package ==
* *
* This module provides an API to package jar files. * This module provides an API to package jar files.
* *
* @see [[https://docs.oracle.com/javase/tutorial/deployment/jar/index.html]] * @see [[https://docs.oracle.com/javase/tutorial/deployment/jar/index.html]]
*/ */
object Package { object Package {
final case class JarManifest(m: Manifest) extends PackageOption { final case class JarManifest(m: Manifest) extends PackageOption {
assert(m != null) assert(m != null)
@ -58,12 +58,12 @@ object Package {
} }
/** /**
* The jar package configuration. Contains all relevant information to create a jar file. * The jar package configuration. Contains all relevant information to create a jar file.
* *
* @param sources the jar contents * @param sources the jar contents
* @param jar the destination jar file * @param jar the destination jar file
* @param options additional package information, e.g. jar manifest, main class or manifest attributes * @param options additional package information, e.g. jar manifest, main class or manifest attributes
*/ */
final class Configuration( final class Configuration(
val sources: Seq[(File, String)], val sources: Seq[(File, String)],
val jar: File, val jar: File,
@ -71,11 +71,11 @@ object Package {
) )
/** /**
* *
* @param conf the package configuration that should be build * @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 cacheStoreFactory used for jar caching. We try to avoid rebuilds as much as possible
* @param log feedback for the user * @param log feedback for the user
*/ */
def apply(conf: Configuration, cacheStoreFactory: CacheStoreFactory, log: Logger): Unit = { def apply(conf: Configuration, cacheStoreFactory: CacheStoreFactory, log: Logger): Unit = {
val manifest = new Manifest val manifest = new Manifest
val main = manifest.getMainAttributes val main = manifest.getMainAttributes
@ -109,10 +109,10 @@ object Package {
} }
/** /**
* updates the manifest version is there is none present. * updates the manifest version is there is none present.
* *
* @param main the current jar attributes * @param main the current jar attributes
*/ */
def setVersion(main: Attributes): Unit = { def setVersion(main: Attributes): Unit = {
val version = Attributes.Name.MANIFEST_VERSION val version = Attributes.Name.MANIFEST_VERSION
if (main.getValue(version) eq null) { if (main.getValue(version) eq null) {

View File

@ -824,7 +824,7 @@ object BuiltinCommands {
if (version != app.id.version()) { if (version != app.id.version()) {
state.log.warn(s"""sbt version mismatch, current: ${app.id state.log.warn(s"""sbt version mismatch, current: ${app.id
.version()}, in build.properties: "$version", use 'reboot' to use the new value.""") .version()}, in build.properties: "$version", use 'reboot' to use the new value.""")
} }
) )
} }

View File

@ -111,8 +111,19 @@ class LanguageServerReporter(
} yield { } yield {
val line = line0.toLong - 1L val line = line0.toLong - 1L
val pointer = pointer0.toLong 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( Diagnostic(
Range(start = Position(line, pointer), end = Position(line, pointer + 1)), r,
Option(toDiagnosticSeverity(problem.severity)), Option(toDiagnosticSeverity(problem.severity)),
None, None,
Option("sbt"), Option("sbt"),

View File

@ -9,9 +9,9 @@ object Dependencies {
// sbt modules // sbt modules
private val ioVersion = "1.2.1" private val ioVersion = "1.2.1"
private val utilVersion = "1.2.0" private val utilVersion = "1.2.2"
private val lmVersion = "1.2.0" private val lmVersion = "1.2.1"
private val zincVersion = "1.2.1" private val zincVersion = "1.2.2"
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion private val sbtIO = "org.scala-sbt" %% "io" % ioVersion

View File

@ -226,8 +226,10 @@ class JUnitXmlTestsListener(val outputDir: String, logger: Logger) extends Tests
d.truncatedTo(ChronoUnit.SECONDS).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME) d.truncatedTo(ChronoUnit.SECONDS).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
private def writeSuite() = { private def writeSuite() = {
val legacyFile = new File(targetDir, s"${normalizeName(withTestSuite(_.name))}.xml").getAbsolutePath val legacyFile =
val file = new File(targetDir, s"TEST-${normalizeName(withTestSuite(_.name))}.xml").getAbsolutePath 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 // TODO would be nice to have a logger and log this with level debug
// System.err.println("Writing JUnit XML test report: " + file) // System.err.println("Writing JUnit XML test report: " + file)
XML.save(legacyFile, withTestSuite(_.stop()), "UTF-8", true, null) XML.save(legacyFile, withTestSuite(_.stop()), "UTF-8", true, null)