mirror of https://github.com/sbt/sbt.git
commit
40644aedab
|
|
@ -327,12 +327,41 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
|||
Left(new ResolveException(messages, failed, failedPaths))
|
||||
}
|
||||
}
|
||||
val results = mds map {
|
||||
val (internal, external) = mds.partition { case (_, _, dd) => cache.internalDependency(dd, projectResolver).isDefined }
|
||||
val internalResults = internal map {
|
||||
case (md, changing, dd) =>
|
||||
cache.getOrElseUpdateMiniGraph(md, changing, logicalClock, miniGraphPath, cachedDescriptor, log) {
|
||||
doWork(md, dd)
|
||||
}
|
||||
}
|
||||
val externalResults = external map {
|
||||
case (md0, changing, dd) =>
|
||||
val configurationsInInternal = internalResults flatMap {
|
||||
case Right(ur) => ur.allModules.flatMap {
|
||||
case md =>
|
||||
val sameName = md.name == dd.getDependencyId.getName
|
||||
val sameOrg = md.organization == dd.getDependencyId.getOrganisation
|
||||
if (sameName && sameOrg) md.configurations
|
||||
else None
|
||||
}
|
||||
case _ => Nil
|
||||
}
|
||||
|
||||
dd match {
|
||||
case d: DefaultDependencyDescriptor =>
|
||||
configurationsInInternal foreach { c =>
|
||||
val configurations = c.split(";").map(_.split("->"))
|
||||
configurations foreach { conf => d.addDependencyConfiguration(conf(0), conf(1)) }
|
||||
}
|
||||
|
||||
case _ => ()
|
||||
}
|
||||
|
||||
cache.getOrElseUpdateMiniGraph(md0, changing, logicalClock, miniGraphPath, cachedDescriptor, log) {
|
||||
doWork(md0, dd)
|
||||
}
|
||||
}
|
||||
val results = internalResults ++ externalResults
|
||||
val uReport = mergeResults(md0, results, missingOk, System.currentTimeMillis - start, os, log)
|
||||
val cacheManager = getSettings.getResolutionCacheManager
|
||||
cacheManager.saveResolvedModuleDescriptor(md0)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
package a
|
||||
|
||||
object A {
|
||||
romanowski.sbt.bug.MissingClass("A")
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
package b
|
||||
|
||||
object B {
|
||||
romanowski.sbt.bug.MissingClass("A")
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
def myResolver = resolvers += Resolver.file("buggy", file("repo"))(
|
||||
Patterns(
|
||||
ivyPatterns = Seq("[organization]/[module]/[revision]/ivy.xml"),
|
||||
artifactPatterns = Seq("[organization]/[module]/[revision]/[artifact]"),
|
||||
isMavenCompatible = false,
|
||||
descriptorOptional = true,
|
||||
skipConsistencyCheck = true
|
||||
)
|
||||
)
|
||||
|
||||
lazy val a = project settings(
|
||||
myResolver,
|
||||
updateOptions := updateOptions.value.withCachedResolution(true), //comment this line to make ws compile
|
||||
libraryDependencies += "a" % "b" % "1.0.0" % "compile->runtime",
|
||||
libraryDependencies += "a" % "b" % "1.0.0" % "compile->runtime2"
|
||||
)
|
||||
|
||||
lazy val b = project dependsOn(a) settings(
|
||||
myResolver,
|
||||
updateOptions := updateOptions.value.withCachedResolution(true), //comment this line to make ws compile
|
||||
libraryDependencies += "a" % "b" % "1.0.1" % "compile->runtime"
|
||||
)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,16 @@
|
|||
<ivy-module xmlns:e="http://ant.apache.org/ivy/extra" version="2.0">
|
||||
<info organisation="a" module="b" revision="1.0.0" status="release" publication="20160201120702">
|
||||
<description>a</description>
|
||||
</info>
|
||||
<configurations>
|
||||
<conf name="runtime" description="..."/>
|
||||
<conf name="runtime2" description="..."/>
|
||||
</configurations>
|
||||
<publications>
|
||||
<artifact name="b1.jar" type="jar" ext="jar" conf="runtime"/>
|
||||
<artifact name="b2.jar" type="jar" ext="jar" conf="runtime"/>
|
||||
<artifact name="b3.jar" type="jar" ext="jar" conf="runtime2"/>
|
||||
</publications>
|
||||
<dependencies>
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,16 @@
|
|||
<ivy-module xmlns:e="http://ant.apache.org/ivy/extra" version="2.0">
|
||||
<info organisation="a" module="b" revision="1.0.1" status="release" publication="20160201120702">
|
||||
<description>a</description>
|
||||
</info>
|
||||
<configurations>
|
||||
<conf name="runtime" description="..."/>
|
||||
<conf name="runtime2" description="..."/>
|
||||
</configurations>
|
||||
<publications>
|
||||
<artifact name="b1.jar" type="jar" ext="jar" conf="runtime"/>
|
||||
<artifact name="b2.jar" type="jar" ext="jar" conf="runtime"/>
|
||||
<artifact name="b3.jar" type="jar" ext="jar" conf="runtime2"/>
|
||||
</publications>
|
||||
<dependencies>
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
# In this test, we have a project `a`, on which a project `b` depends.
|
||||
# project `a` has a library dependency on:
|
||||
# - "a" % "b" % "1.0.0" % "compile->runtime"
|
||||
# - "a" % "b" % "1.0.0" % "compile->runtime2"
|
||||
# project "b" depends on:
|
||||
# - project `a`
|
||||
# - "b" % "b" % "1.0.1" % "compile->runtime"
|
||||
# "a" % "b" % "1.0.0" will be evicted in favor of "a" % "b" % "1.0.1", but we
|
||||
# have to keep the dependency on the two configurations "runtime" and "runtime2".
|
||||
# This test makes sure that we actually do.
|
||||
> compile
|
||||
Loading…
Reference in New Issue