2011-01-19 00:24:11 +01:00
|
|
|
/* sbt -- Simple Build Tool
|
|
|
|
|
* Copyright 2011 Mark Harrah
|
|
|
|
|
*/
|
|
|
|
|
package sbt
|
|
|
|
|
|
|
|
|
|
import java.io.File
|
2012-05-28 02:03:08 +02:00
|
|
|
import Keys.{name, organization, thisProject}
|
2012-07-31 17:52:10 +02:00
|
|
|
import Def.{ScopedKey, Setting}
|
2011-01-19 00:24:11 +01:00
|
|
|
|
|
|
|
|
// name is more like BuildDefinition, but that is too long
|
|
|
|
|
trait Build
|
|
|
|
|
{
|
2011-05-27 04:13:58 +02:00
|
|
|
def projectDefinitions(baseDirectory: File): Seq[Project] = projects
|
|
|
|
|
def projects: Seq[Project] = ReflectUtilities.allVals[Project](this).values.toSeq
|
2011-03-05 14:25:17 +01:00
|
|
|
def settings: Seq[Setting[_]] = Defaults.buildCore
|
2011-10-03 15:58:37 +02:00
|
|
|
def buildLoaders: Seq[BuildLoader.Components] = Nil
|
2011-01-19 00:24:11 +01:00
|
|
|
}
|
|
|
|
|
trait Plugin
|
|
|
|
|
{
|
2012-02-25 18:01:08 +01:00
|
|
|
@deprecated("Override projectSettings or buildSettings instead.", "0.12.0")
|
2012-07-31 17:52:10 +02:00
|
|
|
def settings: Seq[Setting[_]] = Nil
|
2012-02-25 18:01:08 +01:00
|
|
|
|
|
|
|
|
/** Settings to be appended to all projects in a build. */
|
2012-07-31 17:52:10 +02:00
|
|
|
def projectSettings: Seq[Setting[_]] = Nil
|
2012-02-25 18:01:08 +01:00
|
|
|
|
|
|
|
|
/** Settings to be appended at the build scope. */
|
2012-07-31 17:52:10 +02:00
|
|
|
def buildSettings: Seq[Setting[_]] = Nil
|
2012-05-31 02:02:24 +02:00
|
|
|
|
|
|
|
|
/** Settings to be appended at the global scope. */
|
2012-07-31 17:52:10 +02:00
|
|
|
def globalSettings: Seq[Setting[_]] = Nil
|
2011-01-19 00:24:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
object Build
|
|
|
|
|
{
|
2011-07-06 13:30:47 +02:00
|
|
|
val default: Build = new Build { override def projectDefinitions(base: File) = defaultProject(base) :: Nil }
|
2011-07-13 05:09:57 +02:00
|
|
|
def defaultID(base: File): String = "default-" + Hash.trimHashString(base.getAbsolutePath, 6)
|
2012-05-28 02:03:08 +02:00
|
|
|
def defaultProject(base: File): Project = Project(defaultID(base), base).settings(
|
|
|
|
|
// if the user has overridden the name, use the normal organization that is derived from the name.
|
|
|
|
|
organization <<= (thisProject, organization, name) { (p, o, n) => if(p.id == n) "default" else o }
|
|
|
|
|
)
|
2011-02-25 05:30:06 +01:00
|
|
|
|
2012-07-31 17:52:10 +02:00
|
|
|
@deprecated("Use Attributed.data", "0.13.0")
|
|
|
|
|
def data[T](in: Seq[Attributed[T]]): Seq[T] = Attributed.data(in)
|
2011-03-02 12:46:28 +01:00
|
|
|
def analyzed(in: Seq[Attributed[_]]): Seq[inc.Analysis] = in.flatMap{ _.metadata.get(Keys.analysis) }
|
2011-01-19 00:24:11 +01:00
|
|
|
}
|