mirror of https://github.com/sbt/sbt.git
Better names / comments
This commit is contained in:
parent
d47e6b074a
commit
dd4dbb41f9
|
|
@ -77,7 +77,7 @@ object Cache {
|
|||
// Dummy user-agent instead of the default "Java/...",
|
||||
// so that we are not returned incomplete/erroneous metadata
|
||||
// (Maven 2 compatibility? - happens for snapshot versioning metadata,
|
||||
// this is SO FUCKING CRAZY)
|
||||
// this is SO FSCKING CRAZY)
|
||||
conn.setRequestProperty("User-Agent", "")
|
||||
conn
|
||||
}
|
||||
|
|
|
|||
|
|
@ -786,7 +786,7 @@ case class Resolution(
|
|||
.toSeq
|
||||
} yield (dep, err)
|
||||
|
||||
def part(dependencies: Set[Dependency]): Resolution = {
|
||||
def subset(dependencies: Set[Dependency]): Resolution = {
|
||||
val (_, _, finalVersions) = nextDependenciesAndConflicts
|
||||
|
||||
def updateVersion(dep: Dependency): Dependency =
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ object FromSbt {
|
|||
scalaBinaryVersion: String
|
||||
): Project = {
|
||||
|
||||
// FIXME Ignored for now
|
||||
// FIXME Ignored for now - easy to support though
|
||||
// val sbtDepOverrides = dependencyOverrides.value
|
||||
// val sbtExclusions = excludeDependencies.value
|
||||
|
||||
|
|
|
|||
|
|
@ -23,14 +23,14 @@ case class InterProjectSource(artifacts: Map[(Module, String), Map[String, Seq[A
|
|||
case class InterProjectRepository(projects: Seq[(Project, Seq[(String, Seq[Artifact])])]) extends Repository {
|
||||
|
||||
private val map = projects
|
||||
.map { case (proj, a) => proj.moduleVersion -> proj }
|
||||
.map { case (proj, _) => proj.moduleVersion -> proj }
|
||||
.toMap
|
||||
|
||||
val source = InterProjectSource(
|
||||
projects.map { case (proj, a) =>
|
||||
val artifacts = a.toMap
|
||||
val allArtifacts = proj.allConfigurations.map { case (c, ext) =>
|
||||
c -> ext.toSeq.flatMap(artifacts.getOrElse(_, Nil))
|
||||
projects.map { case (proj, artifactsByConfig) =>
|
||||
val artifacts = artifactsByConfig.toMap
|
||||
val allArtifacts = proj.allConfigurations.map { case (config, extends0) =>
|
||||
config -> extends0.toSeq.flatMap(artifacts.getOrElse(_, Nil))
|
||||
}
|
||||
proj.moduleVersion -> allArtifacts
|
||||
}.toMap
|
||||
|
|
@ -47,7 +47,7 @@ case class InterProjectRepository(projects: Seq[(Project, Seq[(String, Seq[Artif
|
|||
case Some(proj) =>
|
||||
\/-((source, proj))
|
||||
case None =>
|
||||
-\/(s"Project not found: $module:$version")
|
||||
-\/("Not found")
|
||||
}
|
||||
|
||||
EitherT(F.point(res))
|
||||
|
|
|
|||
|
|
@ -16,13 +16,13 @@ import scalaz.concurrent.{ Task, Strategy }
|
|||
object Tasks {
|
||||
|
||||
def coursierResolversTask: Def.Initialize[sbt.Task[Seq[Resolver]]] = Def.task {
|
||||
var l = externalResolvers.value
|
||||
var resolvers = externalResolvers.value
|
||||
if (sbtPlugin.value)
|
||||
l = Seq(
|
||||
resolvers = Seq(
|
||||
sbtResolver.value,
|
||||
Classpaths.sbtPluginReleases
|
||||
) ++ l
|
||||
l
|
||||
) ++ resolvers
|
||||
resolvers
|
||||
}
|
||||
|
||||
def coursierProjectTask: Def.Initialize[sbt.Task[(Project, Seq[(String, Seq[Artifact])])]] =
|
||||
|
|
@ -76,6 +76,7 @@ object Tasks {
|
|||
|
||||
def updateTask(withClassifiers: Boolean, sbtClassifiers: Boolean = false) = Def.task {
|
||||
|
||||
// SBT logging should be better than that most of the time...
|
||||
def errPrintln(s: String): Unit = scala.Console.err.println(s)
|
||||
|
||||
def grouped[K, V](map: Seq[(K, V)]): Map[K, Seq[V]] =
|
||||
|
|
@ -84,17 +85,6 @@ object Tasks {
|
|||
k -> l.map { case (_, v) => v }
|
||||
}
|
||||
|
||||
val ivyProperties = Map(
|
||||
"ivy.home" -> s"${sys.props("user.home")}/.ivy2"
|
||||
) ++ sys.props
|
||||
|
||||
def createLogger() = Some {
|
||||
new TermDisplay(
|
||||
new OutputStreamWriter(System.err),
|
||||
fallbackMode = sys.env.get("COURSIER_NO_TERM").nonEmpty
|
||||
)
|
||||
}
|
||||
|
||||
// let's update only one module at once, for a better output
|
||||
// Downloads are already parallel, no need to parallelize further anyway
|
||||
synchronized {
|
||||
|
|
@ -154,6 +144,11 @@ object Tasks {
|
|||
)
|
||||
|
||||
val interProjectRepo = InterProjectRepository(projects)
|
||||
|
||||
val ivyProperties = Map(
|
||||
"ivy.home" -> s"${sys.props("user.home")}/.ivy2"
|
||||
) ++ sys.props
|
||||
|
||||
val repositories = Seq(globalPluginsRepo, interProjectRepo) ++ resolvers.flatMap(FromSbt.repository(_, ivyProperties))
|
||||
|
||||
val caches = Seq(
|
||||
|
|
@ -163,12 +158,16 @@ object Tasks {
|
|||
|
||||
val pool = Executors.newFixedThreadPool(parallelDownloads, Strategy.DefaultDaemonThreadFactory)
|
||||
|
||||
val logger = createLogger()
|
||||
logger.foreach(_.init())
|
||||
val logger = new TermDisplay(
|
||||
new OutputStreamWriter(System.err),
|
||||
fallbackMode = sys.env.get("COURSIER_NO_TERM").nonEmpty
|
||||
)
|
||||
logger.init()
|
||||
|
||||
val fetch = coursier.Fetch(
|
||||
repositories,
|
||||
Cache.fetch(caches, CachePolicy.LocalOnly, checksums = checksums, logger = logger, pool = pool),
|
||||
Cache.fetch(caches, cachePolicy, checksums = checksums, logger = logger, pool = pool)
|
||||
Cache.fetch(caches, CachePolicy.LocalOnly, checksums = checksums, logger = Some(logger), pool = pool),
|
||||
Cache.fetch(caches, cachePolicy, checksums = checksums, logger = Some(logger), pool = pool)
|
||||
)
|
||||
|
||||
def depsRepr = currentProject.dependencies.map { case (config, dep) =>
|
||||
|
|
@ -253,7 +252,7 @@ object Tasks {
|
|||
}
|
||||
|
||||
val artifactFileOrErrorTasks = allArtifacts.toVector.map { a =>
|
||||
Cache.file(a, caches, cachePolicy, checksums = artifactsChecksums, logger = logger, pool = pool).run.map((a, _))
|
||||
Cache.file(a, caches, cachePolicy, checksums = artifactsChecksums, logger = Some(logger), pool = pool).run.map((a, _))
|
||||
}
|
||||
|
||||
if (verbosity >= 0)
|
||||
|
|
|
|||
|
|
@ -88,9 +88,9 @@ object ToSbt {
|
|||
val configReports = configs.map {
|
||||
case (config, extends0) =>
|
||||
val configDeps = extends0.flatMap(configDependencies.getOrElse(_, Nil))
|
||||
val partialRes = resolution.part(configDeps)
|
||||
val subRes = resolution.subset(configDeps)
|
||||
|
||||
val reports = ToSbt.moduleReports(partialRes, classifiersOpt, artifactFileOpt)
|
||||
val reports = ToSbt.moduleReports(subRes, classifiersOpt, artifactFileOpt)
|
||||
|
||||
new ConfigurationReport(
|
||||
config,
|
||||
|
|
|
|||
Loading…
Reference in New Issue