harrah/xsbt — pull request #267 by indrajitr (2011-11-12 08:39:24+00:00)
Title: Support for enhanced cross build suffix in dependencies

Although `%%` is very handy in having the cross build suffix appended to the artifact name, oftentimes it gets less useful because the `scalaVersion` used for the build might not be the same as that one to be appended. This is more of compulsion than violation in two prevalent cases:

* Building app on a version of scala which has a library dependency that isn't available for the same version (many of the libraries never came out with a build for scala 2.8.2, although the 2.8.1 build exists, ditto was the case for 2.9.0-1)
* Trying out snapshot builds of scala (building on scala 2.10.0-SNAPSHOT would still require a stable library dependency built for 2.9.1)

In these cases, library dependencies are not guaranteed to be binary compatible (but the developer hopes that they are).

This patch is a _proof of concept_ that allows appending a `Function1` or a var arg of `Pairs` as so:

```scala
def crossSuffix(s: String) = s match {
case "2.10-SNAPSHOT" => "2.9.1"
case "2.8.2" => "2.8.1"
case x => x
}

// the default status quo, nothing changes for regular users
lazy val myLib = "org.foo" %% "mylib" % "1.2"

// power users can append a `Function1[String,String]`
lazy val myLib = "org.foo" %% ("mylib", crossSuffix) % "1.2"

// power users can also append a set of `(String,String)` pairs
lazy val myLib = "org.foo" %% ("mylib", "2.10-SNAPSHOT" -> "2.9.1", "2.8.2" => "2.8.1") % "1.2"
```
A few points:

* Would you be okay with modifying the `%%` signature, or do you think this could be done in other ways?
* I am tempted to feel that just having `(String,String)*` should be sufficient in most cases, and in fact, simpler. But just kept `String=>String` for more complicated cases. I can remove the `String=>String` if to avoid bloat if you want
* Should we handle this for ModuleID in `CacheIvy` too? I suspect we should. How can I have `Format[Function1]`?

Thoughts?