mirror of https://github.com/sbt/sbt.git
ModuleID to have a branch now, that ends up in the ModuleRevisionId too.
Also, add branch when converting ModuleID -> Ivy XML and include it in IvyActions.substitute.
This commit is contained in:
parent
4f2729c0b0
commit
a9b2154092
|
|
@ -422,7 +422,7 @@ private[sbt] object IvySbt {
|
|||
def toID(m: ModuleID) =
|
||||
{
|
||||
import m._
|
||||
ModuleRevisionId.newInstance(organization, name, revision, javaMap(extraAttributes))
|
||||
ModuleRevisionId.newInstance(organization, name, branchName.orNull, revision, javaMap(extraAttributes))
|
||||
}
|
||||
|
||||
private def substituteCross(m: ModuleSettings): ModuleSettings =
|
||||
|
|
@ -490,7 +490,8 @@ private[sbt] object IvySbt {
|
|||
}
|
||||
private[this] def defaultInfo(module: ModuleID): scala.xml.Elem = {
|
||||
import module._
|
||||
<info organisation={ organization } module={ name } revision={ revision }/>
|
||||
val base = <info organisation={ organization } module={ name } revision={ revision }/>
|
||||
branchName.fold(base) { br => base % new scala.xml.UnprefixedAttribute("branch", br, scala.xml.Null) }
|
||||
}
|
||||
private[this] def addExtraAttributes(elem: scala.xml.Elem, extra: Map[String, String]): scala.xml.Elem =
|
||||
(elem /: extra) { case (e, (key, value)) => e % new scala.xml.UnprefixedAttribute(key, value, scala.xml.Null) }
|
||||
|
|
|
|||
|
|
@ -365,7 +365,7 @@ object IvyActions {
|
|||
{
|
||||
val mextra = IvySbt.javaMap(mid.extraAttributes, true)
|
||||
val aextra = IvySbt.extra(art, true)
|
||||
IvyPatternHelper.substitute(pattern, mid.organization, mid.name, mid.revision, art.name, art.`type`, art.extension, conf, mextra, aextra)
|
||||
IvyPatternHelper.substitute(pattern, mid.organization, mid.name, mid.branchName.orNull, mid.revision, art.name, art.`type`, art.extension, conf, null, mextra, aextra)
|
||||
}
|
||||
|
||||
import UpdateLogging.{ Quiet, Full, DownloadOnly, Default }
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import java.net.URL
|
|||
import sbt.internal.librarymanagement.mavenint.SbtPomExtraProperties
|
||||
import sbt.serialization._
|
||||
|
||||
final case class ModuleID(organization: String, name: String, revision: String, configurations: Option[String] = None, isChanging: Boolean = false, isTransitive: Boolean = true, isForce: Boolean = false, explicitArtifacts: Seq[Artifact] = Nil, exclusions: Seq[ExclusionRule] = Nil, extraAttributes: Map[String, String] = Map.empty, crossVersion: CrossVersion = CrossVersion.Disabled) {
|
||||
final case class ModuleID(organization: String, name: String, revision: String, configurations: Option[String] = None, isChanging: Boolean = false, isTransitive: Boolean = true, isForce: Boolean = false, explicitArtifacts: Seq[Artifact] = Nil, exclusions: Seq[ExclusionRule] = Nil, extraAttributes: Map[String, String] = Map.empty, crossVersion: CrossVersion = CrossVersion.Disabled, branchName: Option[String] = None) {
|
||||
override def toString: String =
|
||||
organization + ":" + name + ":" + revision +
|
||||
(configurations match { case Some(s) => ":" + s; case None => "" }) +
|
||||
|
|
@ -118,7 +118,15 @@ final case class ModuleID(organization: String, name: String, revision: String,
|
|||
* as when adding a dependency on an artifact with a classifier.
|
||||
*/
|
||||
def jar() = artifacts(Artifact(name))
|
||||
|
||||
/**
|
||||
* Sets the Ivy branch of this module.
|
||||
*/
|
||||
def branch(branchName: String) = copy(branchName = Some(branchName))
|
||||
|
||||
def branch(branchName: Option[String]) = copy(branchName = branchName)
|
||||
}
|
||||
|
||||
object ModuleID {
|
||||
implicit val pickler: Pickler[ModuleID] with Unpickler[ModuleID] = PicklerUnpickler.generate[ModuleID]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue