mirror of https://github.com/sbt/sbt.git
adjustments and cleanup
This commit is contained in:
parent
bfa3a996e9
commit
c676c1c673
|
|
@ -127,14 +127,15 @@ object EvaluateTask
|
|||
|
||||
def getTask[T](structure: BuildStructure, taskKey: ScopedKey[Task[T]], state: State): Option[(Task[T], Execute.NodeView[Task])] =
|
||||
{
|
||||
val x = transform(structure, dummyStreams, dummyState, state)
|
||||
val thisScope = Scope(Select(Project.currentRef(state)), Global, Global, Global)
|
||||
val resolvedScope = Scope.replaceThis(thisScope)( taskKey.scope )
|
||||
for( t <- structure.data.get(resolvedScope, taskKey.key)) yield
|
||||
(t, x)
|
||||
(t, nodeView(structure, state))
|
||||
}
|
||||
def nodeView(structure: BuildStructure, state: State): Execute.NodeView[Task] =
|
||||
transform(structure, dummyStreams, dummyState, state)
|
||||
|
||||
def runTask[Task[_] <: AnyRef, T](root: Task[T], checkCycles: Boolean, maxWorkers: Int)(implicit taskToNode: Execute.NodeView[Task]): Result[T] =
|
||||
def runTask[Task[_] <: AnyRef, T](root: Task[T], checkCycles: Boolean = false, maxWorkers: Int = SystemProcessors)(implicit taskToNode: Execute.NodeView[Task]): Result[T] =
|
||||
{
|
||||
val (service, shutdown) = CompletionService[Task[_], Completed](maxWorkers)
|
||||
|
||||
|
|
@ -236,7 +237,7 @@ object Load
|
|||
}
|
||||
|
||||
def structureIndex(settings: Settings[Scope]): StructureIndex =
|
||||
new StructureIndex(Index.stringToKeyMap(settings), Index.taskToKeyMap(settings))
|
||||
new StructureIndex(Index.stringToKeyMap(settings), Index.taskToKeyMap(settings), KeyIndex(settings.allKeys( (s,k) => ScopedKey(s,k))))
|
||||
|
||||
// Reevaluates settings after modifying them. Does not recompile or reload any build components.
|
||||
def reapply(newSettings: Seq[Setting[_]], structure: BuildStructure): BuildStructure =
|
||||
|
|
@ -501,7 +502,7 @@ object Load
|
|||
final class BuildStructure(val units: Map[URI, LoadedBuildUnit], val root: URI, val settings: Seq[Setting[_]], val data: Settings[Scope], val index: StructureIndex, val streams: Streams, val delegates: Scope => Seq[Scope])
|
||||
final class LoadBuildConfiguration(val stagingDirectory: File, val classpath: Seq[File], val loader: ClassLoader, val compilers: Compilers, val evalPluginDef: BuildStructure => (Seq[File], Analysis), val delegates: LoadedBuild => Scope => Seq[Scope], val injectSettings: Seq[Setting[_]], val log: Logger)
|
||||
// information that is not original, but can be reconstructed from the rest of BuildStructure
|
||||
final class StructureIndex(val keyMap: Map[String, AttributeKey[_]], val taskToKey: Map[Task[_], ScopedKey[Task[_]]])
|
||||
final class StructureIndex(val keyMap: Map[String, AttributeKey[_]], val taskToKey: Map[Task[_], ScopedKey[Task[_]]], val keyIndex: KeyIndex)
|
||||
|
||||
private[this] def memo[A,B](implicit f: A => B): A => B =
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ object Command
|
|||
val Analysis = AttributeKey[inc.Analysis]("analysis")
|
||||
val Watch = SettingKey[Watched]("continuous-watch")
|
||||
val Sample = SettingKey[String]("sample-setting")
|
||||
val SampleTask = TaskKey[String]("sample-task")
|
||||
val SampleInput = InputKey[String]("sample-input-task")
|
||||
|
||||
def command(name: String)(f: State => State): Command = command(name, Nil)(f)
|
||||
def command(name: String, briefHelp: String, detail: String)(f: State => State): Command = command(name, Help(name, (name, briefHelp), detail) :: Nil)(f)
|
||||
|
|
|
|||
|
|
@ -23,10 +23,9 @@ object ProjectNavigation
|
|||
}
|
||||
final class ProjectNavigation(s: State)
|
||||
{
|
||||
val session = Project session s
|
||||
val structure = Project structure s
|
||||
val extracted = Project extract s
|
||||
import extracted.{curi => uri, cid => pid, structure, session}
|
||||
val builds = structure.units.keys.toSet
|
||||
val (uri, pid) = session.current
|
||||
val projects = Load.getBuild(structure.units, uri).defined.keys
|
||||
|
||||
def setProject(nuri: URI, nid: String) =
|
||||
|
|
|
|||
|
|
@ -43,7 +43,9 @@ object Scope
|
|||
def mapRefBuild(current: URI, ref: ProjectRef): ProjectRef = ProjectRef(Some(resolveBuild(current, ref)), ref.id)
|
||||
|
||||
def resolveBuild(current: URI, ref: ProjectRef): URI =
|
||||
( ref.uri match { case Some(u) => IO.directoryURI(current resolve u); case None => current } ).normalize
|
||||
ref.uri match { case Some(u) => resolveBuild(current, u); case None => current }
|
||||
def resolveBuild(current: URI, uri: URI): URI =
|
||||
IO.directoryURI(current resolve uri)
|
||||
|
||||
def resolveRef(current: URI, rootProject: URI => String, ref: ProjectRef): (URI, String) =
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2010 Mark Harrah
|
||||
*/
|
||||
package object sbt extends sbt.std.TaskExtra with sbt.Types with sbt.ProcessExtra with sbt.impl.DependencyBuilders with sbt.PathExtra
|
||||
package object sbt extends sbt.std.TaskExtra with sbt.Types with sbt.ProcessExtra with sbt.impl.DependencyBuilders with sbt.PathExtra with sbt.ProjectConstructors
|
||||
{
|
||||
type File = java.io.File
|
||||
implicit def maybeToOption[S](m: xsbti.Maybe[S]): Option[S] =
|
||||
|
|
|
|||
Loading…
Reference in New Issue