in multiversion/src/main/scala/multiversion/commands/ExportCommand.scala [89:165]
def runResult(thirdparty: ThirdpartyConfig): Result[Unit] =
withThreadPool[Result[Unit]](parallel, downloadPar) { threads =>
val coursierCache: FileCache[Task] = FileCache().noCredentials
.withCachePolicies(
List(
// first, use what's available locally
CachePolicy.LocalOnly,
// then, try to download what's missing
CachePolicy.Update
)
)
.withLocation(cache match {
case Some(c) => c.toFile
case _ => CacheDefaults.location
})
.withTtl(scala.concurrent.duration.Duration.Inf)
.withPool(threads.downloadPool)
.withChecksums(Nil)
.withRetry(retryCount)
for {
withUrls <- lintUrls(thirdparty, allowUrl)
initialResolutions <- runResolutions(withUrls, None, withUrls.coursierDeps, coursierCache)
initialIndex = ResolutionIndex.fromResolutions(
withUrls,
initialResolutions,
resolveSources = false
)
withSelectedVersions = selectVersionsFromIndex(withUrls, initialIndex)
withOverriddenTargets = overrideTargets(withSelectedVersions, initialIndex)
intermediateResolutions <- runResolutions(
withOverriddenTargets,
None,
withOverriddenTargets.coursierDeps,
coursierCache
)
intermediateIndex =
ResolutionIndex.fromResolutions(
withOverriddenTargets,
intermediateResolutions,
resolveSources = false
)
resolutions <- runResolutions(
withOverriddenTargets,
Some(intermediateIndex),
withOverriddenTargets.coursierDeps,
coursierCache
)
index = ResolutionIndex.fromResolutions(
withOverriddenTargets,
resolutions,
resolveSources = true
)
_ <- lintEvictedDeclaredDependencies(
withUrls,
initialIndex,
index,
failOnEvictedDeclared
)
_ <- lintIntraTargetConflicts(index)
_ <- {
if (lint) lintPostResolution(index)
else ValueResult(())
}
output <- generateBzlFile(index, coursierCache)
_ = app.err.println(Docs.successMessage(s"Generated '$output'"))
lint <-
if (lint)
lintCommand
.copy(
queryExpressions = List("@maven//:all"),
app = app
)
.runResult()
else ValueResult(())
} yield lint
}