From 5e246762163eeedce972ddf8ed9ad5a9d908cefb Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Sun, 13 Mar 2016 22:57:24 +0100 Subject: [PATCH] Add some scaladoc --- .../src/main/scala/coursier/core/Orders.scala | 7 ++--- .../main/scala/coursier/core/Resolution.scala | 26 +++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/core/shared/src/main/scala/coursier/core/Orders.scala b/core/shared/src/main/scala/coursier/core/Orders.scala index 15af6bfe2..fc70b30fd 100644 --- a/core/shared/src/main/scala/coursier/core/Orders.scala +++ b/core/shared/src/main/scala/coursier/core/Orders.scala @@ -35,9 +35,10 @@ object Orders { } /** - * Only relations: - * Compile < Runtime < Test - */ + * Configurations partial order based on configuration mapping `configurations`. + * + * @param configurations: for each configuration, the configurations it directly extends. + */ def configurationPartialOrder(configurations: Map[String, Seq[String]]): PartialOrdering[String] = new PartialOrdering[String] { val allParentsMap = allConfigurations(configurations) diff --git a/core/shared/src/main/scala/coursier/core/Resolution.scala b/core/shared/src/main/scala/coursier/core/Resolution.scala index eb421de65..bcf610cfe 100644 --- a/core/shared/src/main/scala/coursier/core/Resolution.scala +++ b/core/shared/src/main/scala/coursier/core/Resolution.scala @@ -847,6 +847,23 @@ final case class Resolution( ) } + /** + * Minimized dependency set. Returns `dependencies` with no redundancy. + * + * E.g. `dependencies` may contains several dependencies towards module org:name:version, + * a first one excluding A and B, and a second one excluding A and C. In practice, B and C will + * be brought anyway, because the first dependency doesn't exclude C, and the second one doesn't + * exclude B. So having both dependencies is equivalent to having only one dependency towards + * org:name:version, excluding just A. + * + * The same kind of substitution / filtering out can be applied with configurations. If + * `dependencies` contains several dependencies towards org:name:version, a first one bringing + * its configuration "runtime", a second one "compile", and the configuration mapping of + * org:name:version says that "runtime" extends "compile", then all the dependencies brought + * by the latter will be brought anyway by the former, so that the latter can be removed. + * + * @return A minimized `dependencies`, applying this kind of substitutions. + */ def minDependencies: Set[Dependency] = Orders.minDependencies( dependencies, @@ -897,6 +914,15 @@ final case class Resolution( .toSeq } yield (dep, err) + /** + * Removes from this `Resolution` dependencies that are not in `dependencies` neither brought + * transitively by them. + * + * This keeps the versions calculated by this `Resolution`. The common dependencies of different + * subsets will thus be guaranteed to have the same versions. + * + * @param dependencies: the dependencies to keep from this `Resolution` + */ def subset(dependencies: Set[Dependency]): Resolution = { val (_, _, finalVersions) = nextDependenciesAndConflicts