use 'scalaVersion in update' for cross building, IvyScala.substituteCross for generality. fixes #86

also, 'scalaVersion in artifactName` for the version to append to artifacts
This commit is contained in:
Mark Harrah 2011-07-17 11:26:27 -04:00
parent eedc93c423
commit c766412885
2 changed files with 6 additions and 8 deletions

View File

@ -290,11 +290,11 @@ private object IvySbt
}
private def substituteCross(m: ModuleSettings): ModuleSettings =
m.ivyScala match { case None => m; case Some(is) => substituteCross(m, is.scalaVersion) }
private def substituteCross(m: ModuleSettings, cross: String): ModuleSettings =
m.ivyScala match { case None => m; case Some(is) => substituteCross(m, is.substituteCross) }
private def substituteCross(m: ModuleSettings, sub: ModuleID => ModuleID): ModuleSettings =
m match {
case ec: EmptyConfiguration => ec.copy(module = substituteCross(ec.module, cross))
case ic: InlineConfiguration => ic.copy(module = substituteCross(ic.module, cross), dependencies = substituteCrossM(ic.dependencies, cross))
case ec: EmptyConfiguration => ec.copy(module = sub(ec.module))
case ic: InlineConfiguration => ic.copy(module = sub(ic.module), dependencies = ic.dependencies map sub)
case _ => m
}
def crossName(name: String, cross: String): String =
@ -303,8 +303,6 @@ private object IvySbt
a.copy(name = crossName(a.name, cross))
def substituteCrossA(as: Seq[Artifact], cross: String): Seq[Artifact] =
as.map(art => substituteCross(art, cross))
def substituteCrossM(ms: Seq[ModuleID], cross: String): Seq[ModuleID] =
ms.map(m => substituteCross(m, cross))
def substituteCross(m: ModuleID, cross: String): ModuleID =
if(m.crossVersion)
m.copy(name = crossName(m.name, cross), explicitArtifacts = substituteCrossA(m.explicitArtifacts, cross))

View File

@ -22,10 +22,10 @@ object ScalaArtifacts
import ScalaArtifacts._
final case class IvyScala(scalaVersion: String, configurations: Iterable[Configuration], checkExplicit: Boolean, filterImplicit: Boolean, overrideScalaVersion: Boolean)
final case class IvyScala(scalaVersion: String, configurations: Iterable[Configuration], checkExplicit: Boolean, filterImplicit: Boolean, overrideScalaVersion: Boolean, substituteCross: ModuleID => ModuleID)
{
// otherwise, Ivy produces the error: "impossible to get artifacts when data has not been loaded"
// which may be related to sbt's custom conflict manager, to IVY-987, or both
// which may be related to sbt's custom conflict manager (now removed), to IVY-987, or both
assert(if(overrideScalaVersion) checkExplicit else true, "Explicit Scala version checking cannot be disabled when forcing the Scala version.")
}
private object IvyScala