mirror of https://github.com/sbt/sbt.git
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:
parent
b956b62c89
commit
bcc3e12abc
|
|
@ -290,11 +290,11 @@ private object IvySbt
|
||||||
}
|
}
|
||||||
|
|
||||||
private def substituteCross(m: ModuleSettings): ModuleSettings =
|
private def substituteCross(m: ModuleSettings): ModuleSettings =
|
||||||
m.ivyScala match { case None => m; case Some(is) => substituteCross(m, is.scalaVersion) }
|
m.ivyScala match { case None => m; case Some(is) => substituteCross(m, is.substituteCross) }
|
||||||
private def substituteCross(m: ModuleSettings, cross: String): ModuleSettings =
|
private def substituteCross(m: ModuleSettings, sub: ModuleID => ModuleID): ModuleSettings =
|
||||||
m match {
|
m match {
|
||||||
case ec: EmptyConfiguration => ec.copy(module = substituteCross(ec.module, cross))
|
case ec: EmptyConfiguration => ec.copy(module = sub(ec.module))
|
||||||
case ic: InlineConfiguration => ic.copy(module = substituteCross(ic.module, cross), dependencies = substituteCrossM(ic.dependencies, cross))
|
case ic: InlineConfiguration => ic.copy(module = sub(ic.module), dependencies = ic.dependencies map sub)
|
||||||
case _ => m
|
case _ => m
|
||||||
}
|
}
|
||||||
def crossName(name: String, cross: String): String =
|
def crossName(name: String, cross: String): String =
|
||||||
|
|
@ -303,8 +303,6 @@ private object IvySbt
|
||||||
a.copy(name = crossName(a.name, cross))
|
a.copy(name = crossName(a.name, cross))
|
||||||
def substituteCrossA(as: Seq[Artifact], cross: String): Seq[Artifact] =
|
def substituteCrossA(as: Seq[Artifact], cross: String): Seq[Artifact] =
|
||||||
as.map(art => substituteCross(art, cross))
|
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 =
|
def substituteCross(m: ModuleID, cross: String): ModuleID =
|
||||||
if(m.crossVersion)
|
if(m.crossVersion)
|
||||||
m.copy(name = crossName(m.name, cross), explicitArtifacts = substituteCrossA(m.explicitArtifacts, cross))
|
m.copy(name = crossName(m.name, cross), explicitArtifacts = substituteCrossA(m.explicitArtifacts, cross))
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,10 @@ object ScalaArtifacts
|
||||||
|
|
||||||
import 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"
|
// 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.")
|
assert(if(overrideScalaVersion) checkExplicit else true, "Explicit Scala version checking cannot be disabled when forcing the Scala version.")
|
||||||
}
|
}
|
||||||
private object IvyScala
|
private object IvyScala
|
||||||
|
|
|
||||||
|
|
@ -326,7 +326,7 @@ object Defaults extends BuildCommon
|
||||||
def collectFiles(dirs: ScopedTaskable[Seq[File]], filter: ScopedTaskable[FileFilter], excludes: ScopedTaskable[FileFilter]): Initialize[Task[Seq[File]]] =
|
def collectFiles(dirs: ScopedTaskable[Seq[File]], filter: ScopedTaskable[FileFilter], excludes: ScopedTaskable[FileFilter]): Initialize[Task[Seq[File]]] =
|
||||||
(dirs, filter, excludes) map { (d,f,excl) => d.descendentsExcept(f,excl).get }
|
(dirs, filter, excludes) map { (d,f,excl) => d.descendentsExcept(f,excl).get }
|
||||||
|
|
||||||
def artifactPathSetting(art: ScopedSetting[Artifact]) = (crossTarget, projectID, art, scalaVersion, artifactName) { (t, module, a, sv, toString) => t / toString(sv, module, a) asFile }
|
def artifactPathSetting(art: ScopedSetting[Artifact]) = (crossTarget, projectID, art, scalaVersion in artifactName, artifactName) { (t, module, a, sv, toString) => t / toString(sv, module, a) asFile }
|
||||||
|
|
||||||
def pairID[A,B] = (a: A, b: B) => (a,b)
|
def pairID[A,B] = (a: A, b: B) => (a,b)
|
||||||
def packageTasks(key: TaskKey[File], mappingsTask: Initialize[Task[Seq[(File,String)]]]) =
|
def packageTasks(key: TaskKey[File], mappingsTask: Initialize[Task[Seq[(File,String)]]]) =
|
||||||
|
|
@ -611,7 +611,9 @@ object Classpaths
|
||||||
ivyLoggingLevel in GlobalScope :== UpdateLogging.Quiet,
|
ivyLoggingLevel in GlobalScope :== UpdateLogging.Quiet,
|
||||||
ivyXML in GlobalScope :== NodeSeq.Empty,
|
ivyXML in GlobalScope :== NodeSeq.Empty,
|
||||||
ivyValidate in GlobalScope :== false,
|
ivyValidate in GlobalScope :== false,
|
||||||
ivyScala <<= ivyScala or (scalaHome, scalaVersion)((sh,v) => Some(new IvyScala(v, Nil, filterImplicit = true, checkExplicit = true, overrideScalaVersion = sh.isEmpty))),
|
ivyScala <<= ivyScala or (scalaHome, scalaVersion, scalaVersion in update) { (sh,v,vu) =>
|
||||||
|
Some(new IvyScala(v, Nil, filterImplicit = true, checkExplicit = true, overrideScalaVersion = sh.isEmpty, substituteCross = x => IvySbt.substituteCross(x, vu)))
|
||||||
|
},
|
||||||
moduleConfigurations in GlobalScope :== Nil,
|
moduleConfigurations in GlobalScope :== Nil,
|
||||||
publishTo in GlobalScope :== None,
|
publishTo in GlobalScope :== None,
|
||||||
artifactPath in makePom <<= artifactPathSetting(artifact in makePom),
|
artifactPath in makePom <<= artifactPathSetting(artifact in makePom),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue