Fixes #1704. Fixes cached resolution + module-level exclusions

This commit is contained in:
Eugene Yokota 2014-11-04 19:01:30 -05:00
parent ca0f3530f5
commit 760a4ab5d2
2 changed files with 15 additions and 3 deletions

View File

@ -87,8 +87,10 @@ private[sbt] class CachedResolutionResolveCache() {
case rules => Some(conf + "->(" + (rules map includeRuleString).mkString(",") + ")")
}
})
val mes = parent.getAllExcludeRules.toVector
val mesStr = (mes map excludeRuleString).mkString(",")
val os = extractOverrides(parent)
val moduleLevel = s"""dependencyOverrides=${os.mkString(",")}"""
val moduleLevel = s"""dependencyOverrides=${os.mkString(",")};moduleExclusions=$mesStr"""
val depsString = s"""$mrid;${confMap.mkString(",")};isForce=${dd.isForce};isChanging=${dd.isChanging};isTransitive=${dd.isTransitive};""" +
s"""exclusions=${exclusions.mkString(",")};inclusions=${inclusions.mkString(",")};$moduleLevel;"""
val sha1 = Hash.toHex(Hash(depsString))
@ -102,6 +104,9 @@ private[sbt] class CachedResolutionResolveCache() {
os foreach { ovr =>
md1.addDependencyDescriptorMediator(ovr.moduleId, ovr.pm, ovr.ddm)
}
mes foreach { exclude =>
md1.addExcludeRule(exclude)
}
(md1, IvySbt.isChanging(dd))
}
def extractOverrides(md0: ModuleDescriptor): Vector[IvyOverride] =

View File

@ -17,7 +17,11 @@ def cachedResolutionSettings: Seq[Def.Setting[_]] =
lazy val a = project.
settings(cachedResolutionSettings: _*).
settings(
libraryDependencies += "net.databinder" %% "unfiltered-uploads" % "0.8.0" exclude("commons-io", "commons-io")
libraryDependencies += "net.databinder" %% "unfiltered-uploads" % "0.8.0" exclude("commons-io", "commons-io"),
ivyXML :=
<dependencies>
<exclude module="commons-codec"/>
</dependencies>
)
lazy val b = project.
@ -32,12 +36,15 @@ lazy val root = (project in file(".")).
organization in ThisBuild := "org.example",
version in ThisBuild := "1.0",
check := {
// sys.error(dependencyCacheDirectory.value.toString)
val acp = (externalDependencyClasspath in Compile in a).value.sortBy {_.data.getName}
val bcp = (externalDependencyClasspath in Compile in b).value.sortBy {_.data.getName}
if (acp exists { _.data.getName contains "commons-io" }) {
sys.error("commons-io found when it should be excluded")
}
if (acp exists { _.data.getName contains "commons-codec" }) {
sys.error("commons-codec found when it should be excluded")
}
// This is checking to make sure excluded graph is not getting picked up
if (!(bcp exists { _.data.getName contains "commons-io" })) {
sys.error("commons-io NOT found when it should NOT be excluded")
}