diff --git a/main/Keys.scala b/main/Keys.scala index 2aebffcab..d3f2f1161 100644 --- a/main/Keys.scala +++ b/main/Keys.scala @@ -12,225 +12,228 @@ package sbt import org.apache.ivy.core.module.{descriptor, id} import descriptor.ModuleDescriptor, id.ModuleRevisionId import org.scalatools.testing.Framework + import Configurations.CompilerPlugin object Keys { + val TraceValues = "-1 to disable, 0 for up to the first sbt frame, or a positive number to set the maximum number of frames shown." + // logging - val logLevel = SettingKey[Level.Value]("log-level") - val persistLogLevel = SettingKey[Level.Value]("persist-log-level") - val traceLevel = SettingKey[Int]("trace-level") - val persistTraceLevel = SettingKey[Int]("persist-trace-level") - val showSuccess = SettingKey[Boolean]("show-success") - val showTiming = SettingKey[Boolean]("show-timing") - val timingFormat = SettingKey[java.text.DateFormat]("timing-format") - val logManager = SettingKey[LogManager]("log-manager") + val logLevel = SettingKey[Level.Value]("log-level", "The amount of logging sent to the screen.") + val persistLogLevel = SettingKey[Level.Value]("persist-log-level", "The amount of logging sent to a file for persistence.") + val traceLevel = SettingKey[Int]("trace-level", "The amount of a stack trace displayed. " + TraceValues) + val persistTraceLevel = SettingKey[Int]("persist-trace-level", "The amount of stack trace persisted.") + val showSuccess = SettingKey[Boolean]("show-success", "If true, displays a success message after running a command successfully.") + val showTiming = SettingKey[Boolean]("show-timing", "If true, the command success message includes the completion time.") + val timingFormat = SettingKey[java.text.DateFormat]("timing-format", "The format used for displaying the completion time.") + val logManager = SettingKey[LogManager]("log-manager", "The log manager, which creates Loggers for different contexts.") // Project keys - val projectCommand = AttributeKey[Boolean]("project-command") - val sessionSettings = AttributeKey[SessionSettings]("session-settings") - val stateBuildStructure = AttributeKey[Load.BuildStructure]("build-structure") - val buildStructure = TaskKey[Load.BuildStructure]("build-structure") - val appConfiguration = SettingKey[xsbti.AppConfiguration]("app-configuration") - val thisProject = SettingKey[ResolvedProject]("this-project") - val thisProjectRef = SettingKey[ProjectRef]("this-project-ref") - val configuration = SettingKey[Configuration]("configuration") - val commands = SettingKey[Seq[Command]]("commands") - val initialize = SettingKey[Unit]("initialize") + val projectCommand = AttributeKey[Boolean]("project-command", "Marks Commands that were registered for the current Project.") + val sessionSettings = AttributeKey[SessionSettings]("session-settings", "Tracks current build, project, and setting modifications.") + val stateBuildStructure = AttributeKey[Load.BuildStructure]("build-structure", "Data structure containing all information about the build definition.") + val buildStructure = TaskKey[Load.BuildStructure]("build-structure", "Provides access to the build structure, settings, and streams manager.") + val appConfiguration = SettingKey[xsbti.AppConfiguration]("app-configuration", "Provides access to the launched sbt configuration, including the ScalaProvider, Launcher, and GlobalLock.") + val thisProject = SettingKey[ResolvedProject]("this-project", "Provides the current project for the referencing scope.") + val thisProjectRef = SettingKey[ProjectRef]("this-project-ref", "Provides a fully-resolved reference to the current project for the referencing scope.") + val configuration = SettingKey[Configuration]("configuration", "Provides the current configuration of the referencing scope.") + val commands = SettingKey[Seq[Command]]("commands", "Defines commands to be registered when this project or build is the current selected one.") + val initialize = SettingKey[Unit]("initialize", "A convenience setting for performing side-effects during initialization.") // Command keys - val logged = AttributeKey[Logger]("log") - val historyPath = SettingKey[Option[File]]("history") - val shellPrompt = SettingKey[State => String]("shell-prompt") - val analysis = AttributeKey[inc.Analysis]("analysis") - val watch = SettingKey[Watched]("watch") - val pollInterval = SettingKey[Int]("poll-interval") - val watchSources = TaskKey[Seq[File]]("watch-sources") - val watchTransitiveSources = TaskKey[Seq[File]]("watch-transitive-sources") + val logged = AttributeKey[Logger]("log", "Provides a Logger for commands.") + val historyPath = SettingKey[Option[File]]("history", "The location where command line history is persisted.") + val shellPrompt = SettingKey[State => String]("shell-prompt", "The function that constructs the command prompt from the current build state.") + val analysis = AttributeKey[inc.Analysis]("analysis", "Analysis of compilation, including dependencies and generated outputs.") + val watch = SettingKey[Watched]("watch", "Continuous execution configuration.") + val pollInterval = SettingKey[Int]("poll-interval", "Interval between checks for modified sources by the continuous execution command.") + val watchSources = TaskKey[Seq[File]]("watch-sources", "Defines the sources in this project for continuous execution to watch for changes.") + val watchTransitiveSources = TaskKey[Seq[File]]("watch-transitive-sources", "Defines the sources in all projects for continuous execution to watch.") // Path Keys - val baseDirectory = SettingKey[File]("base-directory") - val target = SettingKey[File]("target") - val crossTarget = SettingKey[File]("cross-target") - val sourceDirectory = SettingKey[File]("source-directory") - val sourceManaged = SettingKey[File]("source-managed") - val scalaSource = SettingKey[File]("scala-source") - val javaSource = SettingKey[File]("java-source") - val resourceDirectory = SettingKey[File]("resource-directory") - val sourceDirectories = SettingKey[Seq[File]]("source-directories") - val resourceDirectories = SettingKey[Seq[File]]("resource-directories") - val classDirectory = SettingKey[File]("class-directory") - val docDirectory = SettingKey[File]("doc-directory") - val cacheDirectory = SettingKey[File]("cache-directory") - val sourceFilter = SettingKey[FileFilter]("source-filter") - val defaultExcludes = SettingKey[FileFilter]("default-excludes") - val sources = TaskKey[Seq[File]]("sources") - val cleanFiles = SettingKey[Seq[File]]("clean-files") - val cleanKeepFiles = SettingKey[Seq[File]]("clean-keep-files") - val crossPaths = SettingKey[Boolean]("cross-paths") + val baseDirectory = SettingKey[File]("base-directory", "The base directory. Depending on the scope, this is the base directory for the build, project, configuration, or task.") + val target = SettingKey[File]("target", "Main directory for files generated by the build.") + val crossTarget = SettingKey[File]("cross-target", "Main directory for files generated by the build that are cross-built.") + val sourceDirectory = SettingKey[File]("source-directory", "Default directory containing sources.") + val sourceManaged = SettingKey[File]("source-managed", "Default directory for generated sources.") + val scalaSource = SettingKey[File]("scala-source", "Default Scala source directory.") + val javaSource = SettingKey[File]("java-source", "Default Java source directory.") + val resourceDirectory = SettingKey[File]("resource-directory", "Default resource directory.") + val sourceDirectories = SettingKey[Seq[File]]("source-directories", "List of source directories.") + val resourceDirectories = SettingKey[Seq[File]]("resource-directories", "List of resource directories.") + val classDirectory = SettingKey[File]("class-directory", "Directory for compiled classes and copied resources.") + val docDirectory = SettingKey[File]("doc-directory", "Directory for generated documentation.") + val cacheDirectory = SettingKey[File]("cache-directory", "Directory used for caching task data.") + val sourceFilter = SettingKey[FileFilter]("source-filter", "Filter for selecting sources from default directories.") + val defaultExcludes = SettingKey[FileFilter]("default-excludes", "Filter for excluding files, such as sources and resources, by default.") + val sources = TaskKey[Seq[File]]("sources", "Defines sources, such as for compilation.") + val cleanFiles = SettingKey[Seq[File]]("clean-files", "The files to recursively delete during a clean.") + val cleanKeepFiles = SettingKey[Seq[File]]("clean-keep-files", "Files to keep during a clean.") + val crossPaths = SettingKey[Boolean]("cross-paths", "If true, enables cross paths, which distinguish output directories for cross-building.") // compile/doc keys - val autoCompilerPlugins = SettingKey[Boolean]("auto-compiler-plugins") - val maxErrors = SettingKey[Int]("max-errors") - val scaladocOptions = TaskKey[Seq[String]]("scaladoc-options") - val scalacOptions = TaskKey[Seq[String]]("scalac-options") - val javacOptions = SettingKey[Seq[String]]("javac-options") - val compileOrder = SettingKey[CompileOrder.Value]("compile-order") - val initialCommands = SettingKey[String]("initial-commands") - val compileInputs = TaskKey[Compiler.Inputs]("compile-inputs") - val scalaHome = SettingKey[Option[File]]("scala-home") - val scalaInstance = SettingKey[ScalaInstance]("scala-instance") - val scalaVersion = SettingKey[String]("scala-version") - val crossScalaVersions = SettingKey[Seq[String]]("cross-scala-versions") - val classpathOptions = SettingKey[ClasspathOptions]("classpath-options") - val definedSbtPlugins = TaskKey[Set[String]]("defined-sbt-plugins") - val sbtPlugin = SettingKey[Boolean]("sbt-plugin") + val autoCompilerPlugins = SettingKey[Boolean]("auto-compiler-plugins", "If true, enables automatically generating -Xplugin arguments to the compiler based on the classpath for the " + CompilerPlugin.name + " configuration.") + val maxErrors = SettingKey[Int]("max-errors", "The maximum number of errors, such as compile errors, to list.") + val scaladocOptions = TaskKey[Seq[String]]("scaladoc-options", "Options for Scaladoc.") + val scalacOptions = TaskKey[Seq[String]]("scalac-options", "Options for the Scala compiler.") + val javacOptions = SettingKey[Seq[String]]("javac-options", "Options for the Java compiler.") + val compileOrder = SettingKey[CompileOrder.Value]("compile-order", "Configures the order in which Java and sources within a single compilation are compiled. Valid values are: JavaThenScala, ScalaThenJava, or Mixed.") + val initialCommands = SettingKey[String]("initial-commands", "Initial commands to execute when starting up the Scala interpreter.") + val compileInputs = TaskKey[Compiler.Inputs]("compile-inputs", "Collects all inputs needed for compilation.") + val scalaHome = SettingKey[Option[File]]("scala-home", "If Some, defines the local Scala installation to use for compilation, running, and testing.") + val scalaInstance = SettingKey[ScalaInstance]("scala-instance", "Defines the Scala instance to use for compilation, running, and testing.") + val scalaVersion = SettingKey[String]("scala-version", "The version of Scala used for building.") + val crossScalaVersions = SettingKey[Seq[String]]("cross-scala-versions", "The versions of Scala used when cross-building.") + val classpathOptions = SettingKey[ClasspathOptions]("classpath-options", "Configures handling of Scala classpaths.") + val definedSbtPlugins = TaskKey[Set[String]]("defined-sbt-plugins", "The set of names of Plugin implementations defined by this project.") + val sbtPlugin = SettingKey[Boolean]("sbt-plugin", "If true, enables adding sbt as a dependency and auto-generation of the plugin descriptor file.") - val clean = TaskKey[Unit]("clean") - val console = TaskKey[Unit]("console") - val consoleQuick = TaskKey[Unit]("console-quick") - val consoleProject = TaskKey[Unit]("console-project") - val compile = TaskKey[Analysis]("compile") - val compilers = TaskKey[Compiler.Compilers]("compilers") - val doc = TaskKey[File]("doc") - val copyResources = TaskKey[Seq[(File,File)]]("copy-resources") - val resources = TaskKey[Seq[File]]("resources") - val aggregate = SettingKey[Aggregation]("aggregate") - val generatedResources = TaskKey[Seq[File]]("generated-resources") - val generatedResourceDirectory = SettingKey[File]("generated-resource-directory") + val clean = TaskKey[Unit]("clean", "Deletes files produced by the build, such as generated sources, compiled classes, and task caches.") + val console = TaskKey[Unit]("console", "Starts the Scala interpreter with the project classes on the classpath.") + val consoleQuick = TaskKey[Unit]("console-quick", "Starts the Scala interpreter with the project dependencies on the classpath.") + val consoleProject = TaskKey[Unit]("console-project", "Starts the Scala interpreter with the sbt and the build definition on the classpath and useful imports.") + val compile = TaskKey[Analysis]("compile", "Compiles sources.") + val compilers = TaskKey[Compiler.Compilers]("compilers", "Defines the Scala and Java compilers to use for compilation.") + val doc = TaskKey[File]("doc", "Generates API documentation.") + val copyResources = TaskKey[Seq[(File,File)]]("copy-resources", "Copies resources to the output directory.") + val resources = TaskKey[Seq[File]]("resources", "Defines resource files.") + val aggregate = SettingKey[Aggregation]("aggregate", "Configures task aggregation.") + val generatedResources = TaskKey[Seq[File]]("generated-resources", "Resources generated by the build.") + val generatedResourceDirectory = SettingKey[File]("generated-resource-directory", "Default target directory used when generating resources.") // package keys - val packageBin = TaskKey[File]("package") - val packageDoc = TaskKey[File]("package-doc") - val packageSrc = TaskKey[File]("package-src") + val packageBin = TaskKey[File]("package", "Produces the main artifact, such as a binary jar.") + val packageDoc = TaskKey[File]("package-doc", "Produces a documentation artifact, such as a jar containing API documentation.") + val packageSrc = TaskKey[File]("package-src", "Produces a source artifact, such as a jar containing sources and resources.") - val packageOptions = TaskKey[Seq[PackageOption]]("package-options") - val packageConfiguration = TaskKey[Package.Configuration]("package-configuration") - val artifactPath = SettingKey[File]("artifact-path") - val artifact = SettingKey[Artifact]("artifact") - val artifactClassifier = SettingKey[Option[String]]("artifact-classifier") - val artifactName = SettingKey[(String, ModuleID, Artifact) => String]("artifact-name") - val mappings = TaskKey[Seq[(File,String)]]("mappings") + val packageOptions = TaskKey[Seq[PackageOption]]("package-options", "Options for packaging.") + val packageConfiguration = TaskKey[Package.Configuration]("package-configuration", "Collects all inputs needed for packaging.") + val artifactPath = SettingKey[File]("artifact-path", "The location of a generated artifact.") + val artifact = SettingKey[Artifact]("artifact", "Describes an artifact.") + val artifactClassifier = SettingKey[Option[String]]("artifact-classifier", "Sets the classifier used by the default artifact definition.") + val artifactName = SettingKey[(String, ModuleID, Artifact) => String]("artifact-name", "Function that produces the artifact name from its definition.") + val mappings = TaskKey[Seq[(File,String)]]("mappings", "Defines the mappings from a file to a path, used by packaging, for example.") // Run Keys - val selectMainClass = TaskKey[Option[String]]("select-main-class") - val mainClass = TaskKey[Option[String]]("main-class") - val run = InputKey[Unit]("run") - val runMain = InputKey[Unit]("run-main") - val discoveredMainClasses = TaskKey[Seq[String]]("discovered-main-classes") - val runner = SettingKey[ScalaRun]("runner") + val selectMainClass = TaskKey[Option[String]]("select-main-class", "Selects the main class to run.") + val mainClass = TaskKey[Option[String]]("main-class", "Defines the main class for packaging or running.") + val run = InputKey[Unit]("run", "Runs a main class, passing along arguments provided on the command line.") + val runMain = InputKey[Unit]("run-main", "Runs the main class selected by the first argument, passing the remaining arguments to the main method.") + val discoveredMainClasses = TaskKey[Seq[String]]("discovered-main-classes", "Auto-detects main classes.") + val runner = SettingKey[ScalaRun]("runner", "Implementation used to run a main class.") - val fork = SettingKey[Boolean]("fork") - val outputStrategy = SettingKey[Option[sbt.OutputStrategy]]("output-strategy") - val javaHome = SettingKey[Option[File]]("java-home") - val javaOptions = SettingKey[Seq[String]]("java-options") + val fork = SettingKey[Boolean]("fork", "If true, forks a new JVM when running. If false, runs in the same JVM as the build.") + val outputStrategy = SettingKey[Option[sbt.OutputStrategy]]("output-strategy", "Selects how to log output when running a main class.") + val javaHome = SettingKey[Option[File]]("java-home", "Selects the Java installation used for compiling and forking. If None, uses the Java installation running the build.") + val javaOptions = SettingKey[Seq[String]]("java-options", "Options passed to a new JVM when forking.") // Test Keys - val testLoader = TaskKey[ClassLoader]("test-loader") - val loadedTestFrameworks = TaskKey[Map[TestFramework,Framework]]("loaded-test-frameworks") - val definedTests = TaskKey[Seq[TestDefinition]]("defined-tests") - val executeTests = TaskKey[Tests.Output]("execute-tests") - val test = TaskKey[Unit]("test") - val testOnly = InputKey[Unit]("test-only") - val testOptions = TaskKey[Seq[TestOption]]("test-options") - val testFrameworks = SettingKey[Seq[TestFramework]]("test-frameworks") - val testListeners = TaskKey[Seq[TestReportListener]]("test-listeners") + val testLoader = TaskKey[ClassLoader]("test-loader", "Provides the class loader used for testing.") + val loadedTestFrameworks = TaskKey[Map[TestFramework,Framework]]("loaded-test-frameworks", "Loads Framework definitions from the test loader.") + val definedTests = TaskKey[Seq[TestDefinition]]("defined-tests", "Provides the list of defined tests.") + val executeTests = TaskKey[Tests.Output]("execute-tests", "Executes all tests, producing a report.") + val test = TaskKey[Unit]("test", "Executes all tests.") + val testOnly = InputKey[Unit]("test-only", "Executes the tests provided as arguments or all tests if no arguments are provided.") + val testOptions = TaskKey[Seq[TestOption]]("test-options", "Options for running tests.") + val testFrameworks = SettingKey[Seq[TestFramework]]("test-frameworks", "Registered, although not necessarily present, test frameworks.") + val testListeners = TaskKey[Seq[TestReportListener]]("test-listeners", "Defines test listeners.") // Classpath/Dependency Management Keys type Classpath = Seq[Attributed[File]] - val name = SettingKey[String]("name") - val normalizedName = SettingKey[String]("normalized-name") - val organization = SettingKey[String]("organization") - val defaultConfiguration = SettingKey[Option[Configuration]]("default-configuration") - val defaultConfigurationMapping = SettingKey[String]("default-configuration-mapping") + val name = SettingKey[String]("name", "Name.") + val normalizedName = SettingKey[String]("normalized-name", "Name transformed from mixed case and spaces to lowercase and dash-separated.") + val organization = SettingKey[String]("organization", "Organization/group ID.") + val defaultConfiguration = SettingKey[Option[Configuration]]("default-configuration", "Defines the configuration used when none is specified for a dependency.") + val defaultConfigurationMapping = SettingKey[String]("default-configuration-mapping", "Defines the mapping used for a simple, unmapped configuration definition.") - val products = TaskKey[Classpath]("products") - val unmanagedClasspath = TaskKey[Classpath]("unmanaged-classpath") - val unmanagedJars = TaskKey[Classpath]("unmanaged-jars") - val managedClasspath = TaskKey[Classpath]("managed-classpath") - val internalDependencyClasspath = TaskKey[Classpath]("internal-dependency-classpath") - val externalDependencyClasspath = TaskKey[Classpath]("external-dependency-classpath") - val dependencyClasspath = TaskKey[Classpath]("dependency-classpath") - val fullClasspath = TaskKey[Classpath]("full-classpath") + val products = TaskKey[Classpath]("products", "Build products that go on the exported classpath.") + val unmanagedClasspath = TaskKey[Classpath]("unmanaged-classpath", "Classpath entries (deep) that are manually managed.") + val unmanagedJars = TaskKey[Classpath]("unmanaged-jars", "Classpath entries for the current project (shallow) that are manually managed.") + val managedClasspath = TaskKey[Classpath]("managed-classpath", "The classpath consisting of external, managed library dependencies.") + val internalDependencyClasspath = TaskKey[Classpath]("internal-dependency-classpath", "The internal (inter-project) classpath.") + val externalDependencyClasspath = TaskKey[Classpath]("external-dependency-classpath", "The classpath consisting of library dependencies, both managed and unmanaged.") + val dependencyClasspath = TaskKey[Classpath]("dependency-classpath", "The classpath consisting of internal and external, managed and unmanaged dependencies.") + val fullClasspath = TaskKey[Classpath]("full-classpath", "The exported classpath, consisting of build products and unmanaged and managed, internal and external dependencies.") - val internalConfigurationMap = SettingKey[Configuration => Configuration]("internal-configuration-map") - val classpathConfiguration = SettingKey[Configuration]("classpath-configuration") - val ivyConfiguration = TaskKey[IvyConfiguration]("ivy-configuration") - val ivyConfigurations = SettingKey[Seq[Configuration]]("ivy-configurations") - val moduleSettings = TaskKey[ModuleSettings]("module-settings") - val unmanagedBase = SettingKey[File]("unmanaged-base") - val updateConfiguration = SettingKey[UpdateConfiguration]("update-configuration") - val ivySbt = TaskKey[IvySbt]("ivy-sbt") - val ivyModule = TaskKey[IvySbt#Module]("ivy-module") - val classpathFilter = SettingKey[FileFilter]("classpath-filter") - val update = TaskKey[UpdateReport]("update") - val updateClassifiers = TaskKey[UpdateReport]("update-classifiers") - val transitiveClassifiers = SettingKey[Seq[String]]("transitive-classifiers") - val updateSbtClassifiers = TaskKey[UpdateReport]("update-sbt-classifiers") + val internalConfigurationMap = SettingKey[Configuration => Configuration]("internal-configuration-map", "Maps configurations to the actual configuration used to define the classpath.") + val classpathConfiguration = SettingKey[Configuration]("classpath-configuration", "The configuration used to define the classpath.") + val ivyConfiguration = TaskKey[IvyConfiguration]("ivy-configuration", "General dependency management (Ivy) settings, such as the resolvers and paths to use.") + val ivyConfigurations = SettingKey[Seq[Configuration]]("ivy-configurations", "The defined configurations for dependency management. This may be different from the configurations for Project settings.") + val moduleSettings = TaskKey[ModuleSettings]("module-settings", "Module settings, which configure a specific module, such as a project.") + val unmanagedBase = SettingKey[File]("unmanaged-base", "The default directory for manually managed directories.") + val updateConfiguration = SettingKey[UpdateConfiguration]("update-configuration", "Configuration for resolving and retrieving managed dependencies.") + val ivySbt = TaskKey[IvySbt]("ivy-sbt", "Provides the sbt interface to Ivy.") + val ivyModule = TaskKey[IvySbt#Module]("ivy-module", "Provides the sbt interface to a configured Ivy module.") + val classpathFilter = SettingKey[FileFilter]("classpath-filter", "Filter for selecting unmanaged dependencies.") + val update = TaskKey[UpdateReport]("update", "Resolves and optionally retrieves dependencies, producing a report.") + val updateClassifiers = TaskKey[UpdateReport]("update-classifiers", "Resolves and optionally retrieves classified artifacts, such as javadocs and sources, for dependency definitions, transitively.") + val transitiveClassifiers = SettingKey[Seq[String]]("transitive-classifiers", "List of classifiers used for transitively obtaining extra artifacts for sbt or declared dependencies.") + val updateSbtClassifiers = TaskKey[UpdateReport]("update-sbt-classifiers", "Resolves and optionally retrieves classifiers, such as javadocs and sources, for sbt, transitively.") - val publishConfiguration = TaskKey[PublishConfiguration]("publish-configuration") - val publishLocalConfiguration = TaskKey[PublishConfiguration]("publish-local-configuration") - val deliverConfiguration = TaskKey[DeliverConfiguration]("deliver-configuration") - val deliverLocalConfiguration = TaskKey[DeliverConfiguration]("deliver-local-configuration") - val makePomConfiguration = SettingKey[MakePomConfiguration]("make-pom-configuration") - val packagedArtifacts = TaskKey[Map[Artifact,File]]("packaged-artifacts") - val publishMavenStyle = SettingKey[Boolean]("publish-maven-style") - val credentials = TaskKey[Seq[Credentials]]("credentials") + val publishConfiguration = TaskKey[PublishConfiguration]("publish-configuration", "Configuration for publishing to a repository.") + val publishLocalConfiguration = TaskKey[PublishConfiguration]("publish-local-configuration", "Configuration for publishing to the local repository.") + val deliverConfiguration = TaskKey[DeliverConfiguration]("deliver-configuration", "Configuration for generating the finished Ivy file for publishing.") + val deliverLocalConfiguration = TaskKey[DeliverConfiguration]("deliver-local-configuration", "Configuration for generating the finished Ivy file for local publishing.") + val makePomConfiguration = SettingKey[MakePomConfiguration]("make-pom-configuration", "Configuration for generating a pom.") + val packagedArtifacts = TaskKey[Map[Artifact,File]]("packaged-artifacts", "Packages all artifacts for publishing and maps the Artifact definition to the generated file.") + val publishMavenStyle = SettingKey[Boolean]("publish-maven-style", "Configures whether to generate and publish a pom (true) or Ivy file (false).") + val credentials = TaskKey[Seq[Credentials]]("credentials", "The credentials to use for updating and publishing.") - val makePom = TaskKey[File]("make-pom") - val deliver = TaskKey[File]("deliver") - val deliverLocal = TaskKey[File]("deliver-local") - val publish = TaskKey[Unit]("publish") - val publishLocal = TaskKey[Unit]("publish-local") + val makePom = TaskKey[File]("make-pom", "Generates a pom for publishing when publishing Maven-style.") + val deliver = TaskKey[File]("deliver", "Generates the Ivy file for publishing to a repository.") + val deliverLocal = TaskKey[File]("deliver-local", "Generates the Ivy file for publishing to the local repository.") + val publish = TaskKey[Unit]("publish", "Publishes artifacts to a repository.") + val publishLocal = TaskKey[Unit]("publish-local", "Publishes artifacts to the local repository.") - val moduleID = SettingKey[String]("module-id") - val version = SettingKey[String]("version") - val projectID = SettingKey[ModuleID]("project-id") - val resolvers = SettingKey[Seq[Resolver]]("resolvers") - val projectResolver = TaskKey[Resolver]("project-resolver") - val fullResolvers = TaskKey[Seq[Resolver]]("full-resolvers") - val otherResolvers = SettingKey[Seq[Resolver]]("other-resolvers") - val moduleConfigurations = SettingKey[Seq[ModuleConfiguration]]("module-configurations") - val retrievePattern = SettingKey[String]("retrieve-pattern") - val retrieveConfiguration = SettingKey[Option[RetrieveConfiguration]]("retrieve-configuration") - val offline = SettingKey[Boolean]("offline") - val ivyPaths = SettingKey[IvyPaths]("ivy-paths") - val libraryDependencies = SettingKey[Seq[ModuleID]]("library-dependencies") - val allDependencies = TaskKey[Seq[ModuleID]]("all-dependencies") - val projectDependencies = TaskKey[Seq[ModuleID]]("project-dependencies") - val ivyXML = SettingKey[NodeSeq]("ivy-xml") - val ivyScala = SettingKey[Option[IvyScala]]("ivy-scala") - val ivyValidate = SettingKey[Boolean]("ivy-validate") - val ivyLoggingLevel = SettingKey[UpdateLogging.Value]("ivy-logging-level") - val publishTo = SettingKey[Option[Resolver]]("publish-to") - val artifacts = SettingKey[Seq[Artifact]]("artifacts") - val projectDescriptors = TaskKey[Map[ModuleRevisionId,ModuleDescriptor]]("project-descriptors") - val autoUpdate = SettingKey[Boolean]("auto-update") - val retrieveManaged = SettingKey[Boolean]("retrieve-managed") - val managedDirectory = SettingKey[File]("managed-directory") - val classpathTypes = SettingKey[Set[String]]("classpath-types") - val publishArtifact = SettingKey[Boolean]("publish-artifact") - val packagedArtifact = TaskKey[(Artifact, File)]("packaged-artifact") - val checksums = SettingKey[Seq[String]]("checksums") + val moduleID = SettingKey[String]("module-id", "The name of the current module, used for dependency management.") + val version = SettingKey[String]("version", "The version/revision of the current module.") + val projectID = SettingKey[ModuleID]("project-id", "The dependency management descriptor for the current module.") + val resolvers = SettingKey[Seq[Resolver]]("resolvers", "The user-defined additional resolvers for automatically managed dependencies.") + val projectResolver = TaskKey[Resolver]("project-resolver", "Resolver that handles inter-project dependencies.") + val fullResolvers = TaskKey[Seq[Resolver]]("full-resolvers", "Combines the project resolver, default resolvers, and user-defined resolvers.") + val otherResolvers = SettingKey[Seq[Resolver]]("other-resolvers", "Resolvers not included in the main resolver chain, such as those in module configurations.") + val moduleConfigurations = SettingKey[Seq[ModuleConfiguration]]("module-configurations", "Defines module configurations, which override resolvers on a per-module basis.") + val retrievePattern = SettingKey[String]("retrieve-pattern", "Pattern used to retrieve managed dependencies to the current build.") + val retrieveConfiguration = SettingKey[Option[RetrieveConfiguration]]("retrieve-configuration", "Configures retrieving dependencies to the current build.") + val offline = SettingKey[Boolean]("offline", "Configures sbt to work without a network connection where possible.") + val ivyPaths = SettingKey[IvyPaths]("ivy-paths", "Configures paths used by Ivy for dependency management.") + val libraryDependencies = SettingKey[Seq[ModuleID]]("library-dependencies", "Declares managed dependencies.") + val allDependencies = TaskKey[Seq[ModuleID]]("all-dependencies", "Inter-project and library dependencies.") + val projectDependencies = TaskKey[Seq[ModuleID]]("project-dependencies", "Inter-project dependencies.") + val ivyXML = SettingKey[NodeSeq]("ivy-xml", "Defines inline Ivy XML for configuring dependency management.") + val ivyScala = SettingKey[Option[IvyScala]]("ivy-scala", "Configures how Scala dependencies are checked, filtered, and injected.") + val ivyValidate = SettingKey[Boolean]("ivy-validate", "Enables/disables Ivy validation of module metadata.") + val ivyLoggingLevel = SettingKey[UpdateLogging.Value]("ivy-logging-level", "The logging level for updating.") + val publishTo = SettingKey[Option[Resolver]]("publish-to", "The resolver to publish to.") + val artifacts = SettingKey[Seq[Artifact]]("artifacts", "The artifact definitions for the current module. Must be consistent with " + packagedArtifacts.key.label + ".") + val projectDescriptors = TaskKey[Map[ModuleRevisionId,ModuleDescriptor]]("project-descriptors", "Project dependency map for the inter-project resolver.") + val autoUpdate = SettingKey[Boolean]("auto-update", "") + val retrieveManaged = SettingKey[Boolean]("retrieve-managed", "If true, enables retrieving dependencies to the current build. Otherwise, dependencies are used directly from the cache.") + val managedDirectory = SettingKey[File]("managed-directory", "Directory to which managed dependencies are retrieved.") + val classpathTypes = SettingKey[Set[String]]("classpath-types", "Artifact types that are included on the classpath.") + val publishArtifact = SettingKey[Boolean]("publish-artifact", "Enables (true) or disables (false) publishing an artifact.") + val packagedArtifact = TaskKey[(Artifact, File)]("packaged-artifact", "Generates a packaged artifact, returning the Artifact and the produced File.") + val checksums = SettingKey[Seq[String]]("checksums", "The list of checksums to generate and to verify for dependencies.") - val sbtResolver = SettingKey[Resolver]("sbt-resolver") - val sbtDependency = SettingKey[ModuleID]("sbt-dependency") + val sbtResolver = SettingKey[Resolver]("sbt-resolver", "Provides a resolver for obtaining sbt as a dependency.") + val sbtDependency = SettingKey[ModuleID]("sbt-dependency", "Provides a definition for declaring the current version of sbt.") // special - val settings = TaskKey[Settings[Scope]]("settings") - val streams = TaskKey[TaskStreams]("streams") - val isDummyTask = AttributeKey[Boolean]("is-dummy-task") - val taskDefinitionKey = AttributeKey[ScopedKey[_]]("task-definition-key") - val (state, dummyState) = dummy[State]("state") - val (streamsManager, dummyStreamsManager) = dummy[Streams]("streams-manager") - val resolvedScoped = SettingKey[ScopedKey[_]]("resolved-scoped") - private[sbt] val parseResult: TaskKey[_] = TaskKey("$parse-result") + val settings = TaskKey[Settings[Scope]]("settings", "Provides access to the project data for the build.") + val streams = TaskKey[TaskStreams]("streams", "Provides streams for logging and persisting data.") + val isDummyTask = AttributeKey[Boolean]("is-dummy-task", "Internal: used to identify dummy tasks. sbt injects values for these tasks at the start of task execution.") + val taskDefinitionKey = AttributeKey[ScopedKey[_]]("task-definition-key", "Internal: used to map a task back to its ScopedKey.") + val (state, dummyState) = dummy[State]("state", "Current build state.") + val (streamsManager, dummyStreamsManager) = dummy[Streams]("streams-manager", "Streams manager, which provides streams for different contexts.") + val resolvedScoped = SettingKey[ScopedKey[_]]("resolved-scoped", "The ScopedKey for the referencing setting or task.") + private[sbt] val parseResult: TaskKey[_] = TaskKey("$parse-result", "Internal: used to implement input tasks.") type Streams = std.Streams[ScopedKey[_]] type TaskStreams = std.TaskStreams[ScopedKey[_]] - def dummy[T](name: String): (TaskKey[T], Task[T]) = (TaskKey[T](name), dummyTask(name)) + def dummy[T](name: String, description: String): (TaskKey[T], Task[T]) = (TaskKey[T](name, description), dummyTask(name)) def dummyTask[T](name: String): Task[T] = { val base: Task[T] = task( error("Dummy task '" + name + "' did not get converted to a full task.") ) named name diff --git a/main/Main.scala b/main/Main.scala index 0b502f8c1..40abca2cd 100644 --- a/main/Main.scala +++ b/main/Main.scala @@ -393,5 +393,5 @@ object BuiltinCommands def aliasBody(name: String, value: String)(state: State): Parser[() => State] = OptSpace ~> Parser(Command.combine(removeAlias(state,name).definedCommands)(state))(value) - val CommandAliasKey = AttributeKey[(String,String)]("is-command-alias") + val CommandAliasKey = AttributeKey[(String,String)]("is-command-alias", "Internal: marker for Commands created as aliases for another command.") } \ No newline at end of file diff --git a/main/Project.scala b/main/Project.scala index 927986716..4f11b1ca8 100644 --- a/main/Project.scala +++ b/main/Project.scala @@ -195,7 +195,11 @@ object Project extends Init[Scope] with ProjectExtra case Some(v: InputTask[_]) => "Input task" case Some(v) => "Value:\n\t" + v.toString } - val definedIn = structure.data.definingScope(scope, key) match { case Some(sc) => "Provided by:\n\t" + Scope.display(sc, key.label); case None => "" } + val description = key.description match { case Some(desc) => "Description:\n\t" + desc + "\n"; case None => "" } + val definedIn = structure.data.definingScope(scope, key) match { + case Some(sc) => "Provided by:\n\t" + Scope.display(sc, key.label) + "\n" + case None => "" + } val cMap = compiled(structure.settings, actual)(structure.delegates, structure.scopeLocal) val related = cMap.keys.filter(k => k.key == key && k.scope != scope) val depends = cMap.get(scoped) match { case Some(c) => c.dependencies.toSet; case None => Set.empty } @@ -204,7 +208,8 @@ object Project extends Init[Scope] with ProjectExtra if(scopes.isEmpty) "" else scopes.map(display).mkString(label + ":\n\t", "\n\t", "\n") value + "\n" + - definedIn + "\n" + + description + + definedIn + printScopes("Dependencies", depends) + printScopes("Reverse dependencies", reverse) + printScopes("Delegates", delegates(structure, scope, key)) + @@ -238,7 +243,7 @@ object Project extends Init[Scope] with ProjectExtra val loadActionParser = token(Space ~> ("plugins" ^^^ Plugins | "return" ^^^ Return)) ?? Current - val ProjectReturn = AttributeKey[List[File]]("project-return") + val ProjectReturn = AttributeKey[List[File]]("project-return", "Maintains a stack of builds visited using reload.") def projectReturn(s: State): List[File] = s.attributes get ProjectReturn getOrElse Nil def setProjectReturn(s: State, pr: List[File]): State = s.copy(attributes = s.attributes.put( ProjectReturn, pr) ) def loadAction(s: State, action: LoadAction.Value) = action match { diff --git a/main/Structure.scala b/main/Structure.scala index 2a67554b3..fa13e95c8 100644 --- a/main/Structure.scala +++ b/main/Structure.scala @@ -494,24 +494,24 @@ object Scoped } object InputKey { - def apply[T](label: String): InputKey[T] = - apply( AttributeKey[InputTask[T]](label) ) + def apply[T](label: String, description: String = ""): InputKey[T] = + apply( AttributeKey[InputTask[T]](label, description) ) def apply[T](akey: AttributeKey[InputTask[T]]): InputKey[T] = new InputKey[T](akey) } object TaskKey { - def apply[T](label: String): TaskKey[T] = - apply( AttributeKey[Task[T]](label) ) + def apply[T](label: String, description: String = ""): TaskKey[T] = + apply( AttributeKey[Task[T]](label, description) ) def apply[T](akey: AttributeKey[Task[T]]): TaskKey[T] = new TaskKey[T](akey) } object SettingKey { - def apply[T](label: String): SettingKey[T] = - apply( AttributeKey[T](label) ) + def apply[T](label: String, description: String = ""): SettingKey[T] = + apply( AttributeKey[T](label, description) ) def apply[T](akey: AttributeKey[T]): SettingKey[T] = new SettingKey[T](akey) diff --git a/main/Watched.scala b/main/Watched.scala index def8c918d..fcef81f1d 100644 --- a/main/Watched.scala +++ b/main/Watched.scala @@ -53,6 +53,6 @@ object Watched s.put(ContinuousState, WatchState.empty) } } - val ContinuousState = AttributeKey[WatchState]("watch state") - val Configuration = AttributeKey[Watched]("watched-configuration") + val ContinuousState = AttributeKey[WatchState]("watch state", "Internal: tracks state for continuous execution.") + val Configuration = AttributeKey[Watched]("watched-configuration", "Configures continuous execution.") } \ No newline at end of file diff --git a/main/actions/Package.scala b/main/actions/Package.scala index e2642b483..10a4af552 100644 --- a/main/actions/Package.scala +++ b/main/actions/Package.scala @@ -14,9 +14,8 @@ package sbt import DefaultProtocol.{FileFormat, immutableMapFormat, StringFormat, UnitFormat} import Cache.{defaultEquiv, hConsCache, hNilCache, streamFormat, wrapIn} import Tracked.{inputChanged, outputChanged} - import FileInfo.{exists, existsInputCache} + import FileInfo.exists import FilesInfo.lastModified - import lastModified.infosInputCache sealed trait PackageOption object Package diff --git a/util/collection/Attributes.scala b/util/collection/Attributes.scala index 4697c63b9..4c3a16873 100644 --- a/util/collection/Attributes.scala +++ b/util/collection/Attributes.scala @@ -6,15 +6,23 @@ package sbt import Types._ // T must be invariant to work properly. -// Because it is sealed and the only instances go through make, +// Because it is sealed and the only instances go through AttributeKey.apply, // a single AttributeKey instance cannot conform to AttributeKey[T] for different Ts sealed trait AttributeKey[T] { def label: String + def description: Option[String] override final def toString = label } object AttributeKey { - def apply[T](name: String): AttributeKey[T] = new AttributeKey[T] { def label = name } + def apply[T](name: String): AttributeKey[T] = new AttributeKey[T] { + def label = name + def description = None + } + def apply[T](name: String, description0: String): AttributeKey[T] = new AttributeKey[T] { + def label = name + def description = Some(description0) + } } trait AttributeMap