mirror of https://github.com/sbt/sbt.git
Documentation on ProjectInfo
This commit is contained in:
parent
186112ee57
commit
229ecaba5e
|
|
@ -7,28 +7,47 @@ import java.io.File
|
||||||
import xsbti.{AppProvider, ScalaProvider}
|
import xsbti.{AppProvider, ScalaProvider}
|
||||||
import FileUtilities._
|
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])
|
final case class ProjectInfo(projectDirectory: File, dependencies: Iterable[Project], parent: Option[Project])
|
||||||
(log: Logger, val app: AppProvider, val buildScalaVersion: Option[String]) extends NotNull
|
(log: Logger, val app: AppProvider, val buildScalaVersion: Option[String]) extends NotNull
|
||||||
{
|
{
|
||||||
|
/** The version of Scala running sbt.*/
|
||||||
def definitionScalaVersion = app.scalaProvider.version
|
def definitionScalaVersion = app.scalaProvider.version
|
||||||
|
/** The launcher instance that booted sbt.*/
|
||||||
def launcher = app.scalaProvider.launcher
|
def launcher = app.scalaProvider.launcher
|
||||||
|
|
||||||
val logger = new FilterLogger(log)
|
val logger = new FilterLogger(log)
|
||||||
|
/** The base path for the project, preserving information to the root project directory.*/
|
||||||
val projectPath: Path =
|
val projectPath: Path =
|
||||||
{
|
{
|
||||||
val toRoot = parent.flatMap(p => Path.relativize(p.info.projectPath, projectDirectory))
|
val toRoot = parent.flatMap(p => Path.relativize(p.info.projectPath, projectDirectory))
|
||||||
new ProjectDirectory(projectDirectory, toRoot)
|
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
|
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
|
def bootPath = builderPath / Project.BootDirectoryName
|
||||||
|
/** The path to the build definition project. */
|
||||||
def builderProjectPath = builderPath / Project.BuilderProjectDirectoryName
|
def builderProjectPath = builderPath / Project.BuilderProjectDirectoryName
|
||||||
def builderProjectOutputPath = builderProjectPath / Project.DefaultOutputDirectoryName
|
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 pluginsPath = builderPath / Project.PluginProjectDirectoryName
|
||||||
def pluginsOutputPath = pluginsPath / Project.DefaultOutputDirectoryName
|
def pluginsOutputPath = pluginsPath / Project.DefaultOutputDirectoryName
|
||||||
|
/** The path to which the source code for plugins are extracted.*/
|
||||||
def pluginsManagedSourcePath = pluginsPath / BasicDependencyPaths.DefaultManagedSourceDirectoryName
|
def pluginsManagedSourcePath = pluginsPath / BasicDependencyPaths.DefaultManagedSourceDirectoryName
|
||||||
|
/** The path to which plugins are retrieved.*/
|
||||||
def pluginsManagedDependencyPath = pluginsPath / BasicDependencyPaths.DefaultManagedDirectoryName
|
def pluginsManagedDependencyPath = pluginsPath / BasicDependencyPaths.DefaultManagedDirectoryName
|
||||||
|
|
||||||
|
/** The classpath containing all jars comprising sbt, except for the launcher.*/
|
||||||
def sbtClasspath = Path.finder(app.mainClasspath)
|
def sbtClasspath = Path.finder(app.mainClasspath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue