mirror of https://github.com/sbt/sbt.git
Merge pull request #99 from alexarchambault/topic/intransitive-deps
Add support for intransitive dependencies
This commit is contained in:
commit
479cb08806
|
|
@ -44,7 +44,9 @@ case class Dependency(
|
||||||
|
|
||||||
// Maven-specific
|
// Maven-specific
|
||||||
attributes: Attributes,
|
attributes: Attributes,
|
||||||
optional: Boolean
|
optional: Boolean,
|
||||||
|
|
||||||
|
transitive: Boolean
|
||||||
) {
|
) {
|
||||||
def moduleVersion = (module, version)
|
def moduleVersion = (module, version)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -434,14 +434,17 @@ case class Resolution(
|
||||||
new mutable.HashMap[Dependency, Seq[Dependency]]()
|
new mutable.HashMap[Dependency, Seq[Dependency]]()
|
||||||
private def finalDependencies0(dep: Dependency) =
|
private def finalDependencies0(dep: Dependency) =
|
||||||
finalDependenciesCache.synchronized {
|
finalDependenciesCache.synchronized {
|
||||||
finalDependenciesCache.getOrElseUpdate(dep,
|
finalDependenciesCache.getOrElseUpdate(dep, {
|
||||||
projectCache.get(dep.moduleVersion) match {
|
if (dep.transitive)
|
||||||
case Some((_, proj)) =>
|
projectCache.get(dep.moduleVersion) match {
|
||||||
finalDependencies(dep, proj)
|
case Some((_, proj)) =>
|
||||||
.filter(filter getOrElse defaultFilter)
|
finalDependencies(dep, proj)
|
||||||
case None => Nil
|
.filter(filter getOrElse defaultFilter)
|
||||||
}
|
case None => Nil
|
||||||
)
|
}
|
||||||
|
else
|
||||||
|
Nil
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -69,14 +69,22 @@ object IvyXml {
|
||||||
rawConf <- node.attribute("conf").toOption.toSeq
|
rawConf <- node.attribute("conf").toOption.toSeq
|
||||||
(fromConf, toConf) <- mappings(rawConf)
|
(fromConf, toConf) <- mappings(rawConf)
|
||||||
attr = node.attributesFromNamespace(attributesNamespace)
|
attr = node.attributesFromNamespace(attributesNamespace)
|
||||||
} yield fromConf -> Dependency(
|
} yield {
|
||||||
Module(org, name, attr.toMap),
|
val transitive = node.attribute("transitive").toOption match {
|
||||||
version,
|
case Some("false") => false
|
||||||
toConf,
|
case _ => true
|
||||||
allConfsExcludes ++ excludes.getOrElse(fromConf, Set.empty),
|
}
|
||||||
Attributes("jar", ""), // should come from possible artifact nodes
|
|
||||||
optional = false
|
fromConf -> Dependency(
|
||||||
)
|
Module(org, name, attr.toMap),
|
||||||
|
version,
|
||||||
|
toConf,
|
||||||
|
allConfsExcludes ++ excludes.getOrElse(fromConf, Set.empty),
|
||||||
|
Attributes("jar", ""), // should come from possible artifact nodes
|
||||||
|
optional = false,
|
||||||
|
transitive = transitive
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private def publications(node: Node): Map[String, Seq[Publication]] =
|
private def publications(node: Node): Map[String, Seq[Publication]] =
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,8 @@ object Pom {
|
||||||
"",
|
"",
|
||||||
exclusions.map(mod => (mod.organization, mod.name)).toSet,
|
exclusions.map(mod => (mod.organization, mod.name)).toSet,
|
||||||
Attributes(typeOpt getOrElse defaultType, classifierOpt getOrElse defaultClassifier),
|
Attributes(typeOpt getOrElse defaultType, classifierOpt getOrElse defaultClassifier),
|
||||||
optional
|
optional,
|
||||||
|
transitive = true
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,8 @@ package object coursier {
|
||||||
configuration: String = "",
|
configuration: String = "",
|
||||||
attributes: Attributes = Attributes(),
|
attributes: Attributes = Attributes(),
|
||||||
exclusions: Set[(String, String)] = Set.empty,
|
exclusions: Set[(String, String)] = Set.empty,
|
||||||
optional: Boolean = false
|
optional: Boolean = false,
|
||||||
|
transitive: Boolean = true
|
||||||
): Dependency =
|
): Dependency =
|
||||||
core.Dependency(
|
core.Dependency(
|
||||||
module,
|
module,
|
||||||
|
|
@ -21,7 +22,8 @@ package object coursier {
|
||||||
configuration,
|
configuration,
|
||||||
exclusions,
|
exclusions,
|
||||||
attributes,
|
attributes,
|
||||||
optional
|
optional,
|
||||||
|
transitive
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,8 @@ object FromSbt {
|
||||||
exclusions = module.exclusions.map { rule =>
|
exclusions = module.exclusions.map { rule =>
|
||||||
// FIXME Other `rule` fields are ignored here
|
// FIXME Other `rule` fields are ignored here
|
||||||
(rule.organization, rule.name)
|
(rule.organization, rule.name)
|
||||||
}.toSet
|
}.toSet,
|
||||||
|
transitive = module.isTransitive
|
||||||
)
|
)
|
||||||
|
|
||||||
val mapping = module.configurations.getOrElse("compile")
|
val mapping = module.configurations.getOrElse("compile")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue