diff --git a/internal/util-collection/src/main/scala/sbt/internal/util/Settings.scala b/internal/util-collection/src/main/scala/sbt/internal/util/Settings.scala index ed23e377a..97117e2dc 100644 --- a/internal/util-collection/src/main/scala/sbt/internal/util/Settings.scala +++ b/internal/util-collection/src/main/scala/sbt/internal/util/Settings.scala @@ -87,9 +87,6 @@ trait Init[Scope] { */ private[sbt] final def validated[T](key: ScopedKey[T], selfRefOk: Boolean): ValidationCapture[T] = new ValidationCapture(key, selfRefOk) - @deprecated("Use the version with default arguments and default parameter.", "0.13.7") - final def derive[T](s: Setting[T], allowDynamic: Boolean, filter: Scope => Boolean, trigger: AttributeKey[_] => Boolean): Setting[T] = - derive(s, allowDynamic, filter, trigger, false) /** * Constructs a derived setting that will be automatically defined in every scope where one of its dependencies * is explicitly defined and the where the scope matches `filter`. @@ -101,10 +98,12 @@ trait Init[Scope] { val d = new DerivedSetting[T](s.key, s.init, s.pos, filter, trigger) if (default) d.default() else d } + def deriveAllowed[T](s: Setting[T], allowDynamic: Boolean): Option[String] = s.init match { case _: Bind[_, _] if !allowDynamic => Some("Cannot derive from dynamic dependencies.") case _ => None } + // id is used for equality private[sbt] final def defaultSetting[T](s: Setting[T]): Setting[T] = s.default() private[sbt] def defaultSettings(ss: Seq[Setting[_]]): Seq[Setting[_]] = ss.map(s => defaultSetting(s)) @@ -238,14 +237,7 @@ trait Init[Scope] { } final class Uninitialized(val undefined: Seq[Undefined], override val toString: String) extends Exception(toString) - final class Undefined private[sbt] (val defining: Setting[_], val referencedKey: ScopedKey[_]) { - @deprecated("For compatibility only, use `defining` directly.", "0.13.1") - val definingKey = defining.key - @deprecated("For compatibility only, use `defining` directly.", "0.13.1") - val derived: Boolean = defining.isDerived - @deprecated("Use the non-deprecated Undefined factory method.", "0.13.1") - def this(definingKey: ScopedKey[_], referencedKey: ScopedKey[_], derived: Boolean) = this(fakeUndefinedSetting(definingKey, derived), referencedKey) - } + final class Undefined private[sbt] (val defining: Setting[_], val referencedKey: ScopedKey[_]) final class RuntimeUndefined(val undefined: Seq[Undefined]) extends RuntimeException("References to undefined settings at runtime.") { override def getMessage = super.getMessage + undefined.map { u => @@ -253,15 +245,6 @@ trait Init[Scope] { }.mkString } - @deprecated("Use the other overload.", "0.13.1") - def Undefined(definingKey: ScopedKey[_], referencedKey: ScopedKey[_], derived: Boolean): Undefined = - new Undefined(fakeUndefinedSetting(definingKey, derived), referencedKey) - private[this] def fakeUndefinedSetting[T](definingKey: ScopedKey[T], d: Boolean): Setting[T] = - { - val init: Initialize[T] = pure(() => sys.error("Dummy setting for compatibility only.")) - new Setting(definingKey, init, NoPosition) { override def isDerived = d } - } - def Undefined(defining: Setting[_], referencedKey: ScopedKey[_]): Undefined = new Undefined(defining, referencedKey) def Uninitialized(validKeys: Seq[ScopedKey[_]], delegates: Scope => Seq[Scope], keys: Seq[Undefined], runtime: Boolean)(implicit display: Show[ScopedKey[_]]): Uninitialized = { diff --git a/internal/util-collection/src/main/scala/sbt/internal/util/Util.scala b/internal/util-collection/src/main/scala/sbt/internal/util/Util.scala index 4f82cae9c..75b8224c1 100644 --- a/internal/util-collection/src/main/scala/sbt/internal/util/Util.scala +++ b/internal/util-collection/src/main/scala/sbt/internal/util/Util.scala @@ -25,18 +25,16 @@ object Util { def pairID[A, B] = (a: A, b: B) => (a, b) - private[this] lazy val Hypen = """-(\p{javaLowerCase})""".r + private[this] lazy val Hyphen = """-(\p{javaLowerCase})""".r + def hasHyphen(s: String): Boolean = s.indexOf('-') >= 0 - @deprecated("Use the properly spelled version: hyphenToCamel", "0.13.0") - def hypenToCamel(s: String): String = hyphenToCamel(s) + def hyphenToCamel(s: String): String = - if (hasHyphen(s)) - Hypen.replaceAllIn(s, _.group(1).toUpperCase(Locale.ENGLISH)) - else - s + if (hasHyphen(s)) Hyphen.replaceAllIn(s, _.group(1).toUpperCase(Locale.ENGLISH)) else s private[this] lazy val Camel = """(\p{javaLowerCase})(\p{javaUpperCase})""".r - def camelToHypen(s: String): String = + + def camelToHyphen(s: String): String = Camel.replaceAllIn(s, m => m.group(1) + "-" + m.group(2).toLowerCase(Locale.ENGLISH)) def quoteIfKeyword(s: String): String = if (ScalaKeywords.values(s)) '`' + s + '`' else s diff --git a/internal/util-complete/src/main/scala/sbt/internal/util/complete/Completions.scala b/internal/util-complete/src/main/scala/sbt/internal/util/complete/Completions.scala index c035f3620..47dbb3b4f 100644 --- a/internal/util-complete/src/main/scala/sbt/internal/util/complete/Completions.scala +++ b/internal/util-complete/src/main/scala/sbt/internal/util/complete/Completions.scala @@ -82,8 +82,6 @@ final class DisplayOnly(val display: String) extends Completion { override def toString = "{" + display + "}" } final class Token(val display: String, val append: String) extends Completion { - @deprecated("Retained only for compatibility. All information is now in `display` and `append`.", "0.12.1") - lazy val prepend = display.stripSuffix(append) def isEmpty = display.isEmpty && append.isEmpty override final def toString = "[" + display + "]++" + append } @@ -127,19 +125,13 @@ object Completion { // TODO: make strict in 0.13.0 to match DisplayOnly def displayOnly(value: => String): Completion = new DisplayOnly(value) - @deprecated("Use displayOnly.", "0.12.1") - def displayStrict(value: String): Completion = displayOnly(value) // TODO: make strict in 0.13.0 to match Token def token(prepend: => String, append: => String): Completion = new Token(prepend + append, append) - @deprecated("Use token.", "0.12.1") - def tokenStrict(prepend: String, append: String): Completion = token(prepend, append) /** @since 0.12.1 */ def tokenDisplay(append: String, display: String): Completion = new Token(display, append) // TODO: make strict in 0.13.0 to match Suggestion def suggestion(value: => String): Completion = new Suggestion(value) - @deprecated("Use suggestion.", "0.12.1") - def suggestStrict(value: String): Completion = suggestion(value) -} \ No newline at end of file +} diff --git a/internal/util-complete/src/main/scala/sbt/internal/util/complete/Parser.scala b/internal/util-complete/src/main/scala/sbt/internal/util/complete/Parser.scala index 0e12fd28a..67651bfbd 100644 --- a/internal/util-complete/src/main/scala/sbt/internal/util/complete/Parser.scala +++ b/internal/util-complete/src/main/scala/sbt/internal/util/complete/Parser.scala @@ -79,18 +79,12 @@ sealed trait RichParser[A] { */ def failOnException: Parser[A] - @deprecated("Use `not` and explicitly provide the failure message", "0.12.2") - def unary_- : Parser[Unit] - /** * Apply the original parser, but only succeed if `o` also succeeds. * Note that `o` does not need to consume the same amount of input to satisfy this condition. */ def &(o: Parser[_]): Parser[A] - @deprecated("Use `and` and `not` and explicitly provide the failure message", "0.12.2") - def -(o: Parser[_]): Parser[A] - /** Explicitly defines the completions for the original Parser.*/ def examples(s: String*): Parser[A] @@ -188,12 +182,6 @@ object Parser extends ParserMain { def mkFailures(errors: => Seq[String], definitive: Boolean = false): Failure = new Failure(errors.distinct, definitive) def mkFailure(error: => String, definitive: Boolean = false): Failure = new Failure(error :: Nil, definitive) - @deprecated("This method is deprecated and will be removed in the next major version. Use the parser directly to check for invalid completions.", since = "0.13.2") - def checkMatches(a: Parser[_], completions: Seq[String]): Unit = { - val bad = completions.filter(apply(a)(_).resultEmpty.isFailure) - if (bad.nonEmpty) sys.error("Invalid example completions: " + bad.mkString("'", "', '", "'")) - } - def tuple[A, B](a: Option[A], b: Option[B]): Option[(A, B)] = (a, b) match { case (Some(av), Some(bv)) => Some((av, bv)); case _ => None } @@ -280,9 +268,6 @@ object Parser extends ParserMain { } } - @deprecated("Explicitly call `and` and `not` to provide the failure message.", "0.12.2") - def sub[T](a: Parser[T], b: Parser[_]): Parser[T] = and(a, not(b)) - def and[T](a: Parser[T], b: Parser[_]): Parser[T] = a.ifValid(b.ifValid(new And(a, b))) } trait ParserMain { @@ -527,13 +512,6 @@ trait ParserMain { def token[T](t: Parser[T], complete: TokenCompletions): Parser[T] = mkToken(t, "", complete) - @deprecated("Use a different `token` overload.", "0.12.1") - def token[T](t: Parser[T], seen: String, track: Boolean, hide: Int => Boolean): Parser[T] = - { - val base = if (track) TokenCompletions.default else TokenCompletions.displayOnly(seen) - token(t, base.hideWhen(hide)) - } - private[sbt] def mkToken[T](t: Parser[T], seen: String, complete: TokenCompletions): Parser[T] = if (t.valid && !t.isTokenStart) if (t.result.isEmpty) new TokenStart(t, seen, complete) else t @@ -547,9 +525,6 @@ trait ParserMain { case (av, bv) => new HomParser(a, b) } - @deprecated("Explicitly specify the failure message.", "0.12.2") - def not(p: Parser[_]): Parser[Unit] = not(p, "Excluded.") - def not(p: Parser[_], failMessage: String): Parser[Unit] = p.result match { case None => new Not(p, failMessage) case Some(_) => failure(failMessage)