mirror of https://github.com/sbt/sbt.git
Add escape hatch to old parser in case we run into problems.
Just make sure users have the means to still build in case there's any issues we missed. This code should be removed in sbt 1.0.
This commit is contained in:
parent
32954a959a
commit
89a3e4982f
|
|
@ -212,16 +212,23 @@ object EvaluateConfigurations {
|
|||
private[this] def fstS(f: String => Boolean): ((String, Int)) => Boolean = { case (s, i) => f(s) }
|
||||
private[this] def firstNonSpaceIs(lit: String) = (_: String).view.dropWhile(isSpace).startsWith(lit)
|
||||
private[this] def or[A](a: A => Boolean, b: A => Boolean): A => Boolean = in => a(in) || b(in)
|
||||
|
||||
/** Configures the use of the old sbt parser. */
|
||||
private[sbt] def useOldParser: Boolean =
|
||||
sys.props.get("sbt.parser.simple").map(java.lang.Boolean.parseBoolean).getOrElse(false)
|
||||
/**
|
||||
* Splits a set of lines into (imports, expressions). That is,
|
||||
* anything on the right of the tuple is a scala expression (definition or setting).
|
||||
*/
|
||||
private[sbt] def splitExpressions(file: File, lines: Seq[String]): (Seq[(String, Int)], Seq[(String, LineRange)]) =
|
||||
{
|
||||
val split = SbtParser(file, lines)
|
||||
// TODO - Look at pulling the parsed expression trees from the SbtParser and stitch them back into a different
|
||||
// scala compiler rather than re-parsing.
|
||||
(split.imports, split.settings)
|
||||
if (useOldParser) splitExpressions(lines)
|
||||
else {
|
||||
val split = SbtParser(file, lines)
|
||||
// TODO - Look at pulling the parsed expression trees from the SbtParser and stitch them back into a different
|
||||
// scala compiler rather than re-parsing.
|
||||
(split.imports, split.settings)
|
||||
}
|
||||
}
|
||||
|
||||
@deprecated("This method is no longer part of the public API.", "0.13.7")
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@
|
|||
|
||||
Starting sbt 0.13.7, build.sbt will be parsed using a customized Scala parser. This eliminates the requirement to use blank line as the delimiter between each settings, and also allows blank lines to be inserted at arbitrary position within a block.
|
||||
|
||||
This feature can be disabled, if necessary, via the -Dsbt.parser.simple=true flag.
|
||||
|
||||
This feature was contributed by [Andrzej Jozwik (@ajozwik)](https://github.com/ajozwik), [Rafał Krzewski (@rkrzewski)][@rkrzewski] and others at [@WarsawScala][@WarsawScala] inspired by Typesafe's [@gkossakowski][@gkossakowski] organizing multiple [meetups](http://blog.japila.pl/2014/07/gkossakowski-on-warszawscala-about-how-to-patch-scalasbt/) and [hackathons](http://blog.japila.pl/2014/07/hacking-scalasbt-with-gkossakowski-on-warszawscala-meetup-in-javeo_eu/) on how to patch sbt with the focus on this blank line issue. Dziękujemy! [#1606][1606]
|
||||
|
||||
### Custom Maven local repository location
|
||||
|
|
|
|||
Loading…
Reference in New Issue