Merge remote-tracking branch 'upstream/0.13' into 0.13

This commit is contained in:
David Perez 2015-03-25 16:12:54 +01:00
commit 4b5a3b785e
13 changed files with 137 additions and 23 deletions

View File

@ -12,7 +12,7 @@ import Sxr.sxr
// but can be shared across the multi projects.
def buildLevelSettings: Seq[Setting[_]] = Seq(
organization in ThisBuild := "org.scala-sbt",
version in ThisBuild := "0.13.8-SNAPSHOT"
version in ThisBuild := "0.13.9-SNAPSHOT"
)
def commonSettings: Seq[Setting[_]] = Seq(
@ -522,7 +522,7 @@ def otherRootSettings = Seq(
}
))
lazy val docProjects: ScopeFilter = ScopeFilter(
inAnyProject -- inProjects(root, sbtProj, scriptedBaseProj, scriptedSbtProj, scriptedPluginProj, precompiled282, precompiled292, precompiled293),
inAnyProject -- inProjects(root, sbtProj, scriptedBaseProj, scriptedSbtProj, scriptedPluginProj, precompiled282, precompiled292, precompiled293, mavenResolverPluginProj),
inConfigurations(Compile)
)
def fullDocSettings = Util.baseScalacOptions ++ Docs.settings ++ Sxr.settings ++ Seq(

View File

@ -149,9 +149,12 @@ class AggressiveCompile(cacheFile: File) {
// previous Analysis completely and start with empty Analysis object
// that supports the particular value of the `nameHashing` flag.
// Otherwise we'll be getting UnsupportedOperationExceptions
log.warn("Ignoring previous analysis due to incompatible nameHashing setting.")
Analysis.empty(currentSetup.nameHashing)
case Some(previous) if equiv.equiv(previous, currentSetup) => previousAnalysis
case _ => Incremental.prune(sourcesSet, previousAnalysis)
case _ =>
log.warn("Pruning sources from previous analysis, due to incompatible CompileSetup.")
Incremental.prune(sourcesSet, previousAnalysis)
}
IncrementalCompile(sourcesSet, entry, compile0, analysis, getAnalysis, output, log, incOptions)
}

View File

@ -109,13 +109,15 @@ class MakePom(val log: Logger) {
{
if (moduleInfo.developers.nonEmpty) {
<developers>
moduleInfo.developers.map{ developer: Developer =>
<developer>
<id>{ developer.id }</id>
<name>{ developer.name }</name>
<email>{ developer.email }</email>
<url>{ developer.url }</url>
</developer>
{
moduleInfo.developers.map { developer: Developer =>
<developer>
<id>{ developer.id }</id>
<name>{ developer.name }</name>
<email>{ developer.email }</email>
<url>{ developer.url }</url>
</developer>
}
}
</developers>
} else NodeSeq.Empty

View File

@ -0,0 +1,20 @@
package sbt
import scala.annotation.implicitNotFound
object Remove {
@implicitNotFound(msg = "No implicit for Remove.Value[${A}, ${B}] found,\n so ${B} cannot be removed from ${A}")
trait Value[A, B] extends Any {
def removeValue(a: A, b: B): A
}
@implicitNotFound(msg = "No implicit for Remove.Values[${A}, ${B}] found,\n so ${B} cannot be removed from ${A}")
trait Values[A, -B] extends Any {
def removeValues(a: A, b: B): A
}
sealed trait Sequence[A, -B, T] extends Value[A, T] with Values[A, B]
implicit def removeSeq[T, V <: T]: Sequence[Seq[T], Seq[V], V] = new Sequence[Seq[T], Seq[V], V] {
def removeValue(a: Seq[T], b: V): Seq[T] = a filterNot b.==
def removeValues(a: Seq[T], b: Seq[V]): Seq[T] = a diff b
}
}

View File

@ -42,13 +42,19 @@ sealed abstract class SettingKey[T] extends ScopedTaskable[T] with KeyedInitiali
final def ++=[U](vs: U)(implicit a: Append.Values[T, U]): Setting[T] = macro std.TaskMacro.settingAppendNImpl[T, U]
final def <+=[V](v: Initialize[V])(implicit a: Append.Value[T, V]): Setting[T] = macro std.TaskMacro.settingAppend1Position[T, V]
final def <++=[V](vs: Initialize[V])(implicit a: Append.Values[T, V]): Setting[T] = macro std.TaskMacro.settingAppendNPosition[T, V]
final def -=[U](v: U)(implicit r: Remove.Value[T, U]): Setting[T] = macro std.TaskMacro.settingRemove1Impl[T, U]
final def --=[U](vs: U)(implicit r: Remove.Values[T, U]): Setting[T] = macro std.TaskMacro.settingRemoveNImpl[T, U]
final def ~=(f: T => T): Setting[T] = macro std.TaskMacro.settingTransformPosition[T]
final def transform(f: T => T, source: SourcePosition): Setting[T] = set(scopedKey(f), source)
final def append1[V](v: Initialize[V], source: SourcePosition)(implicit a: Append.Value[T, V]): Setting[T] = make(v, source)(a.appendValue)
final def appendN[V](vs: Initialize[V], source: SourcePosition)(implicit a: Append.Values[T, V]): Setting[T] = make(vs, source)(a.appendValues)
protected[this] def make[S](other: Initialize[S], source: SourcePosition)(f: (T, S) => T): Setting[T] = this.set((this, other)(f), source)
final def remove1[V](v: Initialize[V], source: SourcePosition)(implicit r: Remove.Value[T, V]): Setting[T] = make(v, source)(r.removeValue)
final def removeN[V](vs: Initialize[V], source: SourcePosition)(implicit r: Remove.Values[T, V]): Setting[T] = make(vs, source)(r.removeValues)
final def transform(f: T => T, source: SourcePosition): Setting[T] = set(scopedKey(f), source)
protected[this] def make[S](other: Initialize[S], source: SourcePosition)(f: (T, S) => T): Setting[T] = set((this, other)(f), source)
}
/**
@ -67,10 +73,15 @@ sealed abstract class TaskKey[T] extends ScopedTaskable[T] with KeyedInitialize[
def ++=[U](vs: U)(implicit a: Append.Values[T, U]): Setting[Task[T]] = macro std.TaskMacro.taskAppendNImpl[T, U]
def <+=[V](v: Initialize[Task[V]])(implicit a: Append.Value[T, V]): Setting[Task[T]] = macro std.TaskMacro.taskAppend1Position[T, V]
def <++=[V](vs: Initialize[Task[V]])(implicit a: Append.Values[T, V]): Setting[Task[T]] = macro std.TaskMacro.taskAppendNPosition[T, V]
final def -=[U](v: U)(implicit r: Remove.Value[T, U]): Setting[Task[T]] = macro std.TaskMacro.taskRemove1Impl[T, U]
final def --=[U](vs: U)(implicit r: Remove.Values[T, U]): Setting[Task[T]] = macro std.TaskMacro.taskRemoveNImpl[T, U]
def append1[V](v: Initialize[Task[V]], source: SourcePosition)(implicit a: Append.Value[T, V]): Setting[Task[T]] = make(v, source)(a.appendValue)
def appendN[V](vs: Initialize[Task[V]], source: SourcePosition)(implicit a: Append.Values[T, V]): Setting[Task[T]] = make(vs, source)(a.appendValues)
final def remove1[V](v: Initialize[Task[V]], source: SourcePosition)(implicit r: Remove.Value[T, V]): Setting[Task[T]] = make(v, source)(r.removeValue)
final def removeN[V](vs: Initialize[Task[V]], source: SourcePosition)(implicit r: Remove.Values[T, V]): Setting[Task[T]] = make(vs, source)(r.removeValues)
private[this] def make[S](other: Initialize[Task[S]], source: SourcePosition)(f: (T, S) => T): Setting[Task[T]] =
set((this, other) { (a, b) => (a, b) map f.tupled }, source)
}

View File

@ -67,6 +67,8 @@ object TaskMacro {
final val AssignInitName = "set"
final val Append1InitName = "append1"
final val AppendNInitName = "appendN"
final val Remove1InitName = "remove1"
final val RemoveNInitName = "removeN"
final val TransformInitName = "transform"
final val InputTaskCreateDynName = "createDyn"
final val InputTaskCreateFreeName = "createFree"
@ -136,29 +138,58 @@ object TaskMacro {
def taskAppend1Impl[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Context)(v: c.Expr[U])(a: c.Expr[Append.Value[T, U]]): c.Expr[Setting[Task[T]]] =
{
val init = taskMacroImpl[U](c)(v)
val assign = appendMacroImpl(c)(init.tree, a.tree)(Append1InitName)
c.Expr[Setting[Task[T]]](assign)
val append = appendMacroImpl(c)(init.tree, a.tree)(Append1InitName)
c.Expr[Setting[Task[T]]](append)
}
/** Implementation of += macro for settings. */
def settingAppend1Impl[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Context)(v: c.Expr[U])(a: c.Expr[Append.Value[T, U]]): c.Expr[Setting[T]] =
{
val init = SettingMacro.settingMacroImpl[U](c)(v)
val assign = appendMacroImpl(c)(init.tree, a.tree)(Append1InitName)
c.Expr[Setting[T]](assign)
val append = appendMacroImpl(c)(init.tree, a.tree)(Append1InitName)
c.Expr[Setting[T]](append)
}
/** Implementation of ++= macro for tasks. */
def taskAppendNImpl[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Context)(vs: c.Expr[U])(a: c.Expr[Append.Values[T, U]]): c.Expr[Setting[Task[T]]] =
{
val init = taskMacroImpl[U](c)(vs)
val assign = appendMacroImpl(c)(init.tree, a.tree)(AppendNInitName)
c.Expr[Setting[Task[T]]](assign)
val append = appendMacroImpl(c)(init.tree, a.tree)(AppendNInitName)
c.Expr[Setting[Task[T]]](append)
}
/** Implementation of ++= macro for settings. */
def settingAppendNImpl[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Context)(vs: c.Expr[U])(a: c.Expr[Append.Values[T, U]]): c.Expr[Setting[T]] =
{
val init = SettingMacro.settingMacroImpl[U](c)(vs)
val assign = appendMacroImpl(c)(init.tree, a.tree)(AppendNInitName)
c.Expr[Setting[T]](assign)
val append = appendMacroImpl(c)(init.tree, a.tree)(AppendNInitName)
c.Expr[Setting[T]](append)
}
/** Implementation of -= macro for tasks. */
def taskRemove1Impl[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Context)(v: c.Expr[U])(r: c.Expr[Remove.Value[T, U]]): c.Expr[Setting[Task[T]]] =
{
val init = taskMacroImpl[U](c)(v)
val remove = removeMacroImpl(c)(init.tree, r.tree)(Remove1InitName)
c.Expr[Setting[Task[T]]](remove)
}
/** Implementation of -= macro for settings. */
def settingRemove1Impl[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Context)(v: c.Expr[U])(r: c.Expr[Remove.Value[T, U]]): c.Expr[Setting[T]] =
{
val init = SettingMacro.settingMacroImpl[U](c)(v)
val remove = removeMacroImpl(c)(init.tree, r.tree)(Remove1InitName)
c.Expr[Setting[T]](remove)
}
/** Implementation of --= macro for tasks. */
def taskRemoveNImpl[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Context)(vs: c.Expr[U])(r: c.Expr[Remove.Values[T, U]]): c.Expr[Setting[Task[T]]] =
{
val init = taskMacroImpl[U](c)(vs)
val remove = removeMacroImpl(c)(init.tree, r.tree)(RemoveNInitName)
c.Expr[Setting[Task[T]]](remove)
}
/** Implementation of --= macro for settings. */
def settingRemoveNImpl[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Context)(vs: c.Expr[U])(r: c.Expr[Remove.Values[T, U]]): c.Expr[Setting[T]] =
{
val init = SettingMacro.settingMacroImpl[U](c)(vs)
val remove = removeMacroImpl(c)(init.tree, r.tree)(RemoveNInitName)
c.Expr[Setting[T]](remove)
}
private[this] def appendMacroImpl(c: Context)(init: c.Tree, append: c.Tree)(newName: String): c.Tree =
@ -170,6 +201,15 @@ object TaskMacro {
case x => ContextUtil.unexpectedTree(x)
}
}
private[this] def removeMacroImpl(c: Context)(init: c.Tree, remove: c.Tree)(newName: String): c.Tree =
{
import c.universe.{ Apply, ApplyTag, newTermName, Select, SelectTag, TypeApply, TypeApplyTag }
c.macroApplication match {
case Apply(Apply(TypeApply(Select(preT, nmeT), targs), _), r) =>
Apply(Apply(TypeApply(Select(preT, newTermName(newName).encodedName), targs), init :: sourcePosition(c).tree :: Nil), r)
case x => ContextUtil.unexpectedTree(x)
}
}
private[this] def transformMacroImpl(c: Context)(init: c.Tree)(newName: String): c.Tree =
{
import c.universe.{ Apply, ApplyTag, newTermName, Select, SelectTag }

View File

@ -52,6 +52,7 @@
[1881]: https://github.com/sbt/sbt/issues/1881
[1899]: https://github.com/sbt/sbt/pull/1899
[1902]: https://github.com/sbt/sbt/pull/1902
[1921]: https://github.com/sbt/sbt/issues/1921
### Changes with compatibility implications
@ -135,6 +136,7 @@ This should help erase many of the deficiencies encountered when using Maven and
- sbt-maven-resolver requires sbt 0.13.8 and above.
- The current implementation does not support Ivy-style dynamic revisions, such as "2.10.+" or "latest.snapshot". This
is a fixable situation, but the version range query and Ivy -> Maven version range translation code has not been migrated.
- The current implementation does not support Maven-style range revisions if found on transitive dependencies. [#1921][1921]
[#1793][1793] by [@jsuereth][@jsuereth]

11
notes/0.13.9.markdown Normal file
View File

@ -0,0 +1,11 @@
[@dwijnand]: http://github.com/dwijnand
[1922]: https://github.com/sbt/sbt/pull/1922
### Fixes with compatibility implications
### Improvements
- Add `-=` and `--=` for settings and tasks, dual of `+=` and `++=`. [#1922][1922] by [@dwijnand][@dwijnand]
### Bug fixes

View File

@ -0,0 +1,24 @@
val intsTask = taskKey[Seq[Int]]("A seq of ints task")
val intsSetting = settingKey[Seq[Int]]("A seq of ints setting")
val intsFromScalaV = settingKey[Seq[Int]]("a seq of ints from scalaVersion")
scalaVersion := "2.11.6"
intsTask := Seq(1, 2, 3, 4, 5)
intsTask -= 3
intsTask --= Seq(1, 2)
intsSetting := Seq(1, 2, 3, 4, 5)
intsSetting -= 3
intsSetting --= Seq(1, 2)
intsFromScalaV := Seq(1, 2, 3, 4, 5)
intsFromScalaV -= { if (scalaVersion.value == "2.11.6") 3 else 5 }
intsFromScalaV --= { if (scalaVersion.value == "2.11.6") Seq(1, 2) else Seq(4) }
val check = taskKey[Unit]("Runs the check")
check := {
assert(intsTask.value == Seq(4, 5), s"intsTask should be Seq(4, 5) but is ${intsTask.value}")
assert(intsSetting.value == Seq(4, 5), s"intsSetting should be Seq(4, 5) but is ${intsSetting.value}")
assert(intsFromScalaV.value == Seq(4, 5), s"intsFromScalaV should be Seq(4, 5) but is ${intsFromScalaV.value}")
}

View File

@ -0,0 +1 @@
> check

View File

@ -4,7 +4,7 @@
[app]
org: ${sbt.organization-org.scala-sbt}
name: sbt
version: ${sbt.version-read(sbt.version)[0.13.7]}
version: ${sbt.version-read(sbt.version)[0.13.8]}
class: sbt.xMain
components: xsbti,extra
cross-versioned: ${sbt.cross.versioned-false}

View File

@ -4,7 +4,7 @@
[app]
org: ${sbt.organization-org.scala-sbt}
name: sbt
version: ${sbt.version-read(sbt.version)[0.13.7]}
version: ${sbt.version-read(sbt.version)[0.13.8]}
class: sbt.ScriptMain
components: xsbti,extra
cross-versioned: ${sbt.cross.versioned-false}

View File

@ -4,7 +4,7 @@
[app]
org: ${sbt.organization-org.scala-sbt}
name: sbt
version: ${sbt.version-read(sbt.version)[0.13.7]}
version: ${sbt.version-read(sbt.version)[0.13.8]}
class: sbt.ConsoleMain
components: xsbti,extra
cross-versioned: ${sbt.cross.versioned-false}