sbt/main/Keys.scala

233 lines
11 KiB
Scala
Raw Normal View History

2011-02-27 05:34:39 +01:00
/* sbt -- Simple Build Tool
* Copyright 2011 Mark Harrah
*/
package sbt
import java.io.File
2011-04-07 03:00:48 +02:00
import Project.ScopedKey
2011-02-27 05:34:39 +01:00
import complete._
import inc.Analysis
import std.TaskExtra._
import scala.xml.NodeSeq
import org.apache.ivy.core.module.{descriptor, id}
import descriptor.ModuleDescriptor, id.ModuleRevisionId
import org.scalatools.testing.Framework
object Keys
{
2011-02-27 06:36:54 +01:00
// logging
2011-03-02 12:46:28 +01:00
val logLevel = SettingKey[Level.Value]("log-level")
val persistLogLevel = SettingKey[Level.Value]("persist-log-level")
val traceLevel = SettingKey[Int]("trace-level")
2011-03-21 03:54:01 +01:00
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")
2011-02-27 06:36:54 +01:00
2011-02-27 05:56:30 +01:00
// Project keys
2011-03-02 12:46:28 +01:00
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")
2011-03-02 12:46:28 +01:00
val appConfiguration = SettingKey[xsbti.AppConfiguration]("app-configuration")
val thisProject = SettingKey[ResolvedProject]("this-project")
2011-03-02 12:46:28 +01:00
val thisProjectRef = SettingKey[ProjectRef]("this-project-ref")
val configuration = SettingKey[Configuration]("configuration")
val commands = SettingKey[Seq[Command]]("commands")
2011-04-05 00:23:51 +02:00
val initialize = SettingKey[Unit]("initialize")
2011-02-27 05:56:30 +01:00
// Command keys
2011-03-02 12:46:28 +01:00
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")
2011-02-27 05:56:30 +01:00
2011-02-27 05:34:39 +01:00
// Path Keys
2011-03-02 12:46:28 +01:00
val baseDirectory = SettingKey[File]("base-directory")
val target = SettingKey[File]("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 crossPaths = SettingKey[Boolean]("cross-paths")
2011-02-27 05:34:39 +01:00
// compile/doc keys
2011-04-12 04:12:03 +02:00
val autoCompilerPlugins = SettingKey[Boolean]("auto-compiler-plugins")
2011-03-02 12:46:28 +01:00
val maxErrors = SettingKey[Int]("max-errors")
val scaladocOptions = SettingKey[Seq[String]]("scaladoc-options")
val scalacOptions = SettingKey[Seq[String]]("scalac-options")
val javacOptions = SettingKey[Seq[String]]("javac-options")
2011-04-04 03:15:35 +02:00
val compileOrder = SettingKey[CompileOrder.Value]("compile-order")
2011-03-02 12:46:28 +01:00
val initialCommands = SettingKey[String]("initial-commands")
val compileInputs = TaskKey[Compiler.Inputs]("compile-inputs")
val scalaHome = SettingKey[Option[File]]("scala-home")
2011-03-02 12:46:28 +01:00
val scalaInstance = SettingKey[ScalaInstance]("scala-instance")
val scalaVersion = SettingKey[String]("scala-version")
val crossScalaVersions = SettingKey[Seq[String]]("cross-scala-versions")
2011-03-08 23:50:19 +01:00
val classpathOptions = SettingKey[ClasspathOptions]("classpath-options")
2011-03-14 02:34:17 +01:00
val definedSbtPlugins = TaskKey[Set[String]]("defined-sbt-plugins")
val sbtPlugin = SettingKey[Boolean]("sbt-plugin")
2011-02-27 05:34:39 +01:00
2011-03-02 12:46:28 +01:00
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")
2011-03-02 12:46:28 +01:00
val doc = TaskKey[File]("doc")
val copyResources = TaskKey[Seq[(File,File)]]("copy-resources")
2011-03-02 12:46:28 +01:00
val resources = TaskKey[Seq[File]]("resources")
val aggregate = SettingKey[Aggregation]("aggregate")
2011-03-14 02:34:17 +01:00
val generatedResources = TaskKey[Seq[File]]("generated-resources")
val generatedResourceDirectory = SettingKey[File]("generated-resource-directory")
2011-02-27 05:34:39 +01:00
// package keys
2011-03-02 12:46:28 +01:00
val packageBin = TaskKey[Package.Configuration]("package")
val packageDoc = TaskKey[Package.Configuration]("package-doc")
val packageSrc = TaskKey[Package.Configuration]("package-src")
val packageOptions = TaskKey[Seq[PackageOption]]("package-options")
val jarPath = SettingKey[File]("jar-path")
val jarName = SettingKey[ArtifactName]("jar-name")
val jarType = SettingKey[String]("jar-type")
val nameToString = SettingKey[ArtifactName => String]("name-to-string")
val mappings = TaskKey[Seq[(File,String)]]("mappings")
2011-02-27 05:34:39 +01:00
// Run Keys
2011-03-02 12:46:28 +01:00
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")
2011-03-02 12:46:28 +01:00
val discoveredMainClasses = TaskKey[Seq[String]]("discovered-main-classes")
val runner = SettingKey[ScalaRun]("runner")
2011-02-27 05:34:39 +01:00
2011-03-02 12:46:28 +01:00
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")
2011-02-27 05:34:39 +01:00
// Test Keys
2011-03-02 12:46:28 +01:00
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")
2011-03-02 12:46:28 +01:00
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")
2011-02-27 05:34:39 +01:00
// Classpath/Dependency Management Keys
type Classpath = Seq[Attributed[File]]
2011-03-02 12:46:28 +01:00
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")
2011-02-27 05:34:39 +01:00
2011-03-02 12:46:28 +01:00
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")
2011-02-27 05:34:39 +01:00
2011-03-02 12:46:28 +01:00
val ivyConfiguration = TaskKey[IvyConfiguration]("ivy-configuration")
2011-04-12 04:12:03 +02:00
val ivyConfigurations = SettingKey[Seq[Configuration]]("ivy-configurations")
2011-03-02 12:46:28 +01:00
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")
2011-02-27 05:34:39 +01:00
2011-03-02 12:46:28 +01:00
val publishConfiguration = TaskKey[PublishConfiguration]("publish-configuration")
val publishLocalConfiguration = TaskKey[PublishConfiguration]("publish-local-configuration")
val makePomConfiguration = SettingKey[MakePomConfiguration]("make-pom-configuration")
val packageToPublish = TaskKey[Unit]("package-to-publish")
val deliverDepends = TaskKey[Unit]("deliver-depends")
val publishMavenStyle = SettingKey[Boolean]("publish-maven-style")
2011-04-06 00:44:47 +02:00
val credentials = TaskKey[Seq[Credentials]]("credentials")
2011-02-27 05:34:39 +01:00
2011-03-02 12:46:28 +01:00
val makePom = TaskKey[File]("make-pom")
val deliver = TaskKey[Unit]("deliver")
val deliverLocal = TaskKey[Unit]("deliver-local")
val publish = TaskKey[Unit]("publish")
val publishLocal = TaskKey[Unit]("publish-local")
2011-02-27 05:34:39 +01:00
2011-03-02 12:46:28 +01:00
val moduleID = SettingKey[String]("module-id")
val version = SettingKey[String]("version")
val projectID = SettingKey[ModuleID]("project-id")
val resolvers = SettingKey[Seq[Resolver]]("resolvers")
2011-03-02 12:46:28 +01:00
val projectResolver = TaskKey[Resolver]("project-resolver")
val fullResolvers = TaskKey[Seq[Resolver]]("full-resolvers")
2011-03-02 12:46:28 +01:00
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 pomName = SettingKey[ArtifactName]("pom-name")
val pomFile = SettingKey[File]("pom-file")
val pomArtifact = SettingKey[Seq[Artifact]]("pom-artifact")
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 sbtResolver = SettingKey[Resolver]("sbt-resolver")
val sbtDependency = SettingKey[ModuleID]("sbt-dependency")
2011-02-27 05:34:39 +01:00
// special
2011-03-02 12:46:28 +01:00
val settings = TaskKey[Settings[Scope]]("settings")
2011-04-07 03:00:48 +02:00
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")
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 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
base.copy(info = base.info.set(isDummyTask, true))
}
def isDummy(t: Task[_]): Boolean = t.info.attributes.get(isDummyTask) getOrElse false
2011-02-27 05:34:39 +01:00
}