mirror of https://github.com/sbt/sbt.git
add additional in scope identifiers
This commit is contained in:
parent
50e453c70c
commit
e6b816d86e
|
|
@ -67,7 +67,7 @@ sealed trait ClasspathDep[PR <: ProjectReference] { def project: PR; def configu
|
|||
final case class ResolvedClasspathDependency(project: ProjectRef, configuration: Option[String]) extends ClasspathDep[ProjectRef]
|
||||
final case class ClasspathDependency(project: ProjectReference, configuration: Option[String]) extends ClasspathDep[ProjectReference]
|
||||
|
||||
object Project extends Init[Scope]
|
||||
object Project extends Init[Scope] with ProjectExtra
|
||||
{
|
||||
private abstract class ProjectDef[PR <: ProjectReference](val id: String, val base: File, aggregate0: => Seq[PR], dependencies0: => Seq[ClasspathDep[PR]], delegates0: => Seq[PR],
|
||||
val settings: Seq[Setting[_]], val configurations: Seq[Configuration]) extends ProjectDefinition[PR]
|
||||
|
|
@ -229,13 +229,6 @@ object Project extends Init[Scope]
|
|||
def reverseDependencies(cMap: CompiledMap, scoped: ScopedKey[_]): Iterable[ScopedKey[_]] =
|
||||
for( (key,compiled) <- cMap; dep <- compiled.dependencies if dep == scoped) yield key
|
||||
|
||||
def inConfig(conf: Configuration)(ss: Seq[Setting[_]]): Seq[Setting[_]] =
|
||||
inScope(ThisScope.copy(config = Select(conf)) )( (configuration :== conf) +: ss)
|
||||
def inTask(t: Scoped)(ss: Seq[Setting[_]]): Seq[Setting[_]] =
|
||||
inScope(ThisScope.copy(task = Select(t.key)) )( ss )
|
||||
def inScope(scope: Scope)(ss: Seq[Setting[_]]): Seq[Setting[_]] =
|
||||
Project.transform(Scope.replaceThis(scope), ss)
|
||||
|
||||
object LoadAction extends Enumeration {
|
||||
val Return, Current, Plugins = Value
|
||||
}
|
||||
|
|
@ -278,9 +271,15 @@ object Project extends Init[Scope]
|
|||
}
|
||||
}
|
||||
|
||||
trait ProjectConstructors
|
||||
trait ProjectExtra
|
||||
{
|
||||
implicit def configDependencyConstructor[T <% ProjectReference](p: T): Constructor = new Constructor(p)
|
||||
implicit def classpathDependency[T <% ProjectReference](p: T): ClasspathDependency = new ClasspathDependency(p, None)
|
||||
}
|
||||
|
||||
def inConfig(conf: Configuration)(ss: Seq[Setting[_]]): Seq[Setting[_]] =
|
||||
inScope(ThisScope.copy(config = Select(conf)) )( (configuration :== conf) +: ss)
|
||||
def inTask(t: Scoped)(ss: Seq[Setting[_]]): Seq[Setting[_]] =
|
||||
inScope(ThisScope.copy(task = Select(t.key)) )( ss )
|
||||
def inScope(scope: Scope)(ss: Seq[Setting[_]]): Seq[Setting[_]] =
|
||||
Project.transform(Scope.replaceThis(scope), ss)
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2010 Mark Harrah
|
||||
* Copyright 2010, 2011 Mark Harrah
|
||||
*/
|
||||
package object sbt extends sbt.std.TaskExtra with sbt.Types with sbt.ProcessExtra with sbt.impl.DependencyBuilders with sbt.PathExtra with sbt.ProjectConstructors
|
||||
package object sbt extends sbt.std.TaskExtra with sbt.Types with sbt.ProcessExtra with sbt.impl.DependencyBuilders with sbt.PathExtra with sbt.ProjectExtra
|
||||
{
|
||||
type Setting[T] = Project.Setting[T]
|
||||
type ScopedKey[T] = Project.ScopedKey[T]
|
||||
|
|
@ -24,6 +24,12 @@ package object sbt extends sbt.std.TaskExtra with sbt.Types with sbt.ProcessExtr
|
|||
// java.lang.System is more important, so don't alias this one
|
||||
// def System = C.System
|
||||
def Optional = C.Optional
|
||||
def config(s: String): Configuration = Configurations.config(s)
|
||||
|
||||
implicit def globFilter(expression: String): NameFilter = GlobFilter(expression)
|
||||
implicit def richAttributed(s: Seq[Attributed[File]]): RichAttributed = new RichAttributed(s)
|
||||
final class RichAttributed private[sbt](s: Seq[Attributed[File]])
|
||||
{
|
||||
def files: Seq[File] = Build data s
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue