mirror of https://github.com/sbt/sbt.git
Merge pull request #311 from alexarchambault/topic/develop
Various fixes
This commit is contained in:
commit
3a79f0a924
|
|
@ -3,7 +3,7 @@ package coursier
|
||||||
import java.io.{ OutputStreamWriter, File }
|
import java.io.{ OutputStreamWriter, File }
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.{ ExecutorService, Executors }
|
||||||
|
|
||||||
import coursier.core.{ Authentication, Publication }
|
import coursier.core.{ Authentication, Publication }
|
||||||
import coursier.ivy.IvyRepository
|
import coursier.ivy.IvyRepository
|
||||||
|
|
@ -225,6 +225,7 @@ object Tasks {
|
||||||
private case class ResolutionCacheKey(
|
private case class ResolutionCacheKey(
|
||||||
project: Project,
|
project: Project,
|
||||||
repositories: Seq[Repository],
|
repositories: Seq[Repository],
|
||||||
|
userEnabledProfiles: Set[String],
|
||||||
resolution: Resolution,
|
resolution: Resolution,
|
||||||
sbtClassifiers: Boolean
|
sbtClassifiers: Boolean
|
||||||
)
|
)
|
||||||
|
|
@ -255,6 +256,8 @@ object Tasks {
|
||||||
private def projectDescription(project: Project) =
|
private def projectDescription(project: Project) =
|
||||||
s"${project.module.organization}:${project.module.name}:${project.version}"
|
s"${project.module.organization}:${project.module.name}:${project.version}"
|
||||||
|
|
||||||
|
private def createLogger() = new TermDisplay(new OutputStreamWriter(System.err))
|
||||||
|
|
||||||
def resolutionTask(
|
def resolutionTask(
|
||||||
sbtClassifiers: Boolean = false
|
sbtClassifiers: Boolean = false
|
||||||
) = Def.task {
|
) = Def.task {
|
||||||
|
|
@ -492,11 +495,12 @@ object Tasks {
|
||||||
fallbackDependenciesRepositories
|
fallbackDependenciesRepositories
|
||||||
|
|
||||||
def resolution = {
|
def resolution = {
|
||||||
val pool = Executors.newFixedThreadPool(parallelDownloads, Strategy.DefaultDaemonThreadFactory)
|
var pool: ExecutorService = null
|
||||||
|
var resLogger: TermDisplay = null
|
||||||
|
|
||||||
def createLogger() = new TermDisplay(new OutputStreamWriter(System.err))
|
try {
|
||||||
|
pool = Executors.newFixedThreadPool(parallelDownloads, Strategy.DefaultDaemonThreadFactory)
|
||||||
val resLogger = createLogger()
|
resLogger = createLogger()
|
||||||
|
|
||||||
val fetch = Fetch.from(
|
val fetch = Fetch.from(
|
||||||
repositories,
|
repositories,
|
||||||
|
|
@ -551,9 +555,6 @@ object Tasks {
|
||||||
)
|
)
|
||||||
.merge
|
.merge
|
||||||
|
|
||||||
resLogger.stop()
|
|
||||||
|
|
||||||
|
|
||||||
if (!res.isDone)
|
if (!res.isDone)
|
||||||
ResolutionError.MaximumIterationsReached
|
ResolutionError.MaximumIterationsReached
|
||||||
.throwException()
|
.throwException()
|
||||||
|
|
@ -587,13 +588,20 @@ object Tasks {
|
||||||
log.info(s"Resolved ${projectDescription(currentProject)} dependencies")
|
log.info(s"Resolved ${projectDescription(currentProject)} dependencies")
|
||||||
|
|
||||||
res
|
res
|
||||||
|
} finally {
|
||||||
|
if (pool != null)
|
||||||
|
pool.shutdown()
|
||||||
|
if (resLogger != null)
|
||||||
|
resLogger.stop()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resolutionsCache.getOrElseUpdate(
|
resolutionsCache.getOrElseUpdate(
|
||||||
ResolutionCacheKey(
|
ResolutionCacheKey(
|
||||||
currentProject,
|
currentProject,
|
||||||
repositories,
|
repositories,
|
||||||
startRes.copy(filter = None),
|
userEnabledProfiles,
|
||||||
|
startRes.copy(filter = None, profileActivation = None),
|
||||||
sbtClassifiers
|
sbtClassifiers
|
||||||
),
|
),
|
||||||
resolution
|
resolution
|
||||||
|
|
@ -687,9 +695,11 @@ object Tasks {
|
||||||
}.value
|
}.value
|
||||||
|
|
||||||
def report = {
|
def report = {
|
||||||
val pool = Executors.newFixedThreadPool(parallelDownloads, Strategy.DefaultDaemonThreadFactory)
|
var pool: ExecutorService = null
|
||||||
|
var artifactsLogger: TermDisplay = null
|
||||||
|
|
||||||
def createLogger() = new TermDisplay(new OutputStreamWriter(System.err))
|
try {
|
||||||
|
pool = Executors.newFixedThreadPool(parallelDownloads, Strategy.DefaultDaemonThreadFactory)
|
||||||
|
|
||||||
val depsByConfig = grouped(currentProject.dependencies)
|
val depsByConfig = grouped(currentProject.dependencies)
|
||||||
|
|
||||||
|
|
@ -724,7 +734,7 @@ object Tasks {
|
||||||
case Some(cl) => res.classifiersArtifacts(cl)
|
case Some(cl) => res.classifiersArtifacts(cl)
|
||||||
}
|
}
|
||||||
|
|
||||||
val artifactsLogger = createLogger()
|
artifactsLogger = createLogger()
|
||||||
|
|
||||||
val artifactFileOrErrorTasks = allArtifacts.toVector.map { a =>
|
val artifactFileOrErrorTasks = allArtifacts.toVector.map { a =>
|
||||||
def f(p: CachePolicy) =
|
def f(p: CachePolicy) =
|
||||||
|
|
@ -760,8 +770,6 @@ object Tasks {
|
||||||
l.toMap
|
l.toMap
|
||||||
}
|
}
|
||||||
|
|
||||||
artifactsLogger.stop()
|
|
||||||
|
|
||||||
if (verbosityLevel >= 0)
|
if (verbosityLevel >= 0)
|
||||||
log.info(
|
log.info(
|
||||||
s"Fetched artifacts of ${projectDescription(currentProject)}" +
|
s"Fetched artifacts of ${projectDescription(currentProject)}" +
|
||||||
|
|
@ -813,12 +821,18 @@ object Tasks {
|
||||||
classifiers,
|
classifiers,
|
||||||
artifactFileOpt
|
artifactFileOpt
|
||||||
)
|
)
|
||||||
|
} finally {
|
||||||
|
if (pool != null)
|
||||||
|
pool.shutdown()
|
||||||
|
if (artifactsLogger != null)
|
||||||
|
artifactsLogger.stop()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reportsCache.getOrElseUpdate(
|
reportsCache.getOrElseUpdate(
|
||||||
ReportCacheKey(
|
ReportCacheKey(
|
||||||
currentProject,
|
currentProject,
|
||||||
res,
|
res.copy(filter = None, profileActivation = None),
|
||||||
withClassifiers,
|
withClassifiers,
|
||||||
sbtClassifiers
|
sbtClassifiers
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package test
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.math.BigInteger
|
import java.math.BigInteger
|
||||||
import java.util.concurrent.Executors
|
|
||||||
|
|
||||||
import utest._
|
import utest._
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue