mirror of https://github.com/sbt/sbt.git
Use linesIterator for JDK 11 compat
This commit is contained in:
parent
4e00a3e9f0
commit
cd7a5c6f6b
|
|
@ -27,7 +27,7 @@ final class InputTask[T] private (val parser: State => Parser[Task[T]]) {
|
|||
Parser.parse(in, parser(s)) match {
|
||||
case Right(v) => Parser.success(v)
|
||||
case Left(msg) =>
|
||||
val indented = msg.lines.map(" " + _).mkString("\n")
|
||||
val indented = msg.linesIterator.map(" " + _).mkString("\n")
|
||||
Parser.failure(s"Invalid programmatic input:\n$indented")
|
||||
}
|
||||
)
|
||||
|
|
@ -47,7 +47,7 @@ object InputTask {
|
|||
Parser.parse(in, it.parser(s)) match {
|
||||
case Right(t) => Def.value(t)
|
||||
case Left(msg) =>
|
||||
val indented = msg.lines.map(" " + _).mkString("\n")
|
||||
val indented = msg.linesIterator.map(" " + _).mkString("\n")
|
||||
sys.error(s"Invalid programmatic input:\n$indented")
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ private[sbt] object LibraryManagement {
|
|||
val culprit = t.getClass.getSimpleName
|
||||
log.warn(s"Update task caching failed due to $culprit.")
|
||||
log.warn("Report the following output to sbt:")
|
||||
resolvedAgain.toString.lines.foreach(log.warn(_))
|
||||
resolvedAgain.toString.linesIterator.foreach(log.warn(_))
|
||||
log.trace(t)
|
||||
resolvedAgain
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ private[sbt] object SbtRefactorings {
|
|||
val sortedRecordedCommands = recordedCommands.sortBy(_._1)(reverseOrderingInt)
|
||||
|
||||
val newContent = replaceFromBottomToTop(lines.mkString(END_OF_LINE), sortedRecordedCommands)
|
||||
(file, newContent.lines.toList)
|
||||
(file, newContent.linesIterator.toList)
|
||||
}
|
||||
|
||||
private def replaceFromBottomToTop(
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class EmbeddedXmlSpec extends CheckIfParsedSpec {
|
|||
|
||||
split(buildSbt) must throwA[MessageOnlyException].like {
|
||||
case exception =>
|
||||
val index = buildSbt.lines.indexWhere(line => line.contains(errorLine)) + 1
|
||||
val index = buildSbt.linesIterator.indexWhere(line => line.contains(errorLine)) + 1
|
||||
val numberRegex = """(\d+)""".r
|
||||
val message = exception.getMessage
|
||||
val list = numberRegex.findAllIn(message).toList
|
||||
|
|
|
|||
|
|
@ -10,9 +10,7 @@ package internal
|
|||
package parser
|
||||
|
||||
import java.io.File
|
||||
|
||||
import sbt.internal.util.MessageOnlyException
|
||||
|
||||
import scala.io.Source
|
||||
|
||||
class ErrorSpec extends AbstractSpec {
|
||||
|
|
@ -26,7 +24,8 @@ class ErrorSpec extends AbstractSpec {
|
|||
foreach(new File(rootPath).listFiles) { file =>
|
||||
print(s"Processing ${file.getName}: ")
|
||||
val buildSbt = Source.fromFile(file).getLines().mkString("\n")
|
||||
SbtParser(file, buildSbt.lines.toSeq) must throwA[MessageOnlyException].like {
|
||||
SbtParser(file, buildSbt.linesIterator.toSeq) must throwA[MessageOnlyException]
|
||||
.like {
|
||||
case exp =>
|
||||
val message = exp.getMessage
|
||||
println(s"${exp.getMessage}")
|
||||
|
|
@ -60,7 +59,9 @@ class ErrorSpec extends AbstractSpec {
|
|||
|val a = <a/><b/>
|
||||
|val s = '
|
||||
""".stripMargin
|
||||
SbtParser(SbtParser.FAKE_FILE, buildSbt.lines.toSeq) must throwA[MessageOnlyException].like {
|
||||
SbtParser(SbtParser.FAKE_FILE, buildSbt.linesIterator.toSeq) must throwA[
|
||||
MessageOnlyException
|
||||
].like {
|
||||
case exp =>
|
||||
val message = exp.getMessage
|
||||
println(s"${exp.getMessage}")
|
||||
|
|
|
|||
Loading…
Reference in New Issue