Permalink
Browse files

some API documentation for UpdateReport

  • Loading branch information...
1 parent 399dd8e commit 715f7b8574f33f3314309855acf2805981cdf570 @harrah committed Apr 11, 2011
Showing with 38 additions and 1 deletion.
  1. +38 −1 ivy/UpdateReport.scala
View
@@ -5,21 +5,51 @@ package sbt
import java.io.File
+/** Provides information about dependency resolution.
+* It does not include information about evicted modules, only about the modules ultimately selected by the conflict manager.
+* This means that for a given configuration, there should only be one revision for a given organization and module name.
+* @param configurations a sequence containing one report for each configuration resolved.
+* @see sbt.RichUpdateReport
+ */
final class UpdateReport(val configurations: Seq[ConfigurationReport])
{
override def toString = "Update report:\n" + configurations.mkString
+
+ /** All resolved modules in all configurations. */
def allModules: Seq[ModuleID] = configurations.flatMap(_.allModules).distinct
+
def retrieve(f: (String, ModuleID, Artifact, File) => File): UpdateReport =
new UpdateReport(configurations map { _ retrieve f} )
+
+ /** Gets the report for the given configuration, or `None` if the configuration was not resolved.*/
def configuration(s: String) = configurations.find(_.configuration == s)
+
+ /** Gets the names of all resolved configurations. This `UpdateReport` contains one `ConfigurationReport` for each configuration in this list. */
+ def configurations: Seq[String] = configurations.map(_.configuration)
}
+
+/** Provides information about resolution of a single configuration.
+* @param configuration the configuration this report is for.
+* @param modules a seqeuence containing one report for each module resolved for this configuration.
+*/
final class ConfigurationReport(val configuration: String, val modules: Seq[ModuleReport])
{
override def toString = "\t" + configuration + ":\n" + modules.mkString
+
+ /** All resolved modules for this configuration.
+ * For a given organization and module name, there is only one revision/`ModuleID` in this sequence.
+ */
def allModules: Seq[ModuleID] = modules.map(_.module)
+
def retrieve(f: (String, ModuleID, Artifact, File) => File): ConfigurationReport =
new ConfigurationReport(configuration, modules map { _.retrieve( (mid,art,file) => f(configuration, mid, art, file)) })
}
+
+/** Provides information about the resolution of a module.
+* This information is in the context of a specific configuration.
+* @param module the `ModuleID` this report is for.
+* @param artifacts the resolved artifacts for this module, paired with the File the artifact was retrieved to. This File may be in the
+*/
final class ModuleReport(val module: ModuleID, val artifacts: Seq[(Artifact, File)], val missingArtifacts: Seq[Artifact])
{
override def toString =
@@ -34,12 +64,18 @@ final class ModuleReport(val module: ModuleID, val artifacts: Seq[(Artifact, Fil
object UpdateReport
{
implicit def richUpdateReport(report: UpdateReport): RichUpdateReport = new RichUpdateReport(report)
+
+ /** Provides extra methods for filtering the contents of an `UpdateReport` and for obtaining references to a selected subset of the underlying files. */
final class RichUpdateReport(report: UpdateReport)
{
import DependencyFilter._
-
+ /** Obtains all successfully retrieved files in all configurations and modules. */
def allFiles: Seq[File] = matching(DependencyFilter.allPass)
+
+ /** Obtains all successfully retrieved files in configurations, modules, and artifacts matching the specified filter. */
def matching(f: DependencyFilter): Seq[File] = select0(f).distinct
+
+ /** Obtains all successfully retrieved files matching all provided filters. An unspecified argument matches all files. */
def select(configuration: ConfigurationFilter = configurationFilter(), module: ModuleFilter = moduleFilter(), artifact: ArtifactFilter = artifactFilter()): Seq[File] =
matching(DependencyFilter.make(configuration, module, artifact))
@@ -49,6 +85,7 @@ object UpdateReport
file
}
+ /** Constructs a new report that only contains files matching the specified filter.*/
def filter(f: DependencyFilter): UpdateReport =
{
val newConfigurations = report.configurations.map { confReport =>

0 comments on commit 715f7b8

Please sign in to comment.