From 229ecaba5ee46454582c6c5fd101a8a4dcf399c6 Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Sun, 7 Mar 2010 19:03:12 -0500 Subject: [PATCH] Documentation on ProjectInfo --- src/main/scala/sbt/ProjectInfo.scala | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/main/scala/sbt/ProjectInfo.scala b/src/main/scala/sbt/ProjectInfo.scala index 5a59d8111..6ff3fcc02 100644 --- a/src/main/scala/sbt/ProjectInfo.scala +++ b/src/main/scala/sbt/ProjectInfo.scala @@ -7,28 +7,47 @@ import java.io.File import xsbti.{AppProvider, ScalaProvider} import FileUtilities._ -// provider is for the build, not the build definition +/** Represents the minimal information necessary to construct a Project. +* +* `projectDirectory` is the base directory for the project (not the root project directory) +* `dependencies` are the Projects that this Project depends on. +* `parent` is the parent Project, or None if this is the root project. +* `log` is the Logger to use as a base for the default project Logger. +* `buildScalaVersion` contains the explicitly requested Scala version to use for building (as when using `+` or `++`) or None if the normal version should be used. +*/ final case class ProjectInfo(projectDirectory: File, dependencies: Iterable[Project], parent: Option[Project]) (log: Logger, val app: AppProvider, val buildScalaVersion: Option[String]) extends NotNull { + /** The version of Scala running sbt.*/ def definitionScalaVersion = app.scalaProvider.version + /** The launcher instance that booted sbt.*/ def launcher = app.scalaProvider.launcher val logger = new FilterLogger(log) + /** The base path for the project, preserving information to the root project directory.*/ val projectPath: Path = { val toRoot = parent.flatMap(p => Path.relativize(p.info.projectPath, projectDirectory)) new ProjectDirectory(projectDirectory, toRoot) } + /** The path to build information. The current location is `project/`. + * Note: The directory used to be `metadata/`, hence the name of the constant in the implementation. + * Note 2: Although it is called builderPath, it is not the path to the builder definition, which is `builderProjectPath`*/ val builderPath = projectPath / ProjectInfo.MetadataDirectoryName + /** The boot directory contains the jars needed for building the project, including Scala, sbt, processors and dependencies of these.*/ def bootPath = builderPath / Project.BootDirectoryName + /** The path to the build definition project. */ def builderProjectPath = builderPath / Project.BuilderProjectDirectoryName def builderProjectOutputPath = builderProjectPath / Project.DefaultOutputDirectoryName + /** The path to the plugin definition project. This declares the plugins to use for the build definition.*/ def pluginsPath = builderPath / Project.PluginProjectDirectoryName def pluginsOutputPath = pluginsPath / Project.DefaultOutputDirectoryName + /** The path to which the source code for plugins are extracted.*/ def pluginsManagedSourcePath = pluginsPath / BasicDependencyPaths.DefaultManagedSourceDirectoryName + /** The path to which plugins are retrieved.*/ def pluginsManagedDependencyPath = pluginsPath / BasicDependencyPaths.DefaultManagedDirectoryName - + + /** The classpath containing all jars comprising sbt, except for the launcher.*/ def sbtClasspath = Path.finder(app.mainClasspath) }