mirror of https://github.com/sbt/sbt.git
normalize key names
This commit is contained in:
parent
4cd6e60360
commit
70972c6499
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright 2009, 2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package compile
|
||||
package compiler
|
||||
|
||||
import xsbti.{AnalysisCallback, Logger => xLogger, Reporter}
|
||||
import java.io.File
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright 2009, 2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package compile
|
||||
package compiler
|
||||
|
||||
import java.io.File
|
||||
import CompilerArguments.{abs, absString}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright 2009, 2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package compile
|
||||
package compiler
|
||||
|
||||
import java.io.File
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
package sbt
|
||||
package compile
|
||||
package compiler
|
||||
|
||||
import scala.reflect.Manifest
|
||||
import scala.tools.nsc.{ast, interpreter, io, reporters, util, CompilerCommand, Global, Phase, Settings}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright 2008, 2009, 2010 Mark Harrah, Seth Tisue
|
||||
*/
|
||||
package sbt
|
||||
package compile
|
||||
package compiler
|
||||
|
||||
import java.io.File
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright 2009, 2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package compile
|
||||
package compiler
|
||||
|
||||
import java.io.File
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright 2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package compile
|
||||
package compiler
|
||||
|
||||
final case class Discovered(baseClasses: Set[String], annotations: Set[String], hasMain: Boolean, isModule: Boolean)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright 2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package compile
|
||||
package compiler
|
||||
|
||||
import xsbti.api.{Path => APath, _}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
package sbt
|
||||
package compile
|
||||
package compiler
|
||||
|
||||
import java.io.File
|
||||
import java.net.URLClassLoader
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
package sbt
|
||||
package compile
|
||||
package compiler
|
||||
|
||||
import java.io.File
|
||||
import org.specs.Specification
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
package sbt
|
||||
package compile
|
||||
package compiler
|
||||
|
||||
import java.io.File
|
||||
import org.specs.Specification
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
package sbt
|
||||
package compile
|
||||
package compiler
|
||||
|
||||
import java.io.File
|
||||
import org.specs.Specification
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
package sbt
|
||||
package compile
|
||||
package compiler
|
||||
|
||||
import java.io.File
|
||||
import org.specs.Specification
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
package sbt
|
||||
package compile
|
||||
package compiler
|
||||
|
||||
import java.io.File
|
||||
import IO.withTemporaryDirectory
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
package sbt
|
||||
package compile
|
||||
package compiler
|
||||
|
||||
import org.scalacheck._
|
||||
import Prop._
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
package sbt
|
||||
package compile
|
||||
package compiler
|
||||
|
||||
import java.io.File
|
||||
import java.net.URLClassLoader
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
package sbt
|
||||
package compile
|
||||
package compiler
|
||||
|
||||
import xsbt.boot
|
||||
import java.io.File
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
package sbt
|
||||
|
||||
import Project.ScopedKey
|
||||
import Keys.ThisProject
|
||||
import Keys.{sessionSettings, thisProject}
|
||||
import CommandSupport.logger
|
||||
import Load.BuildStructure
|
||||
import complete.{DefaultParsers, Parser}
|
||||
|
|
@ -29,7 +29,7 @@ object Act
|
|||
def toAxis[T](opt: Option[T], ifNone: ScopeAxis[T]): ScopeAxis[T] =
|
||||
opt match { case Some(t) => Select(t); case None => ifNone }
|
||||
def defaultConfig(data: Settings[Scope])(project: ProjectRef): Option[String] =
|
||||
ThisProject in project get data flatMap( _.configurations.headOption.map(_.name))
|
||||
thisProject in project get data flatMap( _.configurations.headOption.map(_.name))
|
||||
|
||||
def config(confs: Set[String]): Parser[Option[String]] =
|
||||
token( examplesStrict(ID, confs) <~ ':' ).?
|
||||
|
|
@ -84,5 +84,5 @@ object Act
|
|||
|
||||
|
||||
def requireSession[T](s: State, p: => Parser[T]): Parser[T] =
|
||||
if(s get Keys.SessionKey isEmpty) failure("No project loaded") else p
|
||||
if(s get sessionSettings isEmpty) failure("No project loaded") else p
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@ package sbt
|
|||
import Project.ScopedKey
|
||||
import Load.BuildStructure
|
||||
import EvaluateTask.parseResult
|
||||
import Keys.Aggregate
|
||||
import Keys.aggregate
|
||||
import sbt.complete.Parser
|
||||
import Parser._
|
||||
|
||||
|
|
@ -25,16 +25,16 @@ final object Aggregation
|
|||
def getTasks[T](key: ScopedKey[T], structure: BuildStructure, transitive: Boolean): Seq[KeyValue[T]] =
|
||||
{
|
||||
val task = structure.data.get(key.scope, key.key).toList.map(t => KeyValue(key,t))
|
||||
if(transitive) aggregate(key, structure) ++ task else task
|
||||
if(transitive) aggregateDeps(key, structure) ++ task else task
|
||||
}
|
||||
def projectAggregate(key: ScopedKey[_], structure: BuildStructure): Seq[ProjectRef] =
|
||||
{
|
||||
val project = key.scope.project.toOption.flatMap { p => Project.getProject(p, structure) }
|
||||
project match { case Some(p) => p.aggregate; case None => Nil }
|
||||
}
|
||||
def aggregate[T](key: ScopedKey[T], structure: BuildStructure): Seq[KeyValue[T]] =
|
||||
def aggregateDeps[T](key: ScopedKey[T], structure: BuildStructure): Seq[KeyValue[T]] =
|
||||
{
|
||||
val aggregated = Aggregate in Scope.fillTaskAxis(key.scope, key.key) get structure.data getOrElse Enabled
|
||||
val aggregated = aggregate in Scope.fillTaskAxis(key.scope, key.key) get structure.data getOrElse Enabled
|
||||
val (agg, transitive) =
|
||||
aggregated match
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ package sbt
|
|||
|
||||
import java.io.File
|
||||
import java.net.URI
|
||||
import compile.{Discovered,Discovery,Eval,EvalImports}
|
||||
import compiler.{Discovered,Discovery,Eval,EvalImports}
|
||||
import classpath.ClasspathUtilities
|
||||
import scala.annotation.tailrec
|
||||
import collection.mutable
|
||||
import Compile.{Compilers,Inputs}
|
||||
import Project.{inScope, ScopedKey, ScopeLocal, Setting}
|
||||
import Keys.{AppConfig, Config, ThisProject, ThisProjectRef}
|
||||
import Keys.{appConfiguration, configuration, thisProject, thisProjectRef}
|
||||
import TypeFunctions.{Endo,Id}
|
||||
import tools.nsc.reporters.ConsoleReporter
|
||||
import Build.{analyzed, data}
|
||||
|
|
@ -34,7 +34,7 @@ object Build
|
|||
def defaultProject(id: String, base: File): Project = Project(id, base)
|
||||
|
||||
def data[T](in: Seq[Attributed[T]]): Seq[T] = in.map(_.data)
|
||||
def analyzed(in: Seq[Attributed[_]]): Seq[inc.Analysis] = in.flatMap{ _.metadata.get(Keys.Analysis) }
|
||||
def analyzed(in: Seq[Attributed[_]]): Seq[inc.Analysis] = in.flatMap{ _.metadata.get(Keys.analysis) }
|
||||
}
|
||||
object RetrieveUnit
|
||||
{
|
||||
|
|
@ -126,14 +126,14 @@ object EvaluateTask
|
|||
def evalPluginDef(log: Logger)(pluginDef: BuildStructure, state: State): Seq[Attributed[File]] =
|
||||
{
|
||||
val root = ProjectRef(pluginDef.root, Load.getRootProject(pluginDef.units)(pluginDef.root))
|
||||
val pluginKey = Keys.FullClasspath in Configurations.Compile
|
||||
val pluginKey = Keys.fullClasspath in Configurations.Compile
|
||||
val evaluated = evaluateTask(pluginDef, ScopedKey(pluginKey.scope, pluginKey.key), state, root)
|
||||
val result = evaluated getOrElse error("Plugin classpath does not exist for plugin definition at " + pluginDef.root)
|
||||
processResult(result, log)
|
||||
}
|
||||
def evaluateTask[T](structure: BuildStructure, taskKey: ScopedKey[Task[T]], state: State, thisProject: ProjectRef, checkCycles: Boolean = false, maxWorkers: Int = SystemProcessors): Option[Result[T]] =
|
||||
def evaluateTask[T](structure: BuildStructure, taskKey: ScopedKey[Task[T]], state: State, ref: ProjectRef, checkCycles: Boolean = false, maxWorkers: Int = SystemProcessors): Option[Result[T]] =
|
||||
withStreams(structure) { str =>
|
||||
for( (task, toNode) <- getTask(structure, taskKey, state, str, thisProject) ) yield
|
||||
for( (task, toNode) <- getTask(structure, taskKey, state, str, ref) ) yield
|
||||
runTask(task, checkCycles, maxWorkers)(toNode)
|
||||
}
|
||||
|
||||
|
|
@ -143,9 +143,9 @@ object EvaluateTask
|
|||
try { f(str) } finally { str.close() }
|
||||
}
|
||||
|
||||
def getTask[T](structure: BuildStructure, taskKey: ScopedKey[Task[T]], state: State, streams: Streams, thisProject: ProjectRef): Option[(Task[T], Execute.NodeView[Task])] =
|
||||
def getTask[T](structure: BuildStructure, taskKey: ScopedKey[Task[T]], state: State, streams: Streams, ref: ProjectRef): Option[(Task[T], Execute.NodeView[Task])] =
|
||||
{
|
||||
val thisScope = Scope(Select(thisProject), Global, Global, Global)
|
||||
val thisScope = Scope(Select(ref), Global, Global, Global)
|
||||
val resolvedScope = Scope.replaceThis(thisScope)( taskKey.scope )
|
||||
for( t <- structure.data.get(resolvedScope, taskKey.key)) yield
|
||||
(t, nodeView(state, streams))
|
||||
|
|
@ -223,7 +223,7 @@ object Load
|
|||
val compilers = Compile.compilers(state.configuration, log)
|
||||
val evalPluginDef = EvaluateTask.evalPluginDef(log) _
|
||||
val delegates = memo(defaultDelegates)
|
||||
val inject: Seq[Project.Setting[_]] = ((AppConfig in GlobalScope) :== state.configuration) +: EvaluateTask.injectSettings
|
||||
val inject: Seq[Project.Setting[_]] = ((appConfiguration in GlobalScope) :== state.configuration) +: EvaluateTask.injectSettings
|
||||
val config = new LoadBuildConfiguration(stagingDirectory, classpath, loader, compilers, evalPluginDef, delegates, EvaluateTask.injectStreams, inject, log)
|
||||
apply(base, state, config)
|
||||
}
|
||||
|
|
@ -305,10 +305,10 @@ object Load
|
|||
val projectSettings = build.defined flatMap { case (id, project) =>
|
||||
val srcs = configurationSources(project.base)
|
||||
val ref = ProjectRef(Some(uri), Some(id))
|
||||
val defineConfig = for(c <- project.configurations) yield ( (Config in (ref, ConfigKey(c.name))) :== c)
|
||||
val defineConfig = for(c <- project.configurations) yield ( (configuration in (ref, ConfigKey(c.name))) :== c)
|
||||
val settings =
|
||||
(ThisProject :== project) +:
|
||||
(ThisProjectRef :== ref) +:
|
||||
(thisProject :== project) +:
|
||||
(thisProjectRef :== ref) +:
|
||||
(defineConfig ++ project.settings ++ pluginThisProject ++ configurations(srcs, eval, build.imports))
|
||||
|
||||
// map This to thisScope, Select(p) to mapRef(uri, rootProject, p)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import Path._
|
|||
|
||||
object CommandSupport
|
||||
{
|
||||
def logger(s: State) = s get Keys.Logged getOrElse ConsoleLogger()
|
||||
def logger(s: State) = s get Keys.logged getOrElse ConsoleLogger()
|
||||
|
||||
private def canRead = (_: File).canRead
|
||||
def notReadable(files: Seq[File]): Seq[File] = files filterNot canRead
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
package sbt
|
||||
|
||||
import xsbti.{Logger => _,_}
|
||||
import compile._
|
||||
import compiler._
|
||||
import inc._
|
||||
import java.io.File
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
package sbt
|
||||
|
||||
import java.io.File
|
||||
import compile.AnalyzingCompiler
|
||||
import compiler.AnalyzingCompiler
|
||||
|
||||
final class Console(compiler: AnalyzingCompiler)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package sbt
|
|||
import java.io.File
|
||||
import Build.data
|
||||
import Scope.{GlobalScope, ThisScope}
|
||||
import compiler.Discovery
|
||||
import Project.{inConfig, Initialize, inScope, inTask, ScopedKey, Setting}
|
||||
import Configurations.{Compile => CompileConf, Test => TestConf}
|
||||
import EvaluateTask.{resolvedScoped, streams}
|
||||
|
|
@ -42,119 +43,119 @@ object Default
|
|||
protected[this] def finder(f: PathFinder => PathFinder): Seq[File] => Seq[File] =
|
||||
in => f(in).getFiles.toSeq
|
||||
}
|
||||
def configSrcSub(key: ScopedSetting[File]): Initialize[File] = (key, Config) { (src, conf) => src / nameForSrc(conf.name) }
|
||||
def configSrcSub(key: ScopedSetting[File]): Initialize[File] = (key, configuration) { (src, conf) => src / nameForSrc(conf.name) }
|
||||
def nameForSrc(config: String) = if(config == "compile") "main" else config
|
||||
def prefix(config: String) = if(config == "compile") "" else config + "-"
|
||||
def toSeq[T](key: ScopedSetting[T]): Initialize[Seq[T]] = key( _ :: Nil)
|
||||
|
||||
def extractAnalysis[T](a: Attributed[T]): (T, inc.Analysis) =
|
||||
(a.data, a.metadata get Keys.Analysis getOrElse inc.Analysis.Empty)
|
||||
(a.data, a.metadata get Keys.analysis getOrElse inc.Analysis.Empty)
|
||||
|
||||
def analysisMap[T](cp: Seq[Attributed[T]]): Map[T, inc.Analysis] =
|
||||
(cp map extractAnalysis).toMap
|
||||
|
||||
def buildCore: Seq[Setting[_]] = inScope(GlobalScope)(Seq(
|
||||
PollInterval :== 1,
|
||||
JavaHome :== None,
|
||||
OutputStrategy :== None,
|
||||
Fork :== false,
|
||||
JavaOptions :== Nil,
|
||||
CrossPaths :== true,
|
||||
ShellPrompt :== (_ => "> "),
|
||||
Aggregate :== Aggregation.Enabled,
|
||||
MaxErrors :== 100,
|
||||
Commands :== Nil,
|
||||
Data <<= EvaluateTask.state map { state => Project.structure(state).data }
|
||||
pollInterval :== 1,
|
||||
javaHome :== None,
|
||||
outputStrategy :== None,
|
||||
fork :== false,
|
||||
javaOptions :== Nil,
|
||||
crossPaths :== true,
|
||||
shellPrompt :== (_ => "> "),
|
||||
aggregate :== Aggregation.Enabled,
|
||||
maxErrors :== 100,
|
||||
commands :== Nil,
|
||||
settings <<= EvaluateTask.state map { state => Project.structure(state).data }
|
||||
))
|
||||
def projectCore: Seq[Setting[_]] = Seq(
|
||||
Name <<= ThisProject(_.id),
|
||||
Version :== "0.1"
|
||||
name <<= thisProject(_.id),
|
||||
version :== "0.1"
|
||||
)
|
||||
def paths = Seq(
|
||||
Base <<= ThisProject(_.base),
|
||||
Target <<= Base / "target",
|
||||
DefaultExcludes in GlobalScope :== (".*" - ".") || HiddenFileFilter,
|
||||
HistoryPath <<= Target(t => Some(t / ".history")),
|
||||
CacheDirectory <<= Target / "cache",
|
||||
Source <<= Base / "src",
|
||||
SourceFilter in GlobalScope :== ("*.java" | "*.scala"),
|
||||
SourceManaged <<= Base / "src_managed"
|
||||
baseDirectory <<= thisProject(_.base),
|
||||
target <<= baseDirectory / "target",
|
||||
defaultExcludes in GlobalScope :== (".*" - ".") || HiddenFileFilter,
|
||||
historyPath <<= target(t => Some(t / ".history")),
|
||||
cacheDirectory <<= target / "cache",
|
||||
sourceDirectory <<= baseDirectory / "src",
|
||||
sourceFilter in GlobalScope :== ("*.java" | "*.scala"),
|
||||
sourceManaged <<= baseDirectory / "src_managed"
|
||||
)
|
||||
|
||||
lazy val configPaths = Seq(
|
||||
Source <<= configSrcSub( Source in Scope(This,Global,This,This) ),
|
||||
SourceManaged <<= configSrcSub(SourceManaged),
|
||||
CacheDirectory <<= (CacheDirectory, Config) { _ / _.name },
|
||||
ClassDirectory <<= (Target, Config) { (target, conf) => target / (prefix(conf.name) + "classes") },
|
||||
DocDirectory <<= (Target, Config) { (target, conf) => target / (prefix(conf.name) + "api") },
|
||||
Sources <<= (SourceDirectories, SourceFilter, DefaultExcludes) map { (d,f,excl) => d.descendentsExcept(f,excl).getFiles.toSeq },
|
||||
ScalaSource <<= Source / "scala",
|
||||
JavaSource <<= Source / "java",
|
||||
JavaSourceRoots <<= toSeq(JavaSource),
|
||||
ResourceDir <<= Source / "resources",
|
||||
SourceDirectories <<= (ScalaSource, JavaSourceRoots) { _ +: _ },
|
||||
ResourceDirectories <<= toSeq(ResourceDir),
|
||||
Resources <<= (ResourceDirectories, DefaultExcludes) map { (dirs, excl) => dirs.descendentsExcept("*",excl).getFiles.toSeq }
|
||||
sourceDirectory <<= configSrcSub( sourceDirectory in Scope(This,Global,This,This) ),
|
||||
sourceManaged <<= configSrcSub(sourceManaged),
|
||||
cacheDirectory <<= (cacheDirectory, configuration) { _ / _.name },
|
||||
classDirectory <<= (target, configuration) { (outDir, conf) => outDir / (prefix(conf.name) + "classes") },
|
||||
docDirectory <<= (target, configuration) { (outDir, conf) => outDir / (prefix(conf.name) + "api") },
|
||||
sources <<= (sourceDirectories, sourceFilter, defaultExcludes) map { (d,f,excl) => d.descendentsExcept(f,excl).getFiles.toSeq },
|
||||
scalaSource <<= sourceDirectory / "scala",
|
||||
javaSource <<= sourceDirectory / "java",
|
||||
javaSourceRoots <<= toSeq(javaSource),
|
||||
resourceDirectory <<= sourceDirectory / "resources",
|
||||
sourceDirectories <<= (scalaSource, javaSourceRoots) { _ +: _ },
|
||||
resourceDirectories <<= toSeq(resourceDirectory),
|
||||
resources <<= (resourceDirectories, defaultExcludes) map { (dirs, excl) => dirs.descendentsExcept("*",excl).getFiles.toSeq }
|
||||
)
|
||||
def addBaseSources = Seq(
|
||||
Sources <<= (Sources, Base, SourceFilter, DefaultExcludes) map { (srcs,b,f,excl) => (srcs +++ b * (f -- excl)).getFiles.toSeq }
|
||||
sources <<= (sources, baseDirectory, sourceFilter, defaultExcludes) map { (srcs,b,f,excl) => (srcs +++ b * (f -- excl)).getFiles.toSeq }
|
||||
)
|
||||
|
||||
def webPaths = Seq(
|
||||
WebappDir <<= Source / "webapp"
|
||||
webappDir <<= sourceDirectory / "webapp"
|
||||
)
|
||||
|
||||
def compileBase = Seq(
|
||||
Compilers <<= (ScalaInstance, AppConfig, streams) map { (si, app, s) => Compile.compilers(si)(app, s.log) },
|
||||
JavacOptions in GlobalScope :== Nil,
|
||||
ScalacOptions in GlobalScope :== Nil,
|
||||
ScalaInstance <<= (AppConfig, ScalaVersion){ (app, version) => sbt.ScalaInstance(version, app.provider.scalaProvider.launcher) },
|
||||
ScalaVersion <<= AppConfig( _.provider.scalaProvider.version),
|
||||
Target <<= (Target, ScalaInstance, CrossPaths)( (t,si,cross) => if(cross) t / ("scala-" + si.actualVersion) else t )
|
||||
compilers <<= (scalaInstance, appConfiguration, streams) map { (si, app, s) => Compile.compilers(si)(app, s.log) },
|
||||
javacOptions in GlobalScope :== Nil,
|
||||
scalacOptions in GlobalScope :== Nil,
|
||||
scalaInstance <<= (appConfiguration, scalaVersion){ (app, version) => ScalaInstance(version, app.provider.scalaProvider.launcher) },
|
||||
scalaVersion <<= appConfiguration( _.provider.scalaProvider.version),
|
||||
target <<= (target, scalaInstance, crossPaths)( (t,si,cross) => if(cross) t / ("scala-" + si.actualVersion) else t )
|
||||
)
|
||||
|
||||
lazy val configTasks = Seq(
|
||||
InitialCommands in GlobalScope :== "",
|
||||
CompileTask <<= compileTask,
|
||||
CompileInputs <<= compileInputsTask,
|
||||
ConsoleTask <<= console,
|
||||
ConsoleQuick <<= consoleQuick,
|
||||
DiscoveredMainClasses <<= CompileTask map discoverMainClasses,
|
||||
inTask(RunTask)(runner :: Nil).head,
|
||||
SelectMainClass <<= DiscoveredMainClasses map selectRunMain,
|
||||
MainClass in RunTask :== SelectMainClass,
|
||||
MainClass <<= DiscoveredMainClasses map selectPackageMain,
|
||||
RunTask <<= runTask(FullClasspath, MainClass in RunTask, Runner in RunTask),
|
||||
ScaladocOptions <<= ScalacOptions(identity),
|
||||
DocTask <<= docTask,
|
||||
CopyResources <<= copyResources
|
||||
initialCommands in GlobalScope :== "",
|
||||
compile <<= compileTask,
|
||||
compileInputs <<= compileInputsTask,
|
||||
console <<= consoleTask,
|
||||
consoleQuick <<= consoleQuickTask,
|
||||
discoveredMainClasses <<= compile map discoverMainClasses,
|
||||
inTask(run)(runnerSetting :: Nil).head,
|
||||
selectMainClass <<= discoveredMainClasses map selectRunMain,
|
||||
mainClass in run :== selectMainClass,
|
||||
mainClass <<= discoveredMainClasses map selectPackageMain,
|
||||
run <<= runTask(fullClasspath, mainClass in run, runner in run),
|
||||
scaladocOptions <<= scalacOptions(identity),
|
||||
doc <<= docTask,
|
||||
copyResources <<= copyResourcesTask
|
||||
)
|
||||
|
||||
lazy val projectTasks: Seq[Setting[_]] = Seq(
|
||||
CleanFiles <<= (Target, SourceManaged) { _ :: _ :: Nil },
|
||||
Clean <<= CleanFiles map IO.delete,
|
||||
ConsoleProject <<= consoleProject,
|
||||
WatchSources <<= watchSources,
|
||||
WatchTransitiveSources <<= watchTransitiveSources,
|
||||
Watch <<= watch
|
||||
cleanFiles <<= (target, sourceManaged) { _ :: _ :: Nil },
|
||||
clean <<= cleanFiles map IO.delete,
|
||||
consoleProject <<= consoleProjectTask,
|
||||
watchSources <<= watchSourcesTask,
|
||||
watchTransitiveSources <<= watchTransitiveSourcesTask,
|
||||
watch <<= watchSetting
|
||||
)
|
||||
|
||||
def inAllConfigurations[T](key: ScopedTask[T]): Initialize[Task[Seq[T]]] = (EvaluateTask.state, ThisProjectRef) flatMap { (state, ref) =>
|
||||
def inAllConfigurations[T](key: ScopedTask[T]): Initialize[Task[Seq[T]]] = (EvaluateTask.state, thisProjectRef) flatMap { (state, ref) =>
|
||||
val structure = Project structure state
|
||||
val configurations = Project.getProject(ref, structure).toList.flatMap(_.configurations)
|
||||
configurations.flatMap { conf =>
|
||||
key in (ref, conf) get structure.data
|
||||
} join
|
||||
}
|
||||
def watchTransitiveSources: Initialize[Task[Seq[File]]] =
|
||||
(EvaluateTask.state, ThisProjectRef) flatMap { (s, base) =>
|
||||
inAllDependencies(base, WatchSources.setting, Project structure s).join.map(_.flatten)
|
||||
def watchTransitiveSourcesTask: Initialize[Task[Seq[File]]] =
|
||||
(EvaluateTask.state, thisProjectRef) flatMap { (s, base) =>
|
||||
inAllDependencies(base, watchSources.setting, Project structure s).join.map(_.flatten)
|
||||
}
|
||||
def watchSources: Initialize[Task[Seq[File]]] = Seq(Sources, Resources).map(inAllConfigurations).join { _.join.map(_.flatten.flatten) }
|
||||
def watchSourcesTask: Initialize[Task[Seq[File]]] = Seq(sources, resources).map(inAllConfigurations).join { _.join.map(_.flatten.flatten) }
|
||||
|
||||
def watch: Initialize[Watched] = (PollInterval, ThisProjectRef) { (interval, base) =>
|
||||
def watchSetting: Initialize[Watched] = (pollInterval, thisProjectRef) { (interval, base) =>
|
||||
new Watched {
|
||||
val scoped = WatchTransitiveSources in base
|
||||
val scoped = watchTransitiveSources in base
|
||||
val key = ScopedKey(scoped.scope, scoped.key)
|
||||
override def pollInterval = interval
|
||||
override def watchPaths(s: State) = EvaluateTask.evaluateTask(Project structure s, key, s, base) match { case Some(Value(ps)) => ps; case _ => Nil }
|
||||
|
|
@ -162,31 +163,31 @@ object Default
|
|||
}
|
||||
|
||||
lazy val testTasks = Seq(
|
||||
TestLoader <<= (FullClasspath, ScalaInstance) map { (cp, si) => TestFramework.createTestLoader(data(cp), si) },
|
||||
TestFrameworks in GlobalScope :== {
|
||||
testLoader <<= (fullClasspath, scalaInstance) map { (cp, si) => TestFramework.createTestLoader(data(cp), si) },
|
||||
testFrameworks in GlobalScope :== {
|
||||
import sbt.TestFrameworks._
|
||||
Seq(ScalaCheck, Specs, ScalaTest, ScalaCheckCompat, ScalaTestCompat, SpecsCompat, JUnit)
|
||||
},
|
||||
LoadedTestFrameworks <<= (TestFrameworks, streams, TestLoader) map { (frameworks, s, loader) =>
|
||||
loadedTestFrameworks <<= (testFrameworks, streams, testLoader) map { (frameworks, s, loader) =>
|
||||
frameworks.flatMap(f => f.create(loader, s.log).map( x => (f,x)).toIterable).toMap
|
||||
},
|
||||
DefinedTests <<= (LoadedTestFrameworks, CompileTask, streams) map { (frameworkMap, analysis, s) =>
|
||||
definedTests <<= (loadedTestFrameworks, compile, streams) map { (frameworkMap, analysis, s) =>
|
||||
val tests = Test.discover(frameworkMap.values.toSeq, analysis, s.log)._1
|
||||
IO.writeLines(s.text(CompletionsID), tests.map(_.name).distinct)
|
||||
tests
|
||||
},
|
||||
TestListeners <<= (streams in TestTask) map ( s => TestLogger(s.log) :: Nil ),
|
||||
TestOptions <<= TestListeners map { listeners => Test.Listeners(listeners) :: Nil },
|
||||
ExecuteTests <<= (streams in TestTask, LoadedTestFrameworks, TestOptions, TestLoader, DefinedTests) flatMap {
|
||||
testListeners <<= (streams in test) map ( s => TestLogger(s.log) :: Nil ),
|
||||
testOptions <<= testListeners map { listeners => Test.Listeners(listeners) :: Nil },
|
||||
executeTests <<= (streams in test, loadedTestFrameworks, testOptions, testLoader, definedTests) flatMap {
|
||||
(s, frameworkMap, options, loader, discovered) => Test(frameworkMap, loader, discovered, options, s.log)
|
||||
},
|
||||
TestTask <<= (ExecuteTests, streams) map { (results, s) => Test.showResults(s.log, results) },
|
||||
TestOnly <<= testOnly
|
||||
test <<= (executeTests, streams) map { (results, s) => Test.showResults(s.log, results) },
|
||||
testOnly <<= testOnlyTask
|
||||
)
|
||||
|
||||
def testOnly =
|
||||
def testOnlyTask =
|
||||
InputTask(resolvedScoped(testOnlyParser)) ( result =>
|
||||
(streams, LoadedTestFrameworks, TestOptions, TestLoader, DefinedTests, result) flatMap {
|
||||
(streams, loadedTestFrameworks, testOptions, testLoader, definedTests, result) flatMap {
|
||||
case (s, frameworks, opts, loader, discovered, (tests, frameworkOptions)) =>
|
||||
val modifiedOpts = Test.Filter(if(tests.isEmpty) _ => true else tests.toSet ) +: Test.Argument(frameworkOptions : _*) +: opts
|
||||
Test(frameworks, loader, discovered, modifiedOpts, s.log) map { results =>
|
||||
|
|
@ -196,53 +197,53 @@ object Default
|
|||
)
|
||||
|
||||
lazy val packageBase = Seq(
|
||||
jarName,
|
||||
PackageOptions in GlobalScope :== Nil,
|
||||
NameToString in GlobalScope :== (ArtifactName.show _)
|
||||
jarNameSetting,
|
||||
packageOptions in GlobalScope :== Nil,
|
||||
nameToString in GlobalScope :== (ArtifactName.show _)
|
||||
)
|
||||
lazy val packageConfig = Seq(
|
||||
JarName <<= (JarName, Config) { (n,c) => n.copy(config = c.name) },
|
||||
PackageOptions in Package <<= (PackageOptions, MainClass in Package) map { _ ++ _.map(sbt.Package.MainClass.apply).toList }
|
||||
jarName <<= (jarName, configuration) { (n,c) => n.copy(config = c.name) },
|
||||
packageOptions in packageBin <<= (packageOptions, mainClass in packageBin) map { _ ++ _.map(Package.MainClass.apply).toList }
|
||||
) ++
|
||||
packageTasks(Package, "", packageBin) ++
|
||||
packageTasks(PackageSrc, "src", packageSrc) ++
|
||||
packageTasks(PackageDoc, "doc", packageDoc)
|
||||
packageTasks(packageBin, "", packageBinTask) ++
|
||||
packageTasks(packageSrc, "src", packageSrcTask) ++
|
||||
packageTasks(packageDoc, "doc", packageDocTask)
|
||||
|
||||
private[this] val allSubpaths = (_: File).###.***.xx.toSeq
|
||||
|
||||
def packageBin = concat(classMappings, resourceMappings)
|
||||
def packageDoc = DocTask map allSubpaths
|
||||
def packageSrc = concat(resourceMappings, sourceMappings)
|
||||
def packageBinTask = concat(classMappings, resourceMappings)
|
||||
def packageDocTask = doc map allSubpaths
|
||||
def packageSrcTask = concat(resourceMappings, sourceMappings)
|
||||
|
||||
private type Mappings = Initialize[Task[Seq[(File, String)]]]
|
||||
def concat(as: Mappings, bs: Mappings) = (as zipWith bs)( (a,b) => (a :^: b :^: KNil) map { case a :+: b :+: HNil => a ++ b } )
|
||||
def classMappings = (CompileInputs, CompileTask) map { (in, _) => allSubpaths(in.config.classesDirectory) }
|
||||
def classMappings = (compileInputs, compile) map { (in, _) => allSubpaths(in.config.classesDirectory) }
|
||||
// drop base directories, since there are no valid mappings for these
|
||||
def sourceMappings = (Sources, SourceDirectories, Base) map { (srcs, sdirs, base) =>
|
||||
def sourceMappings = (sources, sourceDirectories, baseDirectory) map { (srcs, sdirs, base) =>
|
||||
( (srcs --- sdirs --- base) x (relativeTo(sdirs)|relativeTo(base))) toSeq
|
||||
}
|
||||
def resourceMappings = (Resources, ResourceDirectories) map { (rs, rdirs) =>
|
||||
def resourceMappings = (resources, resourceDirectories) map { (rs, rdirs) =>
|
||||
(rs --- rdirs) x relativeTo(rdirs) toSeq
|
||||
}
|
||||
|
||||
def jarName = JarName <<= (ModuleName, Version, ScalaVersion, CrossPaths) { (n,v, sv, withCross) =>
|
||||
def jarNameSetting = jarName <<= (moduleID, version, scalaVersion, crossPaths) { (n,v, sv, withCross) =>
|
||||
ArtifactName(base = n, version = v, config = "", tpe = "", ext = "jar", cross = if(withCross) sv else "")
|
||||
}
|
||||
def jarPath = JarPath <<= (Target, JarName, NameToString) { (t, n, toString) => t / toString(n) }
|
||||
def jarPathSetting = jarPath <<= (target, jarName, nameToString) { (t, n, toString) => t / toString(n) }
|
||||
|
||||
def packageTasks(key: TaskKey[sbt.Package.Configuration], tpeString: String, mappings: Initialize[Task[Seq[(File,String)]]]) =
|
||||
def packageTasks(key: TaskKey[Package.Configuration], tpeString: String, mappingsTask: Initialize[Task[Seq[(File,String)]]]) =
|
||||
inTask(key)( Seq(
|
||||
key in ThisScope.copy(task = Global) <<= packageTask,
|
||||
Mappings <<= mappings,
|
||||
JarType :== tpeString,
|
||||
JarName <<= (JarType,JarName){ (tpe, name) => (name.copy(tpe = tpe)) },
|
||||
CacheDirectory <<= CacheDirectory / key.key.label,
|
||||
jarPath
|
||||
mappings <<= mappingsTask,
|
||||
jarType :== tpeString,
|
||||
jarName <<= (jarType,jarName){ (tpe, name) => (name.copy(tpe = tpe)) },
|
||||
cacheDirectory <<= cacheDirectory / key.key.label,
|
||||
jarPathSetting
|
||||
))
|
||||
def packageTask: Initialize[Task[sbt.Package.Configuration]] =
|
||||
(JarPath, Mappings, PackageOptions, CacheDirectory, streams) map { (jar, srcs, options, cacheDir, s) =>
|
||||
val config = new sbt.Package.Configuration(srcs, jar, options)
|
||||
sbt.Package(config, cacheDir, s.log)
|
||||
def packageTask: Initialize[Task[Package.Configuration]] =
|
||||
(jarPath, mappings, packageOptions, cacheDirectory, streams) map { (jar, srcs, options, cacheDir, s) =>
|
||||
val config = new Package.Configuration(srcs, jar, options)
|
||||
Package(config, cacheDir, s.log)
|
||||
config
|
||||
}
|
||||
|
||||
|
|
@ -251,58 +252,58 @@ object Default
|
|||
def selectPackageMain(classes: Seq[String]): Option[String] =
|
||||
sbt.SelectMainClass(None, classes)
|
||||
|
||||
def runTask(classpath: ScopedTask[Classpath], mainClass: ScopedTask[Option[String]], run: ScopedSetting[ScalaRun]): Initialize[InputTask[Unit]] =
|
||||
def runTask(classpath: ScopedTask[Classpath], mainClassTask: ScopedTask[Option[String]], scalaRun: ScopedSetting[ScalaRun]): Initialize[InputTask[Unit]] =
|
||||
InputTask(_ => complete.Parsers.spaceDelimited("<arg>")) { result =>
|
||||
(classpath, mainClass, run, streams, result) map { (cp, main, runner, s, args) =>
|
||||
(classpath, mainClassTask, scalaRun, streams, result) map { (cp, main, runner, s, args) =>
|
||||
val mainClass = main getOrElse error("No main class detected.")
|
||||
runner.run(mainClass, data(cp), args, s.log) foreach error
|
||||
}
|
||||
}
|
||||
|
||||
def runner =
|
||||
Runner <<= (ScalaInstance, Base, JavaOptions, OutputStrategy, Fork, JavaHome) { (si, base, options, strategy, fork, javaHome) =>
|
||||
if(fork) {
|
||||
new ForkRun( ForkOptions(scalaJars = si.jars, javaHome = javaHome, outputStrategy = strategy,
|
||||
def runnerSetting =
|
||||
runner <<= (scalaInstance, baseDirectory, javaOptions, outputStrategy, fork, javaHome) { (si, base, options, strategy, forkRun, javaHomeDir) =>
|
||||
if(forkRun) {
|
||||
new ForkRun( ForkOptions(scalaJars = si.jars, javaHome = javaHomeDir, outputStrategy = strategy,
|
||||
runJVMOptions = options, workingDirectory = Some(base)) )
|
||||
} else
|
||||
new Run(si)
|
||||
}
|
||||
|
||||
def docTask: Initialize[Task[File]] =
|
||||
(CompileInputs, streams, DocDirectory, Config, ScaladocOptions) map { (in, s, target, config, options) =>
|
||||
(compileInputs, streams, docDirectory, configuration, scaladocOptions) map { (in, s, target, config, options) =>
|
||||
val d = new Scaladoc(in.config.maxErrors, in.compilers.scalac)
|
||||
d(nameForSrc(config.name), in.config.sources, in.config.classpath, target, options)(s.log)
|
||||
target
|
||||
}
|
||||
|
||||
def mainRunTask = RunTask <<= runTask(FullClasspath in Configurations.Runtime, MainClass in RunTask, Runner in RunTask)
|
||||
def mainRunTask = run <<= runTask(fullClasspath in Configurations.Runtime, mainClass in run, runner in run)
|
||||
|
||||
def discoverMainClasses(analysis: inc.Analysis): Seq[String] =
|
||||
compile.Discovery.applications(Test.allDefs(analysis)) collect { case (definition, discovered) if(discovered.hasMain) => definition.name }
|
||||
Discovery.applications(Test.allDefs(analysis)) collect { case (definition, discovered) if(discovered.hasMain) => definition.name }
|
||||
|
||||
def consoleProject = (EvaluateTask.state, streams, InitialCommands in ConsoleProject) map { (state, s, extra) => Console.sbt(state, extra)(s.log) }
|
||||
def console = consoleTask(FullClasspath, ConsoleTask)
|
||||
def consoleQuick = consoleTask(ExternalDependencyClasspath, ConsoleQuick)
|
||||
def consoleTask(classpath: TaskKey[Classpath], task: TaskKey[_]) = (Compilers, classpath, ScalacOptions in task, InitialCommands in task, streams) map {
|
||||
(cs, cp, options, initialCommands, s) =>
|
||||
(new Console(cs.scalac))(data(cp), options, initialCommands, s.log).foreach(msg => error(msg))
|
||||
def consoleProjectTask = (EvaluateTask.state, streams, initialCommands in consoleProject) map { (state, s, extra) => Console.sbt(state, extra)(s.log) }
|
||||
def consoleTask: Initialize[Task[Unit]] = consoleTask(fullClasspath, console)
|
||||
def consoleQuickTask = consoleTask(externalDependencyClasspath, consoleQuick)
|
||||
def consoleTask(classpath: TaskKey[Classpath], task: TaskKey[_]): Initialize[Task[Unit]] = (compilers, classpath, scalacOptions in task, initialCommands in task, streams) map {
|
||||
(cs, cp, options, initCommands, s) =>
|
||||
(new Console(cs.scalac))(data(cp), options, initCommands, s.log).foreach(msg => error(msg))
|
||||
println()
|
||||
}
|
||||
|
||||
def compileTask = (CompileInputs, streams) map { (i,s) => Compile(i,s.log) }
|
||||
def compileTask = (compileInputs, streams) map { (i,s) => Compile(i,s.log) }
|
||||
def compileInputsTask =
|
||||
(DependencyClasspath, Sources, JavaSourceRoots, Compilers, JavacOptions, ScalacOptions, CacheDirectory, ClassDirectory, streams) map {
|
||||
(cp, sources, javaRoots, compilers, javacOptions, scalacOptions, cacheDirectory, classes, s) =>
|
||||
(dependencyClasspath, sources, javaSourceRoots, compilers, javacOptions, scalacOptions, cacheDirectory, classDirectory, streams) map {
|
||||
(cp, srcs, javaRoots, cs, javacOpts, scalacOpts, cacheDir, classes, s) =>
|
||||
val classpath = classes +: data(cp)
|
||||
val analysis = analysisMap(cp)
|
||||
val cache = cacheDirectory / "compile"
|
||||
Compile.inputs(classpath, sources, classes, scalacOptions, javacOptions, javaRoots, analysis, cache, 100)(compilers, s.log)
|
||||
val cache = cacheDir / "compile"
|
||||
Compile.inputs(classpath, srcs, classes, scalacOpts, javacOpts, javaRoots, analysis, cache, 100)(cs, s.log)
|
||||
}
|
||||
|
||||
def copyResources =
|
||||
(ClassDirectory, CacheDirectory, Resources, ResourceDirectories, streams) map { (target, cache, resources, dirs, s) =>
|
||||
def copyResourcesTask =
|
||||
(classDirectory, cacheDirectory, resources, resourceDirectories, streams) map { (target, cache, resrcs, dirs, s) =>
|
||||
val cacheFile = cache / "copy-resources"
|
||||
val mappings = (resources --- dirs) x rebase(dirs, target)
|
||||
val mappings = (resrcs --- dirs) x rebase(dirs, target)
|
||||
s.log.debug("Copy resource mappings: " + mappings.mkString("\n\t","\n\t",""))
|
||||
Sync(cacheFile)( mappings )
|
||||
mappings
|
||||
|
|
@ -313,7 +314,7 @@ object Default
|
|||
import DefaultParsers._
|
||||
def distinctParser(exs: Set[String]): Parser[Seq[String]] =
|
||||
token(Space ~> NotSpace.examples(exs)).flatMap(ex => distinctParser(exs - ex).map(ex +: _)) ?? Nil
|
||||
val tests = savedLines(state, resolved, DefinedTests)
|
||||
val tests = savedLines(state, resolved, definedTests)
|
||||
val selectTests = distinctParser(tests.toSet) // todo: proper IDs
|
||||
val options = (Space ~> "--" ~> spaceDelimited("<arg>")) ?? Nil
|
||||
selectTests ~ options
|
||||
|
|
@ -347,10 +348,10 @@ object Default
|
|||
|
||||
lazy val defaultWebPaths = inConfig(CompileConf)(webPaths)
|
||||
|
||||
def noAggregation = Seq(RunTask, ConsoleTask, ConsoleQuick)
|
||||
def noAggregation = Seq(run, console, consoleQuick)
|
||||
lazy val disableAggregation = noAggregation map disableAggregate
|
||||
def disableAggregate(k: Scoped) =
|
||||
Aggregate in Scope.GlobalScope.copy(task = Select(k.key)) :== false
|
||||
aggregate in Scope.GlobalScope.copy(task = Select(k.key)) :== false
|
||||
|
||||
lazy val baseTasks: Seq[Setting[_]] = projectTasks ++ packageBase
|
||||
|
||||
|
|
@ -380,89 +381,89 @@ object Classpaths
|
|||
def concat[T](a: ScopedTaskable[Seq[T]], b: ScopedTaskable[Seq[T]]): Initialize[Task[Seq[T]]] = (a,b) map (_ ++ _)
|
||||
|
||||
lazy val configSettings: Seq[Setting[_]] = Seq(
|
||||
ExternalDependencyClasspath <<= concat(UnmanagedClasspath, ManagedClasspath),
|
||||
DependencyClasspath <<= concat(InternalDependencyClasspath, ExternalDependencyClasspath),
|
||||
FullClasspath <<= concat(Products, DependencyClasspath),
|
||||
InternalDependencyClasspath <<= internalDependencies,
|
||||
UnmanagedClasspath <<= unmanagedDependencies,
|
||||
Products <<= makeProducts,
|
||||
ManagedClasspath <<= (Config, Update) map { (config, up) => up.getOrElse(config.name, error("Configuration '" + config.name + "' unresolved by 'update'.")) },
|
||||
UnmanagedJars <<= (Config, UnmanagedBase, ClasspathFilter, DefaultExcludes) map { (config, base, filter, excl) =>
|
||||
externalDependencyClasspath <<= concat(unmanagedClasspath, managedClasspath),
|
||||
dependencyClasspath <<= concat(internalDependencyClasspath, externalDependencyClasspath),
|
||||
fullClasspath <<= concat(products, dependencyClasspath),
|
||||
internalDependencyClasspath <<= internalDependencies,
|
||||
unmanagedClasspath <<= unmanagedDependencies,
|
||||
products <<= makeProducts,
|
||||
managedClasspath <<= (configuration, update) map { (config, up) => up.getOrElse(config.name, error("Configuration '" + config.name + "' unresolved by 'update'.")) },
|
||||
unmanagedJars <<= (configuration, unmanagedBase, classpathFilter, defaultExcludes) map { (config, base, filter, excl) =>
|
||||
(base * (filter -- excl) +++ (base / config.name).descendentsExcept(filter, excl)).getFiles.toSeq
|
||||
}
|
||||
)
|
||||
def defaultPackageTasks: Seq[ScopedTask[_]] =
|
||||
for(task <- Seq(Package, PackageSrc, PackageDoc); conf <- Seq(CompileConf, TestConf)) yield (task in conf)
|
||||
for(task <- Seq(packageBin, `packageSrc`, `packageDoc`); conf <- Seq(CompileConf, TestConf)) yield (task in conf)
|
||||
|
||||
val publishSettings: Seq[Setting[_]] = Seq(
|
||||
PublishMavenStyle in GlobalScope :== true,
|
||||
PackageToPublish <<= defaultPackageTasks.dependOn,
|
||||
DeliverDepends <<= (PublishMavenStyle, MakePom.setting, PackageToPublish.setting) { (mavenStyle, makePom, ptp) =>
|
||||
if(mavenStyle) makePom.map(_ => ()) else ptp
|
||||
publishMavenStyle in GlobalScope :== true,
|
||||
packageToPublish <<= defaultPackageTasks.dependOn,
|
||||
deliverDepends <<= (publishMavenStyle, makePom.setting, packageToPublish.setting) { (mavenStyle, mkpom, ptp) =>
|
||||
if(mavenStyle) mkpom.map(_ => ()) else ptp
|
||||
},
|
||||
MakePom <<= (IvyModule, MakePomConfig, PackageToPublish) map { (ivyModule, makePomConfig, _) => IvyActions.makePom(ivyModule, makePomConfig); makePomConfig.file },
|
||||
Deliver <<= deliver(PublishConfig),
|
||||
DeliverLocal <<= deliver(PublishLocalConfig),
|
||||
Publish <<= publish(PublishConfig, Deliver),
|
||||
PublishLocal <<= publish(PublishLocalConfig, DeliverLocal)
|
||||
makePom <<= (ivyModule, makePomConfiguration, packageToPublish) map { (module, config, _) => IvyActions.makePom(module, config); config.file },
|
||||
deliver <<= deliverTask(publishConfiguration),
|
||||
deliverLocal <<= deliverTask(publishLocalConfiguration),
|
||||
publish <<= publishTask(publishConfiguration, deliver),
|
||||
publishLocal <<= publishTask(publishLocalConfiguration, deliverLocal)
|
||||
)
|
||||
val baseSettings: Seq[Setting[_]] = Seq(
|
||||
UnmanagedBase <<= Base / "lib",
|
||||
NormalizedName <<= Name(StringUtilities.normalize),
|
||||
Organization :== NormalizedName,
|
||||
ClasspathFilter in GlobalScope :== "*.jar",
|
||||
Resolvers <<= (ProjectResolver,BaseResolvers).map( (pr,rs) => pr +: Resolver.withDefaultResolvers(rs)),
|
||||
Offline in GlobalScope :== false,
|
||||
ModuleName :== NormalizedName,
|
||||
DefaultConfiguration in GlobalScope :== Some(Configurations.Compile),
|
||||
DefaultConfigurationMapping in GlobalScope <<= DefaultConfiguration{ case Some(d) => "*->" + d.name; case None => "*->*" },
|
||||
PathsIvy <<= Base(base => new IvyPaths(base, None)),
|
||||
OtherResolvers in GlobalScope :== Nil,
|
||||
ProjectResolver <<= projectResolver,
|
||||
ProjectDependencies <<= projectDependencies,
|
||||
LibraryDependencies in GlobalScope :== Nil,
|
||||
AllDependencies <<= concat(ProjectDependencies,LibraryDependencies),
|
||||
IvyLoggingLevel in GlobalScope :== UpdateLogging.Quiet,
|
||||
IvyXML in GlobalScope :== NodeSeq.Empty,
|
||||
IvyValidate in GlobalScope :== false,
|
||||
IvyScalaConfig in GlobalScope <<= ScalaVersion(v => Some(new IvyScala(v, Nil, false, false))),
|
||||
ModuleConfigurations in GlobalScope :== Nil,
|
||||
PublishTo in GlobalScope :== None,
|
||||
PomName <<= (ModuleName, Version, ScalaVersion, CrossPaths) { (n,v,sv, withCross) =>
|
||||
unmanagedBase <<= baseDirectory / "lib",
|
||||
normalizedName <<= name(StringUtilities.normalize),
|
||||
organization :== normalizedName,
|
||||
classpathFilter in GlobalScope :== "*.jar",
|
||||
resolvers <<= (projectResolver,baseResolvers).map( (pr,rs) => pr +: Resolver.withDefaultResolvers(rs)),
|
||||
offline in GlobalScope :== false,
|
||||
moduleID :== normalizedName,
|
||||
defaultConfiguration in GlobalScope :== Some(Configurations.Compile),
|
||||
defaultConfigurationMapping in GlobalScope <<= defaultConfiguration{ case Some(d) => "*->" + d.name; case None => "*->*" },
|
||||
ivyPaths <<= baseDirectory(base => new IvyPaths(base, None)),
|
||||
otherResolvers in GlobalScope :== Nil,
|
||||
projectResolver <<= projectResolverTask,
|
||||
projectDependencies <<= projectDependenciesTask,
|
||||
libraryDependencies in GlobalScope :== Nil,
|
||||
allDependencies <<= concat(projectDependencies,libraryDependencies),
|
||||
ivyLoggingLevel in GlobalScope :== UpdateLogging.Quiet,
|
||||
ivyXML in GlobalScope :== NodeSeq.Empty,
|
||||
ivyValidate in GlobalScope :== false,
|
||||
ivyScala in GlobalScope <<= scalaVersion(v => Some(new IvyScala(v, Nil, false, false))),
|
||||
moduleConfigurations in GlobalScope :== Nil,
|
||||
publishTo in GlobalScope :== None,
|
||||
pomName <<= (moduleID, version, scalaVersion, crossPaths) { (n,v,sv, withCross) =>
|
||||
ArtifactName(base = n, version = v, config = "", tpe = "", ext = "pom", cross = if(withCross) sv else "")
|
||||
},
|
||||
PomFile <<= (Target, PomName, NameToString) { (t, n, toString) => t / toString(n) },
|
||||
PomArtifact <<= (PublishMavenStyle, ModuleName)( (mavenStyle, name) => if(mavenStyle) Artifact(name, "pom", "pom") :: Nil else Nil),
|
||||
Artifacts <<= (PomArtifact,ModuleName)( (pom,name) => Artifact(name) +: pom),
|
||||
ProjectID <<= (Organization,ModuleName,Version,Artifacts){ (org,module,version,as) => ModuleID(org, module, version).cross(true).artifacts(as : _*) },
|
||||
BaseResolvers in GlobalScope :== Nil,
|
||||
ProjectDescriptors <<= depMap,
|
||||
RetrievePattern :== "[type]/[organisation]/[module]/[artifact](-[revision])(-[classifier]).[ext]",
|
||||
UpdateConfig <<= (RetrieveConfig, IvyLoggingLevel)((conf,level) => new UpdateConfiguration(conf, level) ),
|
||||
RetrieveConfig :== None, //Some(new RetrieveConfiguration(managedDependencyPath asFile, retrievePattern, true))
|
||||
IvyConfig <<= (Resolvers, PathsIvy, OtherResolvers, ModuleConfigurations, Offline, AppConfig) map { (rs, paths, otherResolvers, moduleConfigurations, offline, app) =>
|
||||
pomFile <<= (target, pomName, nameToString) { (t, n, toString) => t / toString(n) },
|
||||
pomArtifact <<= (publishMavenStyle, moduleID)( (mavenStyle, name) => if(mavenStyle) Artifact(name, "pom", "pom") :: Nil else Nil),
|
||||
artifacts <<= (pomArtifact,moduleID)( (pom,name) => Artifact(name) +: pom),
|
||||
projectID <<= (organization,moduleID,version,artifacts){ (org,module,version,as) => ModuleID(org, module, version).cross(true).artifacts(as : _*) },
|
||||
baseResolvers in GlobalScope :== Nil,
|
||||
projectDescriptors <<= depMap,
|
||||
retrievePattern :== "[type]/[organisation]/[module]/[artifact](-[revision])(-[classifier]).[ext]",
|
||||
updateConfiguration <<= (retrieveConfiguration, ivyLoggingLevel)((conf,level) => new UpdateConfiguration(conf, level) ),
|
||||
retrieveConfiguration :== None, //Some(new RetrieveConfiguration(managedDependencyPath asFile, retrievePattern, true))
|
||||
ivyConfiguration <<= (resolvers, ivyPaths, otherResolvers, moduleConfigurations, offline, appConfiguration) map { (rs, paths, other, moduleConfs, off, app) =>
|
||||
// todo: pass logger from streams directly to IvyActions
|
||||
val lock = app.provider.scalaProvider.launcher.globalLock
|
||||
new InlineIvyConfiguration(paths, rs, otherResolvers, moduleConfigurations, offline, Some(lock), ConsoleLogger())
|
||||
new InlineIvyConfiguration(paths, rs, other, moduleConfs, off, Some(lock), ConsoleLogger())
|
||||
},
|
||||
ModuleSettingsTask <<= (ProjectID, AllDependencies, IvyXML, ThisProject, DefaultConfiguration, IvyScalaConfig, IvyValidate) map {
|
||||
(pid, deps, ivyXML, project, defaultConf, ivyScala, validate) => new InlineConfiguration(pid, deps, ivyXML, project.configurations, defaultConf, ivyScala, validate)
|
||||
moduleSettings <<= (projectID, allDependencies, ivyXML, thisProject, defaultConfiguration, ivyScala, ivyValidate) map {
|
||||
(pid, deps, ivyXML, project, defaultConf, ivyS, validate) => new InlineConfiguration(pid, deps, ivyXML, project.configurations, defaultConf, ivyS, validate)
|
||||
},
|
||||
MakePomConfig <<= PomFile(pomFile => makePomConfiguration(pomFile)),
|
||||
PublishConfig <<= (Target, PublishTo, IvyLoggingLevel) map { (outputDirectory, publishTo, level) => publishConfiguration( publishPatterns(outputDirectory), resolverName = getPublishTo(publishTo).name, logging = level) },
|
||||
PublishLocalConfig <<= (Target, IvyLoggingLevel) map { (outputDirectory, level) => publishConfiguration( publishPatterns(outputDirectory, true), logging = level ) },
|
||||
IvySbtTask <<= IvyConfig map { conf => new IvySbt(conf) },
|
||||
IvyModule <<= (IvySbtTask, ModuleSettingsTask) map { (ivySbt, settings) => new ivySbt.Module(settings) },
|
||||
Update <<= (IvyModule, UpdateConfig, CacheDirectory, streams) map { (ivyModule, updateConfig, cacheDirectory, s) =>
|
||||
cachedUpdate(cacheDirectory / "update", ivyModule, updateConfig, s.log)
|
||||
makePomConfiguration <<= pomFile(file => makePomConfigurationTask(file)),
|
||||
publishConfiguration <<= (target, publishTo, ivyLoggingLevel) map { (outputDirectory, publishTo, level) => publishConfig( publishPatterns(outputDirectory), resolverName = getPublishTo(publishTo).name, logging = level) },
|
||||
publishLocalConfiguration <<= (target, ivyLoggingLevel) map { (outputDirectory, level) => publishConfig( publishPatterns(outputDirectory, true), logging = level ) },
|
||||
ivySbt <<= ivyConfiguration map { conf => new IvySbt(conf) },
|
||||
ivyModule <<= (ivySbt, moduleSettings) map { (ivySbt, settings) => new ivySbt.Module(settings) },
|
||||
update <<= (ivyModule, updateConfiguration, cacheDirectory, streams) map { (module, config, cacheDirectory, s) =>
|
||||
cachedUpdate(cacheDirectory / "update", module, config, s.log)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def deliver(config: TaskKey[PublishConfiguration]): Initialize[Task[Unit]] =
|
||||
(IvyModule, config, DeliverDepends) map { (ivyModule, config, _) => IvyActions.deliver(ivyModule, config) }
|
||||
def publish(config: TaskKey[PublishConfiguration], deliverKey: TaskKey[_]): Initialize[Task[Unit]] =
|
||||
(IvyModule, config, deliverKey) map { (ivyModule, config, _) => IvyActions.publish(ivyModule, config) }
|
||||
def deliverTask(config: TaskKey[PublishConfiguration]): Initialize[Task[Unit]] =
|
||||
(ivyModule, config, deliverDepends) map { (module, config, _) => IvyActions.deliver(module, config) }
|
||||
def publishTask(config: TaskKey[PublishConfiguration], deliverKey: TaskKey[_]): Initialize[Task[Unit]] =
|
||||
(ivyModule, config, deliverKey) map { (module, config, _) => IvyActions.publish(module, config) }
|
||||
|
||||
import Cache._
|
||||
import CacheIvy.{classpathFormat, publishIC, updateIC}
|
||||
|
|
@ -489,12 +490,12 @@ object Classpaths
|
|||
/*}
|
||||
f(module.owner.configuration :+: module.moduleSettings :+: config :+: HNil)*/
|
||||
}*/
|
||||
def makePomConfiguration(file: File, configurations: Option[Iterable[Configuration]] = None, extra: NodeSeq = NodeSeq.Empty, process: XNode => XNode = n => n, filterRepositories: MavenRepository => Boolean = _ => true) =
|
||||
def makePomConfigurationTask(file: File, configurations: Option[Iterable[Configuration]] = None, extra: NodeSeq = NodeSeq.Empty, process: XNode => XNode = n => n, filterRepositories: MavenRepository => Boolean = _ => true) =
|
||||
new MakePomConfiguration(file, configurations, extra, process, filterRepositories)
|
||||
|
||||
def getPublishTo(repo: Option[Resolver]): Resolver = repo getOrElse error("Repository for publishing is not specified.")
|
||||
|
||||
def publishConfiguration(patterns: PublishPatterns, resolverName: String = "local", status: String = "release", logging: UpdateLogging.Value = UpdateLogging.DownloadOnly) =
|
||||
def publishConfig(patterns: PublishPatterns, resolverName: String = "local", status: String = "release", logging: UpdateLogging.Value = UpdateLogging.DownloadOnly) =
|
||||
new PublishConfiguration(patterns, status, resolverName, None, logging)
|
||||
|
||||
def publishPatterns(outputPath: Path, publishIvy: Boolean = false): PublishPatterns =
|
||||
|
|
@ -511,38 +512,38 @@ object Classpaths
|
|||
new PublishPatterns( if(publishIvy) Some(deliverPattern) else None, srcArtifactPatterns)
|
||||
}
|
||||
|
||||
def projectDependencies =
|
||||
(ThisProject, Data) map { (p, data) =>
|
||||
p.dependencies flatMap { dep => (ProjectID in dep.project) get data map { _.copy(configurations = dep.configuration) } }
|
||||
def projectDependenciesTask =
|
||||
(thisProject, settings) map { (p, data) =>
|
||||
p.dependencies flatMap { dep => (projectID in dep.project) get data map { _.copy(configurations = dep.configuration) } }
|
||||
}
|
||||
|
||||
def depMap: Initialize[Task[Map[ModuleRevisionId, ModuleDescriptor]]] =
|
||||
(ThisProject, ThisProjectRef, Data) flatMap { (root, rootRef, data) =>
|
||||
val dependencies = (p: (ProjectRef, Project)) => p._2.dependencies.flatMap(pr => ThisProject in pr.project get data map { (pr.project, _) })
|
||||
(thisProject, thisProjectRef, settings) flatMap { (root, rootRef, data) =>
|
||||
val dependencies = (p: (ProjectRef, Project)) => p._2.dependencies.flatMap(pr => thisProject in pr.project get data map { (pr.project, _) })
|
||||
depMap(Dag.topologicalSort((rootRef,root))(dependencies).dropRight(1), data)
|
||||
}
|
||||
|
||||
def depMap(projects: Seq[(ProjectRef,Project)], data: Settings[Scope]): Task[Map[ModuleRevisionId, ModuleDescriptor]] =
|
||||
projects.flatMap { case (p,_) => IvyModule in p get data }.join.map { mods =>
|
||||
projects.flatMap { case (p,_) => ivyModule in p get data }.join.map { mods =>
|
||||
(mods.map{ mod =>
|
||||
val md = mod.moduleDescriptor
|
||||
(md.getModuleRevisionId, md)
|
||||
}).toMap
|
||||
}
|
||||
|
||||
def projectResolver: Initialize[Task[Resolver]] =
|
||||
ProjectDescriptors map { m =>
|
||||
def projectResolverTask: Initialize[Task[Resolver]] =
|
||||
projectDescriptors map { m =>
|
||||
new RawRepository(new ProjectResolver("inter-project", m))
|
||||
}
|
||||
|
||||
def analyzed[T](data: T, analysis: inc.Analysis) = Attributed.blank(data).put(Keys.Analysis, analysis)
|
||||
def analyzed[T](data: T, analysis: inc.Analysis) = Attributed.blank(data).put(Keys.analysis, analysis)
|
||||
def makeProducts: Initialize[Task[Classpath]] =
|
||||
(CompileTask, CompileInputs, CopyResources) map { (analysis, i, _) => analyzed(i.config.classesDirectory, analysis) :: Nil }
|
||||
(compile, compileInputs, copyResources) map { (analysis, i, _) => analyzed(i.config.classesDirectory, analysis) :: Nil }
|
||||
|
||||
def internalDependencies: Initialize[Task[Classpath]] =
|
||||
(ThisProjectRef, ThisProject, Config, Data) flatMap internalDependencies0
|
||||
(thisProjectRef, thisProject, configuration, settings) flatMap internalDependencies0
|
||||
def unmanagedDependencies: Initialize[Task[Classpath]] =
|
||||
(ThisProjectRef, ThisProject, Config, Data) flatMap unmanagedDependencies0
|
||||
(thisProjectRef, thisProject, configuration, settings) flatMap unmanagedDependencies0
|
||||
|
||||
import java.util.LinkedHashSet
|
||||
import collection.JavaConversions.asScalaSet
|
||||
|
|
@ -558,12 +559,12 @@ object Classpaths
|
|||
|
||||
for( Project.ClasspathDependency(dep, confMapping) <- project.dependencies)
|
||||
{
|
||||
val depProject = ThisProject in dep get data getOrElse error("Invalid project: " + dep)
|
||||
val depProject = thisProject in dep get data getOrElse error("Invalid project: " + dep)
|
||||
val mapping = mapped(confMapping, masterConfs, configurationNames(depProject), "compile", "*->compile")
|
||||
// map master configuration 'c' and all extended configurations to the appropriate dependency configuration
|
||||
for(ac <- applicableConfigs; depConfName <- mapping(ac.name))
|
||||
{
|
||||
val depConf = configuration(dep, depProject, depConfName)
|
||||
val depConf = getConfiguration(dep, depProject, depConfName)
|
||||
if( ! visited( (dep, depConfName) ) )
|
||||
visit(dep, depProject, depConf)
|
||||
}
|
||||
|
|
@ -575,7 +576,7 @@ object Classpaths
|
|||
def unmanagedDependencies0(projectRef: ProjectRef, project: Project, conf: Configuration, data: Settings[Scope]): Task[Classpath] =
|
||||
interDependencies(projectRef, project, conf, data, true, unmanagedLibs)
|
||||
def internalDependencies0(projectRef: ProjectRef, project: Project, conf: Configuration, data: Settings[Scope]): Task[Classpath] =
|
||||
interDependencies(projectRef, project, conf, data, false, products)
|
||||
interDependencies(projectRef, project, conf, data, false, productsTask)
|
||||
def interDependencies(projectRef: ProjectRef, project: Project, conf: Configuration, data: Settings[Scope], includeSelf: Boolean,
|
||||
f: (ProjectRef, String, Settings[Scope]) => Task[Classpath]): Task[Classpath] =
|
||||
{
|
||||
|
|
@ -621,15 +622,15 @@ object Classpaths
|
|||
def allConfigs(conf: Configuration): Seq[Configuration] =
|
||||
Dag.topologicalSort(conf)(_.extendsConfigs)
|
||||
|
||||
def configuration(ref: ProjectRef, dep: Project, conf: String): Configuration =
|
||||
def getConfiguration(ref: ProjectRef, dep: Project, conf: String): Configuration =
|
||||
dep.configurations.find(_.name == conf) getOrElse missingConfiguration(Project display ref, conf)
|
||||
def products(dep: ProjectRef, conf: String, data: Settings[Scope]): Task[Classpath] =
|
||||
getClasspath(Products, dep, conf, data)
|
||||
def productsTask(dep: ProjectRef, conf: String, data: Settings[Scope]): Task[Classpath] =
|
||||
getClasspath(products, dep, conf, data)
|
||||
def unmanagedLibs(dep: ProjectRef, conf: String, data: Settings[Scope]): Task[Classpath] =
|
||||
getClasspath(UnmanagedJars, dep, conf, data)
|
||||
getClasspath(unmanagedJars, dep, conf, data)
|
||||
def getClasspath(key: TaskKey[Classpath], dep: ProjectRef, conf: String, data: Settings[Scope]): Task[Classpath] =
|
||||
( key in (dep, ConfigKey(conf)) ) get data getOrElse const(Nil)
|
||||
def defaultConfiguration(p: ProjectRef, data: Settings[Scope]): Configuration =
|
||||
flatten(DefaultConfiguration in p get data) getOrElse Configurations.Default
|
||||
def defaultConfigurationTask(p: ProjectRef, data: Settings[Scope]): Configuration =
|
||||
flatten(defaultConfiguration in p get data) getOrElse Configurations.Default
|
||||
def flatten[T](o: Option[Option[T]]): Option[T] = o flatMap identity
|
||||
}
|
||||
|
|
|
|||
283
main/Keys.scala
283
main/Keys.scala
|
|
@ -16,174 +16,173 @@ package sbt
|
|||
object Keys
|
||||
{
|
||||
// logging
|
||||
val LogLevel = SettingKey[Level.Value]("log-level")
|
||||
val PersistLogLevel = SettingKey[Level.Value]("persist-log-level")
|
||||
val logLevel = SettingKey[Level.Value]("log-level")
|
||||
val persistLogLevel = SettingKey[Level.Value]("persist-log-level")
|
||||
|
||||
// Project keys
|
||||
val ProjectCommand = AttributeKey[Boolean]("project-command")
|
||||
val SessionKey = AttributeKey[SessionSettings]("session-settings")
|
||||
val StructureKey = AttributeKey[Load.BuildStructure]("build-structure")
|
||||
val AppConfig = SettingKey[xsbti.AppConfiguration]("app-configuration")
|
||||
val ThisProject = SettingKey[Project]("project")
|
||||
val ThisProjectRef = SettingKey[ProjectRef]("project-ref")
|
||||
val Config = SettingKey[Configuration]("configuration")
|
||||
val Commands = SettingKey[Seq[Command]]("commands")
|
||||
val projectCommand = AttributeKey[Boolean]("project-command")
|
||||
val sessionSettings = AttributeKey[SessionSettings]("session-settings")
|
||||
val buildStructure = AttributeKey[Load.BuildStructure]("build-structure")
|
||||
val appConfiguration = SettingKey[xsbti.AppConfiguration]("app-configuration")
|
||||
val thisProject = SettingKey[Project]("this-project")
|
||||
val thisProjectRef = SettingKey[ProjectRef]("this-project-ref")
|
||||
val configuration = SettingKey[Configuration]("configuration")
|
||||
val commands = SettingKey[Seq[Command]]("commands")
|
||||
|
||||
// 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]("continuous-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")
|
||||
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")
|
||||
|
||||
// Path Keys
|
||||
val Base = SettingKey[File]("base-directory")
|
||||
val Target = SettingKey[File]("target")
|
||||
val Source = SettingKey[File]("source-directory")
|
||||
val SourceManaged = SettingKey[File]("source-managed-directory")
|
||||
val ScalaSource = SettingKey[File]("scala-source-directory")
|
||||
val JavaSource = SettingKey[File]("java-source-directory")
|
||||
val JavaSourceRoots = SettingKey[Seq[File]]("java-source-directories")
|
||||
val ResourceDir = SettingKey[File]("resource-directory")
|
||||
val SourceDirectories = SettingKey[Seq[File]]("source-directories")
|
||||
val ResourceDirectories = SettingKey[Seq[File]]("resource-directories")
|
||||
val ClassDirectory = SettingKey[File]("classes-directory")
|
||||
val DocDirectory = SettingKey[File]("doc-directory")
|
||||
val CacheDirectory = SettingKey[File]("cache-directory")
|
||||
val LibDirectory = SettingKey[File]("lib-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")
|
||||
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 javaSourceRoots = SettingKey[Seq[File]]("java-source-roots")
|
||||
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")
|
||||
|
||||
// compile/doc keys
|
||||
val MaxErrors = SettingKey[Int]("maximum-errors")
|
||||
val ScaladocOptions = SettingKey[Seq[String]]("scaladoc-options")
|
||||
val ScalacOptions = SettingKey[Seq[String]]("scalac-options")
|
||||
val JavacOptions = SettingKey[Seq[String]]("javac-options")
|
||||
val InitialCommands = SettingKey[String]("initial-commands")
|
||||
val CompileInputs = TaskKey[Compile.Inputs]("compile-inputs")
|
||||
val ScalaInstance = SettingKey[ScalaInstance]("scala-instance")
|
||||
val ScalaVersion = SettingKey[String]("scala-version")
|
||||
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")
|
||||
val initialCommands = SettingKey[String]("initial-commands")
|
||||
val compileInputs = TaskKey[Compile.Inputs]("compile-inputs")
|
||||
val scalaInstance = SettingKey[ScalaInstance]("scala-instance")
|
||||
val scalaVersion = SettingKey[String]("scala-version")
|
||||
|
||||
val WebappDir = SettingKey[File]("webapp-dir")
|
||||
val webappDir = SettingKey[File]("webapp-dir")
|
||||
|
||||
val Clean = TaskKey[Unit]("clean")
|
||||
val ConsoleTask = TaskKey[Unit]("console")
|
||||
val ConsoleQuick = TaskKey[Unit]("console-quick")
|
||||
val ConsoleProject = TaskKey[Unit]("console-project")
|
||||
val CompileTask = TaskKey[Analysis]("compile")
|
||||
val Compilers = TaskKey[Compile.Compilers]("compilers")
|
||||
val DocTask = TaskKey[File]("doc")
|
||||
val CopyResources = TaskKey[Traversable[(File,File)]]("copy-resources")
|
||||
val Resources = TaskKey[Seq[File]]("resources")
|
||||
val Aggregate = SettingKey[Aggregation]("aggregate")
|
||||
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[Compile.Compilers]("compilers")
|
||||
val doc = TaskKey[File]("doc")
|
||||
val copyResources = TaskKey[Traversable[(File,File)]]("copy-resources")
|
||||
val resources = TaskKey[Seq[File]]("resources")
|
||||
val aggregate = SettingKey[Aggregation]("aggregate")
|
||||
|
||||
// package keys
|
||||
val Package = TaskKey[sbt.Package.Configuration]("package")
|
||||
val PackageDoc = TaskKey[sbt.Package.Configuration]("package-doc")
|
||||
val PackageSrc = TaskKey[sbt.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]("artifact-name-to-string")
|
||||
val Mappings = TaskKey[Seq[(File,String)]]("input-mappings")
|
||||
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")
|
||||
|
||||
// Run Keys
|
||||
val SelectMainClass = TaskKey[Option[String]]("select-main-class")
|
||||
val MainClass = TaskKey[Option[String]]("main-class")
|
||||
val RunTask = InputKey[Unit]("run")
|
||||
val DiscoveredMainClasses = TaskKey[Seq[String]]("discovered-main-classes")
|
||||
val Runner = SettingKey[ScalaRun]("runner")
|
||||
val selectMainClass = TaskKey[Option[String]]("select-main-class")
|
||||
val mainClass = TaskKey[Option[String]]("main-class")
|
||||
val run = InputKey[Unit]("run")
|
||||
val discoveredMainClasses = TaskKey[Seq[String]]("discovered-main-classes")
|
||||
val runner = SettingKey[ScalaRun]("runner")
|
||||
|
||||
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")
|
||||
val outputStrategy = SettingKey[Option[sbt.OutputStrategy]]("output-strategy")
|
||||
val javaHome = SettingKey[Option[File]]("java-home")
|
||||
val javaOptions = SettingKey[Seq[String]]("java-options")
|
||||
|
||||
// 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[Test.Output]("execute-tests")
|
||||
val TestTask = 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[Iterable[TestReportListener]]("test-listeners")
|
||||
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[Test.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[Iterable[TestReportListener]]("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")
|
||||
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 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")
|
||||
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 IvyConfig = TaskKey[IvyConfiguration]("ivy-configuration")
|
||||
val ModuleSettingsTask = TaskKey[ModuleSettings]("module-settings")
|
||||
val UnmanagedBase = SettingKey[File]("unmanaged-base")
|
||||
val UpdateConfig = SettingKey[UpdateConfiguration]("update-configuration")
|
||||
val IvySbtTask = TaskKey[IvySbt]("ivy-sbt")
|
||||
val IvyModule = TaskKey[IvySbt#Module]("ivy-module")
|
||||
val ClasspathFilter = SettingKey[FileFilter]("classpath-filter")
|
||||
val Update = TaskKey[Map[String,Seq[File]]]("update")
|
||||
val ivyConfiguration = TaskKey[IvyConfiguration]("ivy-configuration")
|
||||
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[Map[String,Seq[File]]]("update")
|
||||
|
||||
val PublishConfig = TaskKey[PublishConfiguration]("publish-configuration")
|
||||
val PublishLocalConfig = TaskKey[PublishConfiguration]("publish-local-configuration")
|
||||
val MakePomConfig = 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")
|
||||
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")
|
||||
|
||||
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")
|
||||
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")
|
||||
|
||||
val ModuleName = SettingKey[String]("module-id")
|
||||
val Version = SettingKey[String]("version")
|
||||
val ProjectID = SettingKey[ModuleID]("project-id")
|
||||
val BaseResolvers = SettingKey[Seq[Resolver]]("base-resolvers")
|
||||
val ProjectResolver = TaskKey[Resolver]("project-resolver")
|
||||
val Resolvers = TaskKey[Seq[Resolver]]("resolvers")
|
||||
val OtherResolvers = SettingKey[Seq[Resolver]]("other-resolvers")
|
||||
val ModuleConfigurations = SettingKey[Seq[ModuleConfiguration]]("module-configurations")
|
||||
val RetrievePattern = SettingKey[String]("retrieve-pattern")
|
||||
val RetrieveConfig = SettingKey[Option[RetrieveConfiguration]]("retrieve-configuration")
|
||||
val Offline = SettingKey[Boolean]("offline")
|
||||
val PathsIvy = 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 IvyScalaConfig = SettingKey[Option[IvyScala]]("ivy-scala-configuration")
|
||||
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-descriptor-map")
|
||||
val AutoUpdate = SettingKey[Boolean]("auto-update")
|
||||
val moduleID = SettingKey[String]("module-id")
|
||||
val version = SettingKey[String]("version")
|
||||
val projectID = SettingKey[ModuleID]("project-id")
|
||||
val baseResolvers = SettingKey[Seq[Resolver]]("base-resolvers")
|
||||
val projectResolver = TaskKey[Resolver]("project-resolver")
|
||||
val resolvers = TaskKey[Seq[Resolver]]("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 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")
|
||||
|
||||
// special
|
||||
val Data = TaskKey[Settings[Scope]]("settings")
|
||||
val settings = TaskKey[Settings[Scope]]("settings")
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@ package sbt
|
|||
import LogManager._
|
||||
import std.Transform
|
||||
import Project.ScopedKey
|
||||
import Keys.{LogLevel => ScreenLogLevel, PersistLogLevel}
|
||||
import Keys.{logLevel, persistLogLevel}
|
||||
|
||||
object LogManager
|
||||
{
|
||||
|
|
@ -15,8 +15,8 @@ object LogManager
|
|||
{
|
||||
val scope = task.scope
|
||||
def level(key: AttributeKey[Level.Value], default: Level.Value): Level.Value = data.get(scope, key) getOrElse default
|
||||
val screenLevel = level(ScreenLogLevel.key, Level.Info)
|
||||
val backingLevel = level(PersistLogLevel.key, Level.Debug)
|
||||
val screenLevel = level(logLevel.key, Level.Info)
|
||||
val backingLevel = level(persistLogLevel.key, Level.Debug)
|
||||
|
||||
val console = ConsoleLogger()
|
||||
val backed = ConsoleLogger(ConsoleLogger.printWriterOut(to), useColor = false) // TODO: wrap this with a filter that strips ANSI codes
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ package sbt
|
|||
import complete.HistoryCommands
|
||||
import HistoryCommands.{Start => HistoryPrefix}
|
||||
import sbt.build.{AggressiveCompile, Auto, BuildException, LoadCommand, Parse, ParseException, ProjectLoad, SourceLoad}
|
||||
import compile.EvalImports
|
||||
import compiler.EvalImports
|
||||
import sbt.complete.{DefaultParsers, Parser}
|
||||
|
||||
import Command.applyEffect
|
||||
import Keys.{Analysis,HistoryPath,Logged,ShellPrompt}
|
||||
import Keys.{analysis,historyPath,logged,shellPrompt}
|
||||
import scala.annotation.tailrec
|
||||
import scala.collection.JavaConversions._
|
||||
import Function.tupled
|
||||
|
|
@ -32,7 +32,7 @@ class xMain extends xsbti.AppMain
|
|||
val state = State( configuration, initialCommandDefs, Set.empty, None, commands, initialAttributes, Next.Continue )
|
||||
run(state)
|
||||
}
|
||||
def initialAttributes = AttributeMap.empty.put(Logged, ConsoleLogger())
|
||||
def initialAttributes = AttributeMap.empty.put(logged, ConsoleLogger())
|
||||
|
||||
@tailrec final def run(state: State): xsbti.MainResult =
|
||||
{
|
||||
|
|
@ -110,10 +110,10 @@ object BuiltinCommands
|
|||
}
|
||||
|
||||
def shell = Command.command(Shell, ShellBrief, ShellDetailed) { s =>
|
||||
val historyPath = (s get HistoryPath.key) getOrElse Some((s.baseDir / ".history").asFile)
|
||||
val prompt = (s get ShellPrompt.key) match { case Some(pf) => pf(s); case None => "> " }
|
||||
val history = (s get historyPath.key) getOrElse Some((s.baseDir / ".history").asFile)
|
||||
val prompt = (s get shellPrompt.key) match { case Some(pf) => pf(s); case None => "> " }
|
||||
val parser = Command.combine(s.processors)
|
||||
val reader = new FullReader(historyPath, parser(s))
|
||||
val reader = new FullReader(history, parser(s))
|
||||
val line = reader.readLine(prompt)
|
||||
line match {
|
||||
case Some(line) => s.copy(onFailure = Some(Shell), commands = line +: Shell +: s.commands)
|
||||
|
|
@ -209,7 +209,7 @@ object BuiltinCommands
|
|||
//TODO: convert
|
||||
/*def history = Command.make( historyHelp: _* ) { case (in, s) if in.line startsWith "!" =>
|
||||
val logError = (msg: String) => CommandSupport.logger(s).error(msg)
|
||||
HistoryCommands(in.line.substring(HistoryPrefix.length).trim, (s get HistoryPath.key) getOrElse None, 500/*JLine.MaxHistorySize*/, logError) match
|
||||
HistoryCommands(in.line.substring(HistoryPrefix.length).trim, (s get historyPath.key) getOrElse None, 500/*JLine.MaxHistorySize*/, logError) match
|
||||
{
|
||||
case Some(commands) =>
|
||||
commands.foreach(println) //printing is more appropriate than logging
|
||||
|
|
@ -295,9 +295,9 @@ object BuiltinCommands
|
|||
|
||||
// TODO: tab completion, low priority
|
||||
def discover = Command.single(Discover, DiscoverBrief, DiscoverDetailed) { (s, arg) =>
|
||||
withAttribute(s, Analysis, "No analysis to process.") { analysis =>
|
||||
withAttribute(s, analysis, "No analysis to process.") { a =>
|
||||
val command = Parse.discover(arg)
|
||||
val discovered = build.Build.discover(analysis, command)
|
||||
val discovered = build.Build.discover(a, command)
|
||||
println(discovered.mkString("\n"))
|
||||
s
|
||||
}
|
||||
|
|
@ -306,8 +306,8 @@ object BuiltinCommands
|
|||
def compile = Command.single(CompileName, CompileBrief, CompileDetailed ) { (s, arg) =>
|
||||
val command = Parse.compile(arg)(s.baseDir)
|
||||
try {
|
||||
val analysis = build.Build.compile(command, s.configuration)
|
||||
s.put(Analysis, analysis)
|
||||
val a = build.Build.compile(command, s.configuration)
|
||||
s.put(analysis, a)
|
||||
} catch { case e: xsbti.CompileFailed => s.fail /* already logged */ }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ package sbt
|
|||
import java.net.URI
|
||||
import Project._
|
||||
import Types.Endo
|
||||
import Keys.{AppConfig, Commands, Config, HistoryPath, ProjectCommand, SessionKey, ShellPrompt, StructureKey, ThisProject, ThisProjectRef, Watch}
|
||||
import Keys.{appConfiguration, buildStructure, commands, configuration, historyPath, projectCommand, sessionSettings, shellPrompt, thisProject, thisProjectRef, watch}
|
||||
import Scope.ThisScope
|
||||
import CommandSupport.logger
|
||||
import compile.Eval
|
||||
import compiler.Eval
|
||||
|
||||
final case class Project(id: String, base: File, aggregate: Seq[ProjectRef] = Nil, dependencies: Seq[Project.ClasspathDependency] = Nil, delegates: Seq[ProjectRef] = Nil,
|
||||
settings: Seq[Project.Setting[_]] = Project.defaultSettings, configurations: Seq[Configuration] = Configurations.default)
|
||||
|
|
@ -40,8 +40,8 @@ object Project extends Init[Scope]
|
|||
}
|
||||
|
||||
def getOrError[T](state: State, key: AttributeKey[T], msg: String): T = state get key getOrElse error(msg)
|
||||
def structure(state: State): Load.BuildStructure = getOrError(state, StructureKey, "No build loaded.")
|
||||
def session(state: State): SessionSettings = getOrError(state, SessionKey, "Session not initialized.")
|
||||
def structure(state: State): Load.BuildStructure = getOrError(state, buildStructure, "No build loaded.")
|
||||
def session(state: State): SessionSettings = getOrError(state, sessionSettings, "Session not initialized.")
|
||||
def extract(state: State): Extracted =
|
||||
{
|
||||
val se = session(state)
|
||||
|
|
@ -58,7 +58,7 @@ object Project extends Init[Scope]
|
|||
|
||||
def setProject(session: SessionSettings, structure: Load.BuildStructure, s: State): State =
|
||||
{
|
||||
val newAttrs = s.attributes.put(StructureKey, structure).put(SessionKey, session)
|
||||
val newAttrs = s.attributes.put(buildStructure, structure).put(sessionSettings, session)
|
||||
val newState = s.copy(attributes = newAttrs)
|
||||
updateCurrent(newState.runExitHooks())
|
||||
}
|
||||
|
|
@ -77,13 +77,13 @@ object Project extends Init[Scope]
|
|||
logger(s).info("Set current project to " + id + " (in build " + uri +")")
|
||||
def get[T](k: SettingKey[T]): Option[T] = k in ref get structure.data
|
||||
|
||||
val historyPath = get(HistoryPath) flatMap identity
|
||||
val prompt = get(ShellPrompt)
|
||||
val watched = get(Watch)
|
||||
val commands = get(Commands).toList.flatten[Command].map(_ tag (ProjectCommand, true))
|
||||
val newProcessors = commands ++ BuiltinCommands.removeTagged(s.processors, ProjectCommand)
|
||||
val newAttrs = setCond(Watched.Configuration, watched, s.attributes).put(HistoryPath.key, historyPath)
|
||||
s.copy(attributes = setCond(ShellPrompt.key, prompt, newAttrs), processors = newProcessors)
|
||||
val history = get(historyPath) flatMap identity
|
||||
val prompt = get(shellPrompt)
|
||||
val watched = get(watch)
|
||||
val commandDefs = get(commands).toList.flatten[Command].map(_ tag (projectCommand, true))
|
||||
val newProcessors = commandDefs ++ BuiltinCommands.removeTagged(s.processors, projectCommand)
|
||||
val newAttrs = setCond(Watched.Configuration, watched, s.attributes).put(historyPath.key, history)
|
||||
s.copy(attributes = setCond(shellPrompt.key, prompt, newAttrs), processors = newProcessors)
|
||||
}
|
||||
def setCond[T](key: AttributeKey[T], vopt: Option[T], attributes: AttributeMap): AttributeMap =
|
||||
vopt match { case Some(v) => attributes.put(key, v); case None => attributes.remove(key) }
|
||||
|
|
@ -146,7 +146,7 @@ object Project extends Init[Scope]
|
|||
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)) )( (Config :== conf) +: ss)
|
||||
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[_]] =
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ package sbt
|
|||
|
||||
import ProjectNavigation._
|
||||
import Project.updateCurrent
|
||||
import Keys.SessionKey
|
||||
import Keys.sessionSettings
|
||||
import CommandSupport.logger
|
||||
import complete.{DefaultParsers, Parser}
|
||||
import DefaultParsers._
|
||||
|
|
@ -20,7 +20,7 @@ object ProjectNavigation
|
|||
final class ChangeProject(val id: String) extends Navigate
|
||||
|
||||
def command(s: State): Parser[() => State] =
|
||||
if(s get SessionKey isEmpty) failure("No project loaded") else (new ProjectNavigation(s)).command
|
||||
if(s get sessionSettings isEmpty) failure("No project loaded") else (new ProjectNavigation(s)).command
|
||||
}
|
||||
final class ProjectNavigation(s: State)
|
||||
{
|
||||
|
|
@ -32,7 +32,7 @@ final class ProjectNavigation(s: State)
|
|||
def setProject(nuri: URI, nid: String) =
|
||||
{
|
||||
val neval = if(uri == nuri) session.currentEval else mkEval(nuri)
|
||||
updateCurrent(s.put(SessionKey, session.setCurrent(nuri, nid, neval)))
|
||||
updateCurrent(s.put(sessionSettings, session.setCurrent(nuri, nid, neval)))
|
||||
}
|
||||
def mkEval(nuri: URI) = Load.lazyEval(structure.units(nuri).unit)
|
||||
def getRoot(uri: URI) = Load.getRootProject(structure.units)(uri)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
package sbt
|
||||
|
||||
import std._
|
||||
import compile.{Discovered,Discovery}
|
||||
import compiler.{Discovered,Discovery}
|
||||
import inc.Analysis
|
||||
import TaskExtra._
|
||||
import Types._
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package build
|
|||
import inc._
|
||||
|
||||
import java.io.File
|
||||
import compile.{AnalyzingCompiler, CompilerArguments, JavaCompiler}
|
||||
import compiler.{AnalyzingCompiler, CompilerArguments, JavaCompiler}
|
||||
import classpath.ClasspathUtilities
|
||||
import classfile.Analyze
|
||||
import xsbti.api.Source
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package build
|
|||
import java.io.File
|
||||
import classpath.ClasspathUtilities.toLoader
|
||||
import ModuleUtilities.getObject
|
||||
import compile.{AnalyzingCompiler, Discovery, JavaCompiler}
|
||||
import compiler.{AnalyzingCompiler, Discovery, JavaCompiler}
|
||||
import inc.Analysis
|
||||
import Path._
|
||||
import GlobFilter._
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ package sbt
|
|||
package build
|
||||
|
||||
import java.io.File
|
||||
import compile.Discovery
|
||||
import compiler.Discovery
|
||||
|
||||
sealed trait LoadCommand
|
||||
final case class BinaryLoad(classpath: Seq[File], module: Boolean, name: String) extends LoadCommand
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
package sbt
|
||||
package build
|
||||
|
||||
import compile.Discovery
|
||||
import compiler.Discovery
|
||||
import java.io.File
|
||||
|
||||
final class ParseException(msg: String) extends RuntimeException(msg)
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ import Project.Initialize
|
|||
trait Marker
|
||||
{
|
||||
final lazy val Mark = TaskKey[Unit]("mark")
|
||||
final def mark: Initialize[Task[Unit]] = mark(Base)
|
||||
final def mark(project: ProjectRef): Initialize[Task[Unit]] = mark(Base in project)
|
||||
final def mark: Initialize[Task[Unit]] = mark(baseDirectory)
|
||||
final def mark(project: ProjectRef): Initialize[Task[Unit]] = mark(baseDirectory in project)
|
||||
final def mark(baseKey: ScopedSetting[File]): Initialize[Task[Unit]] = baseKey map { base =>
|
||||
val toMark = base / "ran"
|
||||
if(toMark.exists)
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ $ exists ran
|
|||
$ delete ran
|
||||
|
||||
# single project, Aggregate = Enabled on Mark
|
||||
> set Aggregate in Mark :== false
|
||||
> set aggregate in Mark :== false
|
||||
> mark
|
||||
$ exists ran
|
||||
$ delete ran
|
||||
|
||||
# single project, Aggregate = Disabled on Mark
|
||||
> set Aggregate in Mark :== false
|
||||
> set aggregate in Mark :== false
|
||||
> mark
|
||||
$ exists ran
|
||||
$ delete ran
|
||||
|
|
@ -74,28 +74,28 @@ $ delete sub/ran sub/sub/ran
|
|||
> set Mark <<= mark
|
||||
|
||||
# disable aggregation for sub/mark so that sub2/mark doesn't run
|
||||
> set Aggregate in (sub,Mark) :== false
|
||||
> set aggregate in (sub,Mark) :== false
|
||||
> mark
|
||||
$ exists ran sub/ran
|
||||
$ absent sub/sub/ran
|
||||
$ delete ran sub/ran
|
||||
|
||||
# check explicit aggregation. running on root should run root/mark and sub2/mark
|
||||
> set Aggregate in Mark :== Aggregation(sub2 :: Nil)
|
||||
> set aggregate in Mark :== Aggregation(sub2 :: Nil)
|
||||
> mark
|
||||
$ exists ran sub/sub/ran
|
||||
$ absent sub/ran
|
||||
$ delete ran sub/sub/ran
|
||||
|
||||
# check intransitive aggregation. running on root should not continue to sub2/mark
|
||||
> set Aggregate in Mark :== Aggregation(sub :: Nil, false)
|
||||
> set aggregate in Mark :== Aggregation(sub :: Nil, false)
|
||||
> mark
|
||||
$ exists ran sub/ran
|
||||
$ absent sub/sub/ran
|
||||
$ delete ran sub/ran
|
||||
|
||||
# the aggregation setting in a leaf shouldn't affect whether it can be run directly
|
||||
> set Aggregate in (sub2, Mark) :== false
|
||||
> set aggregate in (sub2, Mark) :== false
|
||||
> sub2/mark
|
||||
$ exists sub/sub/ran
|
||||
$ absent ran sub/ran
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
LibraryDependencies ++= Seq(
|
||||
libraryDependencies ++= Seq(
|
||||
"com.novocode" % "junit-interface" % "0.5" % "test",
|
||||
"junit" % "junit" % "4.8" % "test",
|
||||
"org.scala-lang" % "scala-compiler" % "2.8.1"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
LibraryDependencies ++= Seq(
|
||||
libraryDependencies ++= Seq(
|
||||
"org.scala-tools.testing" %% "specs" % "1.6.7.2" % "test",
|
||||
"org.scala-lang" % "scala-compiler" % "2.8.1"
|
||||
)
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
ScalaSource in Configurations.Compile <<= Source( _ / " scala test " )
|
||||
scalaSource in Configurations.Compile <<= sourceDirectory( _ / " scala test " )
|
||||
|
||||
JavaSource in Configurations.Compile <<= Source( _ / " java test " )
|
||||
javaSource in Configurations.Compile <<= sourceDirectory( _ / " java test " )
|
||||
|
||||
TaskKey("init") <<= (ScalaSource in Configurations.Compile, JavaSource in Configurations.Compile) map { (ss, js) =>
|
||||
TaskKey("init") <<= (scalaSource in Configurations.Compile, javaSource in Configurations.Compile) map { (ss, js) =>
|
||||
import IO._
|
||||
createDirectories(ss :: js :: Nil)
|
||||
copyFile(file("changes") / "Test.scala", ss / " Test s.scala")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
> 'set JavacOptions :== Nil'
|
||||
> 'set javacOptions :== Nil'
|
||||
> compile
|
||||
> 'set JavacOptions ++= Seq("-source", "1.4")'
|
||||
> 'set javacOptions ++= Seq("-source", "1.4")'
|
||||
-> compile
|
||||
|
|
@ -3,7 +3,7 @@ import sbt.complete.DefaultParsers._
|
|||
InputKey("check-output") <<= {
|
||||
val parser = token(Space ~> ( ("exists" ^^^ true) | ("absent" ^^^ false) ) )
|
||||
def action(result: TaskKey[Boolean]) =
|
||||
(ClassDirectory in Configurations.Compile, result) map { (dir, shouldExist) =>
|
||||
(classDirectory in Configurations.Compile, result) map { (dir, shouldExist) =>
|
||||
if((dir / "Anon.class").exists != shouldExist) error("Top level class incorrect" )
|
||||
else if( (dir / "Anon$1.class").exists != shouldExist) error("Inner class incorrect" )
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,19 +4,19 @@
|
|||
# much purpose other than checking that the 'set' command
|
||||
# re-evaluates the project data.
|
||||
|
||||
> 'set Name :== "lazy-package-name"'
|
||||
> set CrossPaths :== false
|
||||
> 'set name :== "lazy-package-name"'
|
||||
> set crossPaths :== false
|
||||
|
||||
> 'set Version :== "0.1.1"'
|
||||
> 'set version :== "0.1.1"'
|
||||
> package
|
||||
$ exists "target/lazy-package-name-0.1.1.jar"
|
||||
> clean
|
||||
|
||||
> 'set Version :== "0.1.2"'
|
||||
> 'set version :== "0.1.2"'
|
||||
> package
|
||||
$ exists "target/lazy-package-name-0.1.2.jar"
|
||||
> clean
|
||||
|
||||
> 'set Version :== "0.1.3"'
|
||||
> 'set version :== "0.1.3"'
|
||||
> package
|
||||
$ exists "target/lazy-package-name-0.1.3.jar"
|
||||
|
|
|
|||
|
|
@ -1,22 +1,21 @@
|
|||
import java.util.jar.{Attributes, Manifest}
|
||||
import Path.makeString
|
||||
import Keys.{Package, ScalaInstance}
|
||||
import Configurations.Compile
|
||||
|
||||
Name :== "Jar Manifest Test"
|
||||
name :== "Jar Manifest Test"
|
||||
|
||||
Version :== "0.2"
|
||||
version :== "0.2"
|
||||
|
||||
CrossPaths :== false
|
||||
crossPaths :== false
|
||||
|
||||
MainClass :== Some("jartest.Main")
|
||||
mainClass :== Some("jartest.Main")
|
||||
|
||||
PackageOptions in (Compile, Package) <<= (PackageOptions in (Compile, Package), ScalaInstance) map { (opts, si) =>
|
||||
packageOptions in (Compile, packageBin) <<= (packageOptions in (Compile, packageBin), scalaInstance) map { (opts, si) =>
|
||||
def manifestExtra =
|
||||
{
|
||||
val mf = new Manifest
|
||||
mf.getMainAttributes.put(Attributes.Name.CLASS_PATH, makeString(si.libraryJar :: Nil) )
|
||||
mf
|
||||
}
|
||||
opts :+ sbt.Package.JarManifest(manifestExtra)
|
||||
opts :+ Package.JarManifest(manifestExtra)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
Name :== "Main Resources Test"
|
||||
name :== "Main Resources Test"
|
||||
|
||||
Version :== "0.1"
|
||||
version :== "0.1"
|
||||
|
||||
CrossPaths :== false
|
||||
crossPaths :== false
|
||||
|
||||
PackageOptions <<= (PackageOptions, Keys.ScalaInstance) map { (opts, si) =>
|
||||
packageOptions <<= (packageOptions, scalaInstance) map { (opts, si) =>
|
||||
def manifestExtra =
|
||||
{
|
||||
import java.util.jar._
|
||||
|
|
@ -12,5 +12,5 @@ PackageOptions <<= (PackageOptions, Keys.ScalaInstance) map { (opts, si) =>
|
|||
mf.getMainAttributes.put(Attributes.Name.CLASS_PATH, si.libraryJar.getAbsolutePath)
|
||||
mf
|
||||
}
|
||||
sbt.Package.JarManifest(manifestExtra) +: opts
|
||||
Package.JarManifest(manifestExtra) +: opts
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
CrossPaths :== false
|
||||
crossPaths :== false
|
||||
|
||||
Name :== "definition-lib-forname-test"
|
||||
name :== "definition-lib-forname-test"
|
||||
|
||||
Version :== "1.0"
|
||||
version :== "1.0"
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
CrossPaths :== false
|
||||
crossPaths :== false
|
||||
|
||||
TaskKey("use-jar") := { injar.Test.other; () }
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@ $ mkdir sub3 sub1 sub2
|
|||
|
||||
> project sub2
|
||||
# This can't actually fail, unfortunately. The repl traps the exception and continues normally.
|
||||
> 'set InitialCommands :== """assert((Name in currentRef get structure.data) == Some("sub2")) """ '
|
||||
> 'set initialCommands :== """assert((name in currentRef get structure.data) == Some("sub2")) """ '
|
||||
> console-project
|
||||
|
|
@ -10,23 +10,23 @@ object Flat extends Build
|
|||
)
|
||||
|
||||
def baseSettings = Seq(
|
||||
LibraryDependencies += "org.scala-tools.testing" %% "scalacheck" % "1.8" % "test",
|
||||
SourceFilter := "*.java" | "*.scala"
|
||||
libraryDependencies += "org.scala-tools.testing" %% "scalacheck" % "1.8" % "test",
|
||||
sourceFilter := "*.java" | "*.scala"
|
||||
)
|
||||
|
||||
def forConfig(conf: Configuration, name: String) = Default.inConfig(conf)( unpackage(name) )
|
||||
def forConfig(conf: Configuration, name: String) = Project.inConfig(conf)( unpackageSettings(name) )
|
||||
|
||||
def unpackage(name: String) = Seq(
|
||||
SourceDirectories := file(name) :: Nil,
|
||||
ResourceDirectories :== SourceDirectories,
|
||||
Keys.Resources <<= (SourceDirectories, SourceFilter, DefaultExcludes) map {
|
||||
def unpackageSettings(name: String) = Seq(
|
||||
sourceDirectories := file(name) :: Nil,
|
||||
resourceDirectories :== sourceDirectories,
|
||||
resources <<= (sourceDirectories, sourceFilter, defaultExcludes) map {
|
||||
(srcs, filter, excl) => srcs.descendentsExcept(-filter,excl).getFiles.toSeq
|
||||
},
|
||||
Unpackage <<= (JarPath in PackageSrc, Base) map { (jar, base) =>
|
||||
unpackage <<= (jarPath in packageSrc, baseDirectory) map { (jar, base) =>
|
||||
IO.unzip(jar, base / name)
|
||||
}
|
||||
)
|
||||
|
||||
val Unpackage = TaskKey[Unit]("unpackage-src")
|
||||
val unpackage = TaskKey[Unit]("unpackage")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ $ delete test-src
|
|||
|
||||
-> test:run
|
||||
|
||||
> unpackage-src
|
||||
> test:unpackage-src
|
||||
> unpackage
|
||||
> test:unpackage
|
||||
|
||||
> test:test
|
||||
> test:run
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
CrossPaths :== false
|
||||
crossPaths :== false
|
||||
|
||||
Name :== "definition-lib-test"
|
||||
name :== "definition-lib-test"
|
||||
|
||||
Version :== "1.0"
|
||||
version :== "1.0"
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
CrossPaths :== false
|
||||
crossPaths :== false
|
||||
|
||||
TaskKey("use-jar") := { injar.Test.foo }
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import sbt._
|
||||
import Keys.Name
|
||||
import Keys.name
|
||||
|
||||
object TestBuild extends Build
|
||||
{
|
||||
|
|
@ -7,5 +7,5 @@ object TestBuild extends Build
|
|||
proj("a", "."),
|
||||
proj("b", "b")
|
||||
)
|
||||
def proj(id: String, dir: String) = Project(id, file(dir), settings = Seq( Name :== id ) )
|
||||
def proj(id: String, dir: String) = Project(id, file(dir), settings = Seq( name :== id ) )
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import sbt._
|
||||
import Keys.Name
|
||||
import Keys.name
|
||||
|
||||
object TestBuild extends MakeBuild
|
||||
{
|
||||
|
|
@ -11,5 +11,5 @@ object SecondBuild extends MakeBuild
|
|||
}
|
||||
trait MakeBuild extends Build
|
||||
{
|
||||
def proj(id: String, dir: String) = Project(id, file(dir), settings = Seq( Name :== id ) )
|
||||
def proj(id: String, dir: String) = Project(id, file(dir), settings = Seq( name :== id ) )
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
project.version=1.0
|
||||
project.name=Plugins Test
|
||||
|
|
@ -1 +1 @@
|
|||
LibraryDependencies += "antlr" % "antlr" % "2.7.7"
|
||||
libraryDependencies += "antlr" % "antlr" % "2.7.7"
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
LibraryDependencies <<= (LibraryDependencies, Project.AppConfig) { (deps, conf) =>
|
||||
libraryDependencies <<= (libraryDependencies, appConfiguration) { (deps, conf) =>
|
||||
deps :+ ("org.scala-tools.sbt" %% "sbt" % conf.provider.id.version)
|
||||
}
|
||||
|
|
@ -3,8 +3,8 @@ $ exists flag
|
|||
$ delete flag
|
||||
|
||||
$ mkdir "forked"
|
||||
> set Keys.Fork :== true
|
||||
> 'set Base in RunTask <<= Base(_ / "forked")'
|
||||
> set fork :== true
|
||||
> 'set baseDirectory in run <<= baseDirectory(_ / "forked")'
|
||||
|
||||
> run "forked"
|
||||
$ exists forked/flag
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
TaskKey("output-empty") <<= ClassDirectory in Configurations.Compile map { outputDirectory =>
|
||||
TaskKey("output-empty") <<= classDirectory in Configurations.Compile map { outputDirectory =>
|
||||
def classes = (outputDirectory ** "*.class").get
|
||||
if(!classes.isEmpty) error("Classes existed:\n\t" + classes.mkString("\n\t"))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
project.name=implicit
|
||||
project.version=1.0
|
||||
project.scratch=true
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
project.name=import
|
||||
project.version=1.0
|
||||
project.scratch=true
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
Name :== "test"
|
||||
name :== "test"
|
||||
|
||||
TaskKey("check-same") <<= CompileTask in Configurations.Compile map { analysis =>
|
||||
TaskKey("check-same") <<= compile in Configurations.Compile map { analysis =>
|
||||
analysis.apis.internal foreach { case (_, api) =>
|
||||
assert( xsbt.api.APIUtil.verifyTypeParameters(api) )
|
||||
assert( xsbt.api.SameAPI(api, api) )
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ object B extends Build
|
|||
TaskKey("check-second") <<= checkTask("Second")
|
||||
)
|
||||
private def checkTask(className: String) =
|
||||
FullClasspath in Configurations.Runtime map { runClasspath =>
|
||||
fullClasspath in Configurations.Runtime map { runClasspath =>
|
||||
val cp = runClasspath.map(_.data.toURI.toURL).toArray
|
||||
Class.forName(className, false, new URLClassLoader(cp))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
LibraryDependencies += "org.scalatest" % "scalatest" % "1.3"
|
||||
libraryDependencies += "org.scalatest" % "scalatest" % "1.3"
|
||||
|
||||
TestOptions in Configurations.Test ++= {
|
||||
testOptions in Configurations.Test ++= {
|
||||
def args(path: String, args: String*): Seq[TestOption] = if(file(path).exists) Test.Argument(args : _*) :: Nil else Nil
|
||||
//
|
||||
args("success1", "-n", "test2 test3") ++
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
LibraryDependencies += "org.scala-tools.testing" %% "specs" % "1.6.7.2" intransitive()
|
||||
libraryDependencies += "org.scala-tools.testing" %% "specs" % "1.6.7.2" intransitive()
|
||||
|
|
@ -1 +1 @@
|
|||
LibraryDependencies += "org.scala-tools.testing" %% "specs" % "1.6.7.2" intransitive()
|
||||
libraryDependencies += "org.scala-tools.testing" %% "specs" % "1.6.7.2" intransitive()
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
project.name=Specs Test Type Test
|
||||
project.version=1.0
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
import sbt._
|
||||
|
||||
class TestProject(info: ProjectInfo) extends DefaultProject(info)
|
||||
{
|
||||
val specs = "org.scala-tools.testing" %% "specs" % "1.6.1" intransitive()
|
||||
}
|
||||
Loading…
Reference in New Issue