mirror of https://github.com/sbt/sbt.git
Implement configuration.missingOk to fix updateClassifiers
updateClassifiers sets missingOk to true. cached resolution wasn’t respecting the looseness.
This commit is contained in:
parent
1043d027d0
commit
c47cbf5d02
|
|
@ -161,7 +161,7 @@ object IvyActions {
|
||||||
val resolveOptions = new ResolveOptions
|
val resolveOptions = new ResolveOptions
|
||||||
val resolveId = ResolveOptions.getDefaultResolveId(md)
|
val resolveId = ResolveOptions.getDefaultResolveId(md)
|
||||||
resolveOptions.setResolveId(resolveId)
|
resolveOptions.setResolveId(resolveId)
|
||||||
x.customResolve(md, logicalClock, resolveOptions, depDir getOrElse { sys.error("dependency base directory is not specified") }, log) match {
|
x.customResolve(md, configuration.missingOk, logicalClock, resolveOptions, depDir getOrElse { sys.error("dependency base directory is not specified") }, log) match {
|
||||||
case Left(x) =>
|
case Left(x) =>
|
||||||
Left(UnresolvedWarning(x, uwconfig))
|
Left(UnresolvedWarning(x, uwconfig))
|
||||||
case Right(uReport) =>
|
case Right(uReport) =>
|
||||||
|
|
|
||||||
|
|
@ -195,8 +195,11 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
||||||
private[sbt] def projectResolver: Option[ProjectResolver]
|
private[sbt] def projectResolver: Option[ProjectResolver]
|
||||||
private[sbt] def makeInstance: Ivy
|
private[sbt] def makeInstance: Ivy
|
||||||
|
|
||||||
// Return sbt's UpdateReport.
|
/**
|
||||||
def customResolve(md0: ModuleDescriptor, logicalClock: LogicalClock, options0: ResolveOptions, depDir: File, log: Logger): Either[ResolveException, UpdateReport] = {
|
* This returns sbt's UpdateReport structure.
|
||||||
|
* missingOk allows sbt to call this with classifiers that may or may not exist, and grab the JARs.
|
||||||
|
*/
|
||||||
|
def customResolve(md0: ModuleDescriptor, missingOk: Boolean, logicalClock: LogicalClock, options0: ResolveOptions, depDir: File, log: Logger): Either[ResolveException, UpdateReport] = {
|
||||||
import Path._
|
import Path._
|
||||||
val start = System.currentTimeMillis
|
val start = System.currentTimeMillis
|
||||||
val miniGraphPath = depDir / "module"
|
val miniGraphPath = depDir / "module"
|
||||||
|
|
@ -209,7 +212,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
||||||
val options1 = new ResolveOptions(options0)
|
val options1 = new ResolveOptions(options0)
|
||||||
val i = makeInstance
|
val i = makeInstance
|
||||||
var rr = i.resolve(md, options1)
|
var rr = i.resolve(md, options1)
|
||||||
if (!rr.hasError) Right(IvyRetrieve.updateReport(rr, cachedDescriptor))
|
if (!rr.hasError || missingOk) Right(IvyRetrieve.updateReport(rr, cachedDescriptor))
|
||||||
else {
|
else {
|
||||||
val messages = rr.getAllProblemMessages.toArray.map(_.toString).distinct
|
val messages = rr.getAllProblemMessages.toArray.map(_.toString).distinct
|
||||||
val failedPaths = ListMap(rr.getUnresolvedDependencies map { node =>
|
val failedPaths = ListMap(rr.getUnresolvedDependencies map { node =>
|
||||||
|
|
@ -230,7 +233,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
||||||
doWork(md)
|
doWork(md)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val uReport = mergeResults(md0, results, System.currentTimeMillis - start, log)
|
val uReport = mergeResults(md0, results, missingOk, System.currentTimeMillis - start, log)
|
||||||
val cacheManager = getSettings.getResolutionCacheManager
|
val cacheManager = getSettings.getResolutionCacheManager
|
||||||
cacheManager.saveResolvedModuleDescriptor(md0)
|
cacheManager.saveResolvedModuleDescriptor(md0)
|
||||||
val prop0 = ""
|
val prop0 = ""
|
||||||
|
|
@ -238,8 +241,8 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
||||||
IO.write(ivyPropertiesInCache0, prop0)
|
IO.write(ivyPropertiesInCache0, prop0)
|
||||||
uReport
|
uReport
|
||||||
}
|
}
|
||||||
def mergeResults(md0: ModuleDescriptor, results: Vector[Either[ResolveException, UpdateReport]], resolveTime: Long, log: Logger): Either[ResolveException, UpdateReport] =
|
def mergeResults(md0: ModuleDescriptor, results: Vector[Either[ResolveException, UpdateReport]], missingOk: Boolean, resolveTime: Long, log: Logger): Either[ResolveException, UpdateReport] =
|
||||||
if (results exists { _.isLeft }) Left(mergeErrors(md0, results collect { case Left(re) => re }, log))
|
if (!missingOk && (results exists { _.isLeft })) Left(mergeErrors(md0, results collect { case Left(re) => re }, log))
|
||||||
else Right(mergeReports(md0, results collect { case Right(ur) => ur }, resolveTime, log))
|
else Right(mergeReports(md0, results collect { case Right(ur) => ur }, resolveTime, log))
|
||||||
def mergeErrors(md0: ModuleDescriptor, errors: Vector[ResolveException], log: Logger): ResolveException =
|
def mergeErrors(md0: ModuleDescriptor, errors: Vector[ResolveException], log: Logger): ResolveException =
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue