Merge pull request #2646 from dwijnand/cleanups

Cleanups
This commit is contained in:
eugene yokota 2016-06-21 18:40:01 +02:00 committed by GitHub
commit 7bc9b5a875
188 changed files with 408 additions and 2256 deletions

View File

@ -7,6 +7,8 @@ Migration notes
- `sbt.Plugin` is also gone. Use auto plugins.
- The incremental compiler, called Zinc, uses class-based name hashing.
- Zinc drops support for Scala 2.8.x and 2.9.x.
- Removed the pre-0.13.7 *.sbt file parser (previously available under `-Dsbt.parser.simple=true`)
- Removed old, hypher-separated key names (use `publishLocal` instead of `publish-local`)
#### Additional import required

View File

@ -44,12 +44,13 @@ object Doc {
// def apply(maximumErrors: Int, compiler: sbt.compiler.Javadoc) = new Javadoc(maximumErrors, compiler)
private[sbt] final class Scaladoc(maximumErrors: Int, compiler: AnalyzingCompiler) extends Doc {
def apply(label: String, sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String], log: Logger) {
def apply(label: String, sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String], log: Logger): Unit = {
generate("Scala", label, compiler.doc, sources, classpath, outputDirectory, options, maximumErrors, log)
}
}
// TODO: trait Javadoc in package inc is deprecated: Please use the new set of compilers in sbt.compilers.javac
private[sbt] final class Javadoc(maximumErrors: Int, doc: sbt.internal.inc.Javadoc) extends Doc {
def apply(label: String, sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String], log: Logger) {
def apply(label: String, sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String], log: Logger): Unit = {
// javadoc doesn't handle *.scala properly, so we evict them from javadoc sources list.
generate("Java", label, doc.doc, sources.filterNot(_.name.endsWith(".scala")), classpath, outputDirectory, options, maximumErrors, log)
}
@ -61,7 +62,7 @@ sealed trait Doc {
// def apply(label: String, sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String], log: Logger): Unit
private[sbt] final def generate(variant: String, label: String, docf: Gen, sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String], maxErrors: Int, log: Logger) {
private[sbt] final def generate(variant: String, label: String, docf: Gen, sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String], maxErrors: Int, log: Logger): Unit = {
val logSnip = variant + " API documentation"
if (sources.isEmpty)
log.info("No sources available, skipping " + logSnip + "...")

View File

@ -20,7 +20,7 @@ object DotGraph {
def packages(relations: Relations, outputDirectory: File, sourceRoots: Iterable[File]): Unit = {
val packageOnly = (path: String) =>
{
val last = path.lastIndexOf(File.separatorChar)
val last = path.lastIndexOf(File.separatorChar.toInt)
val packagePath = (if (last > 0) path.substring(0, last) else path).trim
if (packagePath.isEmpty) "" else packagePath.replace(File.separatorChar, '.')
}
@ -34,8 +34,8 @@ object DotGraph {
generateGraph(file("binary-dependencies"), "externalDependencies", relations.binaryDep, externalToString, sourceToString)
}
def generateGraph[Key, Value](file: File, graphName: String, relation: Relation[Key, Value],
keyToString: Key => String, valueToString: Value => String) {
def generateGraph[K, V](file: File, graphName: String, relation: Relation[K, V],
keyToString: K => String, valueToString: V => String): Unit = {
import scala.collection.mutable.{ HashMap, HashSet }
val mappedGraph = new HashMap[String, HashSet[String]]
for ((key, values) <- relation.forwardMap; keyString = keyToString(key); value <- values)

View File

@ -42,7 +42,7 @@ private[sbt] object ForkTests {
val resultsAcc = mutable.Map.empty[String, SuiteResult]
lazy val result = TestOutput(overall(resultsAcc.values.map(_.result)), resultsAcc.toMap, Iterable.empty)
def run() {
def run(): Unit = {
val socket =
try {
server.accept()

View File

@ -59,7 +59,7 @@ object Sync {
IO.copyLastModified(source, target)
}
def noDuplicateTargets(relation: Relation[File, File]) {
def noDuplicateTargets(relation: Relation[File, File]): Unit = {
val dups = relation.reverseMap.filter {
case (target, srcs) =>
srcs.size >= 2 && srcs.exists(!_.isDirectory)

View File

@ -3,11 +3,10 @@ package compiler
import scala.reflect.Manifest
import scala.tools.nsc.{ ast, interpreter, io, reporters, util, CompilerCommand, Global, Phase, Settings }
import interpreter.AbstractFileClassLoader
import io.{ AbstractFile, PlainFile, VirtualDirectory }
import ast.parser.Tokens
import reporters.{ ConsoleReporter, Reporter }
import scala.reflect.internal.util.BatchSourceFile
import scala.reflect.internal.util.{ AbstractFileClassLoader, BatchSourceFile }
import Tokens.{ EOF, NEWLINE, NEWLINES, SEMI }
import java.io.File
import java.nio.ByteBuffer
@ -90,7 +89,7 @@ final class Eval(optionsNoncp: Seq[String], classpath: Seq[File], mkReporter: Se
val tpt: Tree = expectedType(tpeName)
augment(parser, importTrees, tree, tpt, moduleName)
}
def extra(run: Run, unit: CompilationUnit) = atPhase(run.typerPhase.next) { (new TypeExtractor).getType(unit.body) }
def extra(run: Run, unit: CompilationUnit) = enteringPhase(run.typerPhase.next) { (new TypeExtractor).getType(unit.body) }
def read(file: File) = IO.read(file)
def write(value: String, f: File) = IO.write(f, value)
def extraHash = ""
@ -112,7 +111,7 @@ final class Eval(optionsNoncp: Seq[String], classpath: Seq[File], mkReporter: Se
syntheticModule(fullParser, importTrees, trees.toList, moduleName)
}
def extra(run: Run, unit: CompilationUnit) = {
atPhase(run.typerPhase.next) { (new ValExtractor(valTypes.toSet)).getVals(unit.body) }
enteringPhase(run.typerPhase.next) { (new ValExtractor(valTypes.toSet)).getVals(unit.body) }
}
def read(file: File) = IO.readLines(file)
def write(value: Seq[String], file: File) = IO.writeLines(file, value)
@ -176,7 +175,7 @@ final class Eval(optionsNoncp: Seq[String], classpath: Seq[File], mkReporter: Se
if (phase == null || phase == phase.next || reporter.hasErrors)
()
else {
atPhase(phase) { phase.run }
enteringPhase(phase) { phase.run }
compile(phase.next)
}
}
@ -221,7 +220,7 @@ final class Eval(optionsNoncp: Seq[String], classpath: Seq[File], mkReporter: Se
Block(List(Apply(Select(Super(This(emptyTypeName), emptyTypeName), nme.CONSTRUCTOR), Nil)), Literal(Constant(())))
)
def moduleBody = Template(List(gen.scalaAnyRefConstr), emptyValDef, emptyInit :: definitions)
def moduleBody = Template(List(gen.scalaAnyRefConstr), noSelfType, emptyInit :: definitions)
def moduleDef = ModuleDef(NoMods, newTermName(objectName), moduleBody)
parser.makePackaging(0, emptyPkg, (imports :+ moduleDef).toList)
}
@ -245,7 +244,7 @@ final class Eval(optionsNoncp: Seq[String], classpath: Seq[File], mkReporter: Se
}
override def traverse(tree: Tree): Unit = tree match {
case ValDef(_, n, actualTpe, _) if isTopLevelModule(tree.symbol.owner) && isAcceptableType(actualTpe.tpe) =>
vals ::= nme.localToGetter(n).encoded
vals ::= n.dropLocal.encoded
case _ => super.traverse(tree)
}
}

View File

@ -58,7 +58,7 @@ object BasicCommands {
def completionsCommand = Command.make(CompletionsCommand, CompletionsBrief, CompletionsDetailed)(completionsParser)
def completionsParser(state: State) =
{
val notQuoted = (NotQuoted ~ any.*) map { case (nq, s) => (nq +: s).mkString }
val notQuoted = (NotQuoted ~ any.*) map { case (nq, s) => nq ++ s }
val quotedOrUnquotedSingleArgument = Space ~> (StringVerbatim | StringEscapable | notQuoted)
applyEffect(token(quotedOrUnquotedSingleArgument ?? "" examples ("", " ")))(runCompletions(state))

View File

@ -23,16 +23,16 @@ trait Watched {
*/
def pollInterval: Int = Watched.PollDelayMillis
/** The message to show when triggered execution waits for sources to change.*/
def watchingMessage(s: WatchState): String = Watched.defaultWatchingMessage(s)
private[sbt] def watchingMessage(s: WatchState): String = Watched.defaultWatchingMessage(s)
/** The message to show before an action is run. */
def triggeredMessage(s: WatchState): String = Watched.defaultTriggeredMessage(s)
private[sbt] def triggeredMessage(s: WatchState): String = Watched.defaultTriggeredMessage(s)
}
object Watched {
val defaultWatchingMessage: WatchState => String = _.count + ". Waiting for source changes... (press enter to interrupt)"
val defaultTriggeredMessage: WatchState => String = const("")
val clearWhenTriggered: WatchState => String = const(clearScreen)
def clearScreen: String = "\033[2J\033[0;0H"
def clearScreen: String = "\u001b[2J\u001b[0;0H"
private[this] class AWatched extends Watched

View File

@ -53,14 +53,14 @@ object IPC {
try { f(new IPC(s)) }
finally { s.close() }
final class Server private[IPC] (s: ServerSocket) extends NotNull {
final class Server private[IPC] (s: ServerSocket) {
def port = s.getLocalPort
def close() = s.close()
def isClosed: Boolean = s.isClosed
def connection[T](f: IPC => T): T = IPC.ipc(s.accept())(f)
}
}
final class IPC private (s: Socket) extends NotNull {
final class IPC private (s: Socket) {
def port = s.getLocalPort
private val in = new BufferedReader(new InputStreamReader(s.getInputStream))
private val out = new BufferedWriter(new OutputStreamWriter(s.getOutputStream))

View File

@ -20,7 +20,7 @@ object Append {
def appendValues(a: Seq[T], b: Seq[V]): Seq[T] = a ++ b
def appendValue(a: Seq[T], b: V): Seq[T] = a :+ b
}
implicit def appendSeqImplicit[T, V <% T]: Sequence[Seq[T], Seq[V], V] = new Sequence[Seq[T], Seq[V], V] {
implicit def appendSeqImplicit[T, V](implicit ev: V => T): Sequence[Seq[T], Seq[V], V] = new Sequence[Seq[T], Seq[V], V] {
def appendValues(a: Seq[T], b: Seq[V]): Seq[T] = a ++ (b map { x => (x: T) })
def appendValue(a: Seq[T], b: V): Seq[T] = a :+ (b: T)
}
@ -28,7 +28,7 @@ object Append {
def appendValues(a: List[T], b: List[V]): List[T] = a ::: b
def appendValue(a: List[T], b: V): List[T] = a :+ b
}
implicit def appendListImplicit[T, V <% T]: Sequence[List[T], List[V], V] = new Sequence[List[T], List[V], V] {
implicit def appendListImplicit[T, V](implicit ev: V => T): Sequence[List[T], List[V], V] = new Sequence[List[T], List[V], V] {
def appendValues(a: List[T], b: List[V]): List[T] = a ::: (b map { x => (x: T) })
def appendValue(a: List[T], b: V): List[T] = a :+ (b: T)
}

View File

@ -128,20 +128,20 @@ object InputTask {
{
val seen = new java.util.IdentityHashMap[Task[_], Task[_]]
lazy val f: Task ~> Task = new (Task ~> Task) {
def apply[T](t: Task[T]): Task[T] =
def apply[A](t: Task[A]): Task[A] =
{
val t0 = seen.get(t)
if (t0 == null) {
val newAction =
if (t.info.get(marker).isDefined)
Pure(() => value.asInstanceOf[T], inline = true)
Pure(() => value.asInstanceOf[A], inline = true)
else
t.work.mapTask(f)
val newTask = Task(t.info, newAction)
seen.put(t, newTask)
newTask
} else
t0.asInstanceOf[Task[T]]
t0.asInstanceOf[Task[A]]
}
}
f(task)

View File

@ -76,6 +76,7 @@ object Scope {
case LocalProject(id) => ProjectRef(current, id)
case RootProject(uri) => RootProject(resolveBuild(current, uri))
case ProjectRef(uri, id) => ProjectRef(resolveBuild(current, uri), id)
case ThisProject => RootProject(current) // Is this right? It was an inexhaustive match before..
}
def resolveBuild(current: URI, uri: URI): URI =
if (!uri.isAbsolute && current.isOpaque && uri.getSchemeSpecificPart == ".")
@ -96,6 +97,7 @@ object Scope {
case RootProject(uri) =>
val res = resolveBuild(current, uri); ProjectRef(res, rootProject(res))
case ProjectRef(uri, id) => ProjectRef(resolveBuild(current, uri), id)
case ThisProject => ProjectRef(current, rootProject(current)) // Is this right? It was an inexhaustive match before..
}
def resolveBuildRef(current: URI, ref: BuildReference): BuildRef =
ref match {
@ -126,36 +128,6 @@ object Scope {
def projectPrefix(project: ScopeAxis[Reference], show: Reference => String = showProject): String = project.foldStrict(show, "*/", "./")
def showProject = (ref: Reference) => Reference.display(ref) + "/"
@deprecated("No longer used", "0.13.6")
def parseScopedKey(command: String): (Scope, String) =
{
val ScopedKeyRegex2 = """([{](.*?)[}])?((\w*)\/)?(([\w\*]+)\:)?(([\w\-]+)\:\:)?([\w\-]+)""".r
val ScopedKeyRegex2(_, uriOrNull, _, projectIdOrNull, _, configOrNull, _, inTaskOrNull, key) = command
val uriOpt = Option(uriOrNull) map { new URI(_) }
val projectIdOpt = Option(projectIdOrNull)
val configOpt = Option(configOrNull)
val inTaskOpt = Option(inTaskOrNull)
val DotURI = new URI(".")
val GlobalStr = "*"
val scope = (uriOpt, projectIdOpt, configOpt, inTaskOpt) match {
case (None, None, Some(GlobalStr), None) => GlobalScope
case _ =>
val projScope = (uriOpt, projectIdOpt) match {
case (Some(DotURI), Some("")) => Select(ThisBuild)
case (Some(uri), Some("")) => Select(BuildRef(uri))
case (Some(uri), Some(p)) => Select(ProjectRef(uri, p))
case (None, Some(p)) => Select(LocalProject(p))
case _ => This
}
val configScope = configOpt map { case c if c != GlobalStr => Select(ConfigKey(c)) } getOrElse This
val inTaskScope = inTaskOpt map { t => Select(AttributeKey(t)) } getOrElse This
Scope(projScope, configScope, inTaskScope, This)
}
(scope, transformTaskName(key))
}
@deprecated("No longer used", "0.13.6")
val ScopedKeyRegex = """((\w+)\/)?((\w+)\:)?([\w\-]+)""".r
def transformTaskName(s: String) =
{
val parts = s.split("-+")

View File

@ -125,17 +125,17 @@ object Scoped {
* }}}
*
*/
sealed trait ScopingSetting[Result] {
def in(s: Scope): Result
sealed trait ScopingSetting[ResultType] {
def in(s: Scope): ResultType
def in(p: Reference): Result = in(Select(p), This, This)
def in(t: Scoped): Result = in(This, This, Select(t.key))
def in(c: ConfigKey): Result = in(This, Select(c), This)
def in(c: ConfigKey, t: Scoped): Result = in(This, Select(c), Select(t.key))
def in(p: Reference, c: ConfigKey): Result = in(Select(p), Select(c), This)
def in(p: Reference, t: Scoped): Result = in(Select(p), This, Select(t.key))
def in(p: Reference, c: ConfigKey, t: Scoped): Result = in(Select(p), Select(c), Select(t.key))
def in(p: ScopeAxis[Reference], c: ScopeAxis[ConfigKey], t: ScopeAxis[AttributeKey[_]]): Result = in(Scope(p, c, t, This))
def in(p: Reference): ResultType = in(Select(p), This, This)
def in(t: Scoped): ResultType = in(This, This, Select(t.key))
def in(c: ConfigKey): ResultType = in(This, Select(c), This)
def in(c: ConfigKey, t: Scoped): ResultType = in(This, Select(c), Select(t.key))
def in(p: Reference, c: ConfigKey): ResultType = in(Select(p), Select(c), This)
def in(p: Reference, t: Scoped): ResultType = in(Select(p), This, Select(t.key))
def in(p: Reference, c: ConfigKey, t: Scoped): ResultType = in(Select(p), Select(c), Select(t.key))
def in(p: ScopeAxis[Reference], c: ScopeAxis[ConfigKey], t: ScopeAxis[AttributeKey[_]]): ResultType = in(Scope(p, c, t, This))
}
def scopedSetting[T](s: Scope, k: AttributeKey[T]): SettingKey[T] = new SettingKey[T] { val scope = s; val key = k }

View File

@ -58,9 +58,6 @@ object InputWrapper {
private[std] def wrapPrevious[T: c.WeakTypeTag](c: Context)(ts: c.Expr[Any], pos: c.Position): c.Expr[Option[T]] =
wrapImpl[Option[T], InputWrapper.type](c, InputWrapper, WrapPreviousName)(ts, pos)
// TODO 2.11 Remove this after dropping 2.10.x support.
private object HasCompat { val compat = ??? }; import HasCompat._
/**
* Wraps an arbitrary Tree in a call to the `<s>.<wrapName>` method of this module for later processing by an enclosing macro.
* The resulting Tree is the manually constructed version of:
@ -70,11 +67,11 @@ object InputWrapper {
def wrapImpl[T: c.WeakTypeTag, S <: AnyRef with Singleton](c: Context, s: S, wrapName: String)(ts: c.Expr[Any], pos: c.Position)(implicit it: c.TypeTag[s.type]): c.Expr[T] =
{
import c.universe.{ Apply => ApplyTree, _ }
import compat._
import internal.decorators._
val util = new ContextUtil[c.type](c)
val iw = util.singleton(s)
val tpe = c.weakTypeOf[T]
val nme = newTermName(wrapName).encoded
val nme = TermName(wrapName).encodedName
val sel = Select(Ident(iw), nme)
sel.setPos(pos) // need to set the position on Select, because that is where the compileTimeOnly check looks
val tree = ApplyTree(TypeApply(sel, TypeTree(tpe) :: Nil), ts.tree :: Nil)
@ -87,7 +84,7 @@ object InputWrapper {
// call to `.value` was inside a the task macro and eliminated before the end of the typer phase.
// But, if a "naked" call to `.value` left the typer, the superaccessors phase would freak out when
// if hit the untyped trees, before we could get to refchecks and the desired @compileTimeOnly warning.
val typedTree = c.typeCheck(tree)
val typedTree = c.typecheck(tree)
c.Expr[T](typedTree)
}
@ -189,7 +186,7 @@ object ParserInput {
val e = c.Expr[Initialize[InputTask[T]]](p.tree)
wrapInit[Task[T]](c)(reify { Def.toIParser(e.splice) }, pos)
} else
c.abort(pos, s"Internal sbt error. Unexpected type ${tpe.normalize} in parsedInputMacroImpl.")
c.abort(pos, s"Internal sbt error. Unexpected type ${tpe.dealias} in parsedInputMacroImpl.")
}
/** Implements `Parser[T].parsed` by wrapping the Parser with the ParserInput wrapper.*/
@ -209,6 +206,6 @@ object ParserInput {
} else if (tpe <:< c.weakTypeOf[Initialize[State => Parser[T]]])
wrapInit[T](c)(p, pos)
else
c.abort(pos, s"Internal sbt error. Unexpected type ${tpe.normalize} in parsedMacroImpl")
c.abort(pos, s"Internal sbt error. Unexpected type ${tpe.dealias} in parsedMacroImpl")
}
}

View File

@ -31,7 +31,7 @@ private[sbt] object KeyMacro {
{
import c.universe.{ Apply => ApplyTree, _ }
val methodName = c.macroApplication.symbol.name
def processName(n: Name): String = n.decoded.trim // trim is not strictly correct, but macros don't expose the API necessary
def processName(n: Name): String = n.decodedName.toString.trim // trim is not strictly correct, but macros don't expose the API necessary
def enclosingVal(trees: List[c.Tree]): String =
{
trees match {
@ -40,7 +40,7 @@ private[sbt] object KeyMacro {
// lazy val x: X = <methodName> has this form for some reason (only when the explicit type is present, though)
case Block(_, _) :: DefDef(mods, name, _, _, _, _) :: xs if mods.hasFlag(Flag.LAZY) => processName(name)
case _ =>
c.error(c.enclosingPosition, invalidEnclosingTree(methodName.decoded))
c.error(c.enclosingPosition, invalidEnclosingTree(methodName.decodedName.toString))
"<error>"
}
}
@ -48,4 +48,4 @@ private[sbt] object KeyMacro {
}
def enclosingTrees(c: Context): Seq[c.Tree] =
c.asInstanceOf[reflect.macros.runtime.Context].callsiteTyper.context.enclosingContextChain.map(_.tree.asInstanceOf[c.Tree])
}
}

View File

@ -13,6 +13,7 @@ import language.experimental.macros
import scala.reflect._
import reflect.macros._
import reflect.internal.annotations.compileTimeOnly
import scala.reflect.internal.util.UndefinedPosition
/** Instance for the monad/applicative functor for plain Tasks. */
object TaskInstance extends MonadInstance {
@ -195,37 +196,37 @@ object TaskMacro {
private[this] def appendMacroImpl(c: Context)(init: c.Tree, append: c.Tree)(newName: String): c.Tree =
{
import c.universe.{ Apply, ApplyTag, newTermName, Select, SelectTag, TypeApply, TypeApplyTag }
import c.universe._
c.macroApplication match {
case Apply(Apply(TypeApply(Select(preT, nmeT), targs), _), a) =>
Apply(Apply(TypeApply(Select(preT, newTermName(newName).encodedName), targs), init :: sourcePosition(c).tree :: Nil), a)
Apply(Apply(TypeApply(Select(preT, TermName(newName).encodedName), targs), init :: sourcePosition(c).tree :: Nil), a)
case x => ContextUtil.unexpectedTree(x)
}
}
private[this] def removeMacroImpl(c: Context)(init: c.Tree, remove: c.Tree)(newName: String): c.Tree =
{
import c.universe.{ Apply, ApplyTag, newTermName, Select, SelectTag, TypeApply, TypeApplyTag }
import c.universe._
c.macroApplication match {
case Apply(Apply(TypeApply(Select(preT, nmeT), targs), _), r) =>
Apply(Apply(TypeApply(Select(preT, newTermName(newName).encodedName), targs), init :: sourcePosition(c).tree :: Nil), r)
Apply(Apply(TypeApply(Select(preT, TermName(newName).encodedName), targs), init :: sourcePosition(c).tree :: Nil), r)
case x => ContextUtil.unexpectedTree(x)
}
}
private[this] def transformMacroImpl(c: Context)(init: c.Tree)(newName: String): c.Tree =
{
import c.universe.{ Apply, ApplyTag, newTermName, Select, SelectTag }
import c.universe._
val target =
c.macroApplication match {
case Apply(Select(prefix, _), _) => prefix
case x => ContextUtil.unexpectedTree(x)
}
Apply.apply(Select(target, newTermName(newName).encodedName), init :: sourcePosition(c).tree :: Nil)
Apply.apply(Select(target, TermName(newName).encodedName), init :: sourcePosition(c).tree :: Nil)
}
private[this] def sourcePosition(c: Context): c.Expr[SourcePosition] =
{
import c.universe.reify
val pos = c.enclosingPosition
if (pos.isDefined && pos.line >= 0 && pos.source != null) {
if (!pos.isInstanceOf[UndefinedPosition] && pos.line >= 0 && pos.source != null) {
val f = pos.source.file
val name = constant[String](c, settingSource(c, f.path, f.name))
val line = constant[Int](c, pos.line)
@ -316,13 +317,10 @@ object TaskMacro {
private[this] def iTaskMacro[T: c.WeakTypeTag](c: Context)(t: c.Expr[T]): c.Expr[Task[T]] =
Instance.contImpl[T, Id](c, TaskInstance, TaskConvert, MixedBuilder)(Left(t), Instance.idTransform)
// TODO 2.11 Remove this after dropping 2.10.x support.
private object HasCompat { val compat = ??? }; import HasCompat._
private[this] def inputTaskDynMacro0[T: c.WeakTypeTag](c: Context)(t: c.Expr[Initialize[Task[T]]]): c.Expr[Initialize[InputTask[T]]] =
{
import c.universe.{ Apply => ApplyTree, _ }
import compat._
import internal.decorators._
val tag = implicitly[c.WeakTypeTag[T]]
val util = ContextUtil[c.type](c)

View File

@ -1,49 +0,0 @@
package sbt
import org.specs2._
import Scope.{ ThisScope, GlobalScope, parseScopedKey }
import java.net.URI
import sbt.internal.util.AttributeKey
/**
* http://www.scala-sbt.org/0.13/tutorial/Scopes.html
*/
class ScopedKeySpec extends Specification {
def is = s2"""
This is a specification to check the scoped key parsing.
fullClasspath should
${beParsedAs("fullClasspath", ThisScope, "fullClasspath")}
test:fullClasspath should
${beParsedAs("test:fullClasspath", ThisScope in ConfigKey("test"), "fullClasspath")}
*:fullClasspath
${beParsedAs("*:fullClasspath", GlobalScope, "fullClasspath")}
aea33a/test:fullClasspath
${beParsedAs("aea33a/test:fullClasspath", ThisScope in (LocalProject("aea33a"), ConfigKey("test")), "fullClasspath")}
doc::fullClasspath
${beParsedAs("doc::fullClasspath", ThisScope in AttributeKey("doc"), "fullClasspath")}
{file:/hello/}aea33a/test:fullClasspath
${beParsedAs("{file:/hello/}aea33a/test:fullClasspath", ThisScope in (ProjectRef(new URI("file:/hello/"), "aea33a"), ConfigKey("test")), "fullClasspath")}
{file:/hello/}/test:fullClasspath
${beParsedAs("{file:/hello/}/test:fullClasspath", ThisScope in (BuildRef(new URI("file:/hello/")), ConfigKey("test")), "fullClasspath")}
{.}/test:fullClasspath
${beParsedAs("{.}/test:fullClasspath", ThisScope in (ThisBuild, ConfigKey("test")), "fullClasspath")}
{file:/hello/}/compile:doc::fullClasspath
${beParsedAs("{file:/hello/}/compile:doc::fullClasspath", ThisScope in (BuildRef(new URI("file:/hello/")), ConfigKey("compile"), AttributeKey("doc")), "fullClasspath")}
"""
def beParsedAs(cmd: String, scope0: Scope, key0: String) =
{
val (scope, key) = parseScopedKey(cmd)
(scope must_== scope0) and (key must_== key0)
}
}

View File

@ -37,8 +37,8 @@ object Assign {
val dummyt = taskKey[complete.Parser[String]]("dummyt")
val dummys = settingKey[complete.Parser[String]]("dummys")
val dummy3 = settingKey[complete.Parser[(String, Int)]]("dummy3")
val tsk: complete.Parser[Task[String]] = ???
val itsk: Initialize[InputTask[Int]] = ???
val tsk: complete.Parser[Task[String]] = DefaultParsers.failure("ignored")
val itsk: Initialize[InputTask[Int]] = inputKey[Int]("ignored")
val seqSetting = settingKey[Seq[String]]("seqSetting")
val listSetting = settingKey[List[String]]("listSetting")

View File

@ -41,7 +41,7 @@ import sbt.internal.util.Cache.seqFormat
import sbt.util.Logger
import sbt.internal.CommandStrings.ExportStream
import xsbti.Maybe
import xsbti.{ CrossValue, Maybe }
import sbt.util.InterfaceUtil.{ f1, o2m }
import sbt.internal.util.Types._
@ -76,8 +76,7 @@ object Defaults extends BuildCommon {
def thisBuildCore: Seq[Setting[_]] = inScope(GlobalScope.copy(project = Select(ThisBuild)))(Seq(
managedDirectory := baseDirectory.value / "lib_managed"
))
@deprecated("Use AutoPlugins and globalSbtCore instead.", "0.13.2")
lazy val globalCore: Seq[Setting[_]] = globalDefaults(defaultTestTasks(test) ++ defaultTestTasks(testOnly) ++ defaultTestTasks(testQuick) ++ Seq(
private[sbt] lazy val globalCore: Seq[Setting[_]] = globalDefaults(defaultTestTasks(test) ++ defaultTestTasks(testOnly) ++ defaultTestTasks(testQuick) ++ Seq(
excludeFilter :== HiddenFileFilter
) ++ globalIvyCore ++ globalJvmCore) ++ globalSbtCore
@ -196,8 +195,7 @@ object Defaults extends BuildCommon {
historyPath <<= historyPath or target(t => Some(t / ".history")),
sourceDirectory := baseDirectory.value / "src",
sourceManaged := crossTarget.value / "src_managed",
resourceManaged := crossTarget.value / "resource_managed",
cacheDirectory := crossTarget.value / CacheDirectoryName / thisProject.value.id / "global"
resourceManaged := crossTarget.value / "resource_managed"
)
lazy val configPaths = sourceConfigPaths ++ resourceConfigPaths ++ outputConfigPaths
@ -229,7 +227,6 @@ object Defaults extends BuildCommon {
resources <<= Classpaths.concat(managedResources, unmanagedResources)
)
lazy val outputConfigPaths = Seq(
cacheDirectory := crossTarget.value / CacheDirectoryName / thisProject.value.id / configuration.value.name,
classDirectory := crossTarget.value / (prefix(configuration.value.name) + "classes"),
target in doc := crossTarget.value / (prefix(configuration.value.name) + "api")
)
@ -358,10 +355,10 @@ object Defaults extends BuildCommon {
override def pollInterval = interval
override def watchingMessage(s: WatchState) = msg(s)
override def triggeredMessage(s: WatchState) = trigMsg(s)
override def watchPaths(s: State) = EvaluateTask.evaluateTask(Project structure s, key, s, base) match {
case Some(Value(ps)) => ps
case Some(Inc(i)) => throw i
case None => sys.error("key not found: " + Def.displayFull(key))
override def watchPaths(s: State) = EvaluateTask(Project structure s, key, s, base) match {
case Some((_, Value(ps))) => ps
case Some((_, Inc(i))) => throw i
case None => sys.error("key not found: " + Def.displayFull(key))
}
}
}
@ -710,10 +707,6 @@ object Defaults extends BuildCommon {
@deprecated("Use `Util.pairID` instead", "0.12.0")
def pairID = Util.pairID
@deprecated("Use the cacheDirectory val on streams.", "0.13.0")
def perTaskCache(key: TaskKey[_]): Setting[File] =
cacheDirectory ~= { _ / ("for_" + key.key.label) }
@deprecated("Use `packageTaskSettings` instead", "0.12.0")
def packageTasks(key: TaskKey[File], mappingsTask: Initialize[Task[Seq[(File, String)]]]) = packageTaskSettings(key, mappingsTask)
def packageTaskSettings(key: TaskKey[File], mappingsTask: Initialize[Task[Seq[(File, String)]]]) =
@ -848,6 +841,7 @@ object Defaults extends BuildCommon {
def consoleQuickTask = consoleTask(externalDependencyClasspath, consoleQuick)
def consoleTask(classpath: TaskKey[Classpath], task: TaskKey[_]): Initialize[Task[Unit]] =
(compilers in task, classpath in task, scalacOptions in task, initialCommands in task, cleanupCommands in task, taskTemporaryDirectory in task, scalaInstance in task, streams) map {
// TODO: Make exhaustive after zinc is updated to include https://github.com/sbt/zinc/pull/128
case (cs: IncrementalCompilerImpl.Compilers, cp, options, initCommands, cleanup, temp, si, s) =>
val cpFiles = data(cp)
val fullcp = (cpFiles ++ si.allJars).distinct
@ -949,10 +943,6 @@ object Defaults extends BuildCommon {
def sbtPluginExtra(m: ModuleID, sbtV: String, scalaV: String): ModuleID =
m.extra(PomExtraDependencyAttributes.SbtVersionKey -> sbtV, PomExtraDependencyAttributes.ScalaVersionKey -> scalaV).copy(crossVersion = CrossVersion.Disabled)
@deprecated("Use PluginDiscovery.writeDescriptor.", "0.13.2")
def writePluginsDescriptor(plugins: Set[String], dir: File): Seq[File] =
PluginDiscovery.writeDescriptor(plugins.toSeq, dir, PluginDiscovery.Paths.Plugins).toList
def discoverSbtPluginNames: Initialize[Task[PluginDiscovery.DiscoveredNames]] = Def.task {
if (sbtPlugin.value) PluginDiscovery.discoverSourceAll(compile.value) else PluginDiscovery.emptyDiscoveredNames
}
@ -982,8 +972,8 @@ object Defaults extends BuildCommon {
private def distinctParser(exs: Set[String], raw: Boolean): Parser[Seq[String]] =
{
import DefaultParsers._
val base = token(Space) ~> token(NotSpace - "--" examples exs)
import DefaultParsers._, Parser.and
val base = token(Space) ~> token(and(NotSpace, not("--", "Unexpected: ---")) examples exs)
val recurse = base flatMap { ex =>
val (matching, notMatching) = exs.partition(GlobFilter(ex).accept _)
distinctParser(notMatching, raw) map { result => if (raw) ex +: result else matching.toSeq ++ result }
@ -1032,7 +1022,6 @@ object Defaults extends BuildCommon {
lazy val runnerSettings: Seq[Setting[_]] = Seq(runnerTask)
lazy val baseTasks: Seq[Setting[_]] = projectTasks ++ packageBase
lazy val baseClasspaths: Seq[Setting[_]] = Classpaths.publishSettings ++ Classpaths.baseSettings
lazy val configSettings: Seq[Setting[_]] = Classpaths.configSettings ++ configTasks ++ configPaths ++ packageConfig ++ Classpaths.compilerPluginConfig
lazy val compileSettings: Seq[Setting[_]] = configSettings ++ (mainRunMainTask +: mainRunTask +: addBaseSources) ++ Classpaths.addUnmanagedLibrary
@ -1041,10 +1030,6 @@ object Defaults extends BuildCommon {
lazy val itSettings: Seq[Setting[_]] = inConfig(IntegrationTest)(testSettings)
lazy val defaultConfigs: Seq[Setting[_]] = inConfig(Compile)(compileSettings) ++ inConfig(Test)(testSettings) ++ inConfig(Runtime)(Classpaths.configSettings)
// settings that are not specific to a configuration
@deprecated("Settings now split into AutoPlugins.", "0.13.2")
lazy val projectBaseSettings: Seq[Setting[_]] = projectCore ++ runnerSettings ++ paths ++ baseClasspaths ++ baseTasks ++ compileBase ++ disableAggregation
// These are project level settings that MUST be on every project.
lazy val coreDefaultSettings: Seq[Setting[_]] =
projectCore ++ disableAggregation ++ Seq(
@ -1052,8 +1037,6 @@ object Defaults extends BuildCommon {
baseDirectory := thisProject.value.base,
target := baseDirectory.value / "target"
)
@deprecated("Default settings split into coreDefaultSettings and IvyModule/JvmModule plugins.", "0.13.2")
lazy val defaultSettings: Seq[Setting[_]] = projectBaseSettings ++ defaultConfigs
}
object Classpaths {
@ -1140,8 +1123,6 @@ object Classpaths {
publishLocal <<= publishTask(publishLocalConfiguration, deliverLocal),
publishM2 <<= publishTask(publishM2Configuration, deliverLocal)
)
@deprecated("This has been split into jvmPublishSettings and ivyPublishSettings.", "0.13.2")
val publishSettings: Seq[Setting[_]] = ivyPublishSettings ++ jvmPublishSettings
private[this] def baseGlobalDefaults = Defaults.globalDefaults(Seq(
conflictWarning :== ConflictWarning.default("global"),
@ -1172,7 +1153,11 @@ object Classpaths {
val id = app.provider.id
val scalaVersion = app.provider.scalaProvider.version
val binVersion = binaryScalaVersion(scalaVersion)
val cross = if (id.crossVersioned) CrossVersion.binary else CrossVersion.Disabled
val cross = id.crossVersionedValue match {
case CrossValue.Disabled => CrossVersion.Disabled
case CrossValue.Full => CrossVersion.binary
case CrossValue.Binary => CrossVersion.full
}
val base = ModuleID(id.groupID, id.name, sbtVersion.value, crossVersion = cross)
CrossVersion(scalaVersion, binVersion)(base).copy(crossVersion = CrossVersion.Disabled)
}
@ -1189,11 +1174,11 @@ object Classpaths {
organizationHomepage <<= organizationHomepage or homepage,
projectInfo <<= (name, description, homepage, startYear, licenses, organizationName, organizationHomepage, scmInfo, developers) apply ModuleInfo,
overrideBuildResolvers <<= appConfiguration(isOverrideRepositories),
externalResolvers <<= (externalResolvers.task.?, resolvers, appResolvers, useJCenter) {
externalResolvers := ((externalResolvers.?.value, resolvers.value, appResolvers.value, useJCenter.value) match {
case (Some(delegated), Seq(), _, _) => delegated
case (_, rs, Some(ars), uj) => task { ars ++ rs }
case (_, rs, _, uj) => task { Resolver.withDefaultResolvers(rs, uj, mavenCentral = true) }
},
case (_, rs, Some(ars), uj) => ars ++ rs
case (_, rs, _, uj) => Resolver.withDefaultResolvers(rs, uj, mavenCentral = true)
}),
appResolvers := {
val ac = appConfiguration.value
val uj = useJCenter.value
@ -1323,8 +1308,6 @@ object Classpaths {
}
}
)
@deprecated("Split into ivyBaseSettings and jvmBaseSettings.", "0.13.2")
val baseSettings: Seq[Setting[_]] = ivyBaseSettings ++ jvmBaseSettings
def warnResolversConflict(ress: Seq[Resolver], log: Logger): Unit = {
val resset = ress.toSet
@ -1690,10 +1673,9 @@ object Classpaths {
for (f <- productsImplTask.value) yield APIMappings.store(analyzed(f, compile.value), apiURL.value).put(artifact.key, art).put(moduleID.key, module).put(configuration.key, config)
}
private[this] def productsImplTask: Initialize[Task[Seq[File]]] =
(products.task, packageBin.task, exportJars) flatMap { (psTask, pkgTask, useJars) =>
if (useJars) Seq(pkgTask).join else psTask
}
private[this] def productsImplTask: Initialize[Task[Seq[File]]] = Def.task {
if (exportJars.value) Seq(packageBin.value) else products.value
}
def constructBuildDependencies: Initialize[BuildDependencies] = loadedBuild(lb => BuildUtil.dependencies(lb.units))
@ -2060,10 +2042,12 @@ trait BuildExtra extends BuildCommon with DefExtra {
moduleSettings := new PomConfiguration(file.value, ivyScala.value, ivyValidate.value, managedScalaInstance.value)
def runInputTask(config: Configuration, mainClass: String, baseArguments: String*): Initialize[InputTask[Unit]] =
inputTask { result =>
(fullClasspath in config, runner in (config, run), streams, result) map { (cp, r, s, args) =>
toError(r.run(mainClass, data(cp), baseArguments ++ args, s.log))
}
Def.inputTask {
import Def._
val r = (runner in (config, run)).value
val cp = (fullClasspath in config).value
val args = spaceDelimited().parsed
toError(r.run(mainClass, data(cp), baseArguments ++ args, streams.value.log))
}
def runTask(config: Configuration, mainClass: String, arguments: String*): Initialize[Task[Unit]] =
(fullClasspath in config, runner in (config, run), streams) map { (cp, r, s) =>

View File

@ -100,21 +100,6 @@ sealed trait EvaluateTaskConfig {
def minForcegcInterval: Duration
}
final object EvaluateTaskConfig {
/** Pulls in the old configuration format. */
def apply(old: EvaluateConfig): EvaluateTaskConfig = {
object AdaptedTaskConfig extends EvaluateTaskConfig {
def restrictions: Seq[Tags.Rule] = old.restrictions
def checkCycles: Boolean = old.checkCycles
def progressReporter: ExecuteProgress[Task] = old.progress
def cancelStrategy: TaskCancellationStrategy =
if (old.cancelable) TaskCancellationStrategy.Signal
else TaskCancellationStrategy.Null
def forceGarbageCollection = GCUtil.defaultForceGarbageCollection
def minForcegcInterval = GCUtil.defaultMinForcegcInterval
}
AdaptedTaskConfig
}
@deprecated("Use the alternative that specifies minForcegcInterval", "0.13.9")
def apply(restrictions: Seq[Tags.Rule],
checkCycles: Boolean,
@ -152,14 +137,6 @@ final object EvaluateTaskConfig {
final case class PluginData(dependencyClasspath: Seq[Attributed[File]], definitionClasspath: Seq[Attributed[File]], resolvers: Option[Seq[Resolver]], report: Option[UpdateReport], scalacOptions: Seq[String]) {
val classpath: Seq[Attributed[File]] = definitionClasspath ++ dependencyClasspath
}
object PluginData {
@deprecated("Use the alternative that specifies the compiler options and specific classpaths.", "0.13.1")
def apply(dependencyClasspath: Seq[Attributed[File]], definitionClasspath: Seq[Attributed[File]], resolvers: Option[Seq[Resolver]], report: Option[UpdateReport]): PluginData =
PluginData(dependencyClasspath, definitionClasspath, resolvers, report, Nil)
@deprecated("Use the alternative that specifies the specific classpaths.", "0.13.0")
def apply(classpath: Seq[Attributed[File]], resolvers: Option[Seq[Resolver]], report: Option[UpdateReport]): PluginData =
PluginData(classpath, Nil, resolvers, report, Nil)
}
object EvaluateTask {
import std.{ TaskExtra, Transform }
@ -245,7 +222,7 @@ object EvaluateTask {
def injectSettings: Seq[Setting[_]] = Seq(
(state in GlobalScope) ::= dummyState,
(streamsManager in GlobalScope) ::= dummyStreamsManager,
(streamsManager in GlobalScope) ::= Def.dummyStreamsManager,
(executionRoots in GlobalScope) ::= dummyRoots
)
@ -260,10 +237,6 @@ object EvaluateTask {
processResult(result, log)
}
@deprecated("This method does not apply state changes requested during task execution and does not honor concurrent execution restrictions. Use 'apply' instead.", "0.11.1")
def evaluateTask[T](structure: BuildStructure, taskKey: ScopedKey[Task[T]], state: State, ref: ProjectRef, checkCycles: Boolean = false, maxWorkers: Int = SystemProcessors): Option[Result[T]] =
apply(structure, taskKey, state, ref, EvaluateConfig(false, defaultRestrictions(maxWorkers), checkCycles)).map(_._2)
/**
* Evaluates `taskKey` and returns the new State and the result of the task wrapped in Some.
* If the task is not defined, None is returned. The provided task key is resolved against the current project `ref`.
@ -277,9 +250,6 @@ object EvaluateTask {
* If the task is not defined, None is returned. The provided task key is resolved against the current project `ref`.
* `config` configures concurrency and canceling of task execution.
*/
@deprecated("Use EvaluateTaskConfig option instead.", "0.13.5")
def apply[T](structure: BuildStructure, taskKey: ScopedKey[Task[T]], state: State, ref: ProjectRef, config: EvaluateConfig): Option[(State, Result[T])] =
apply(structure, taskKey, state, ref, EvaluateTaskConfig(config))
def apply[T](structure: BuildStructure, taskKey: ScopedKey[Task[T]], state: State, ref: ProjectRef, config: EvaluateTaskConfig): Option[(State, Result[T])] = {
withStreams(structure, state) { str =>
for ((task, toNode) <- getTask(structure, taskKey, state, str, ref)) yield runTask(task, state, str, structure.index.triggers, config)(toNode)
@ -327,14 +297,8 @@ object EvaluateTask {
for (t <- structure.data.get(resolvedScope, taskKey.key)) yield (t, nodeView(state, streams, taskKey :: Nil))
}
def nodeView[HL <: HList](state: State, streams: Streams, roots: Seq[ScopedKey[_]], dummies: DummyTaskMap = DummyTaskMap(Nil)): NodeView[Task] =
Transform((dummyRoots, roots) :: (dummyStreamsManager, streams) :: (dummyState, state) :: dummies)
Transform((dummyRoots, roots) :: (Def.dummyStreamsManager, streams) :: (dummyState, state) :: dummies)
@deprecated("Use new EvaluateTaskConfig option to runTask", "0.13.5")
def runTask[T](root: Task[T], state: State, streams: Streams, triggers: Triggers[Task], config: EvaluateConfig)(implicit taskToNode: NodeView[Task]): (State, Result[T]) =
{
val newConfig = EvaluateTaskConfig(config)
runTask(root, state, streams, triggers, newConfig)(taskToNode)
}
def runTask[T](root: Task[T], state: State, streams: Streams, triggers: Triggers[Task], config: EvaluateTaskConfig)(implicit taskToNode: NodeView[Task]): (State, Result[T]) =
{
import ConcurrentRestrictions.{ completionService, TagMap, Tag, tagged, tagsKey }
@ -406,7 +370,7 @@ object EvaluateTask {
case in @ Incomplete(Some(node: Task[_]), _, _, _, _) => in.copy(node = transformNode(node))
case i => i
}
type AnyCyclic = Execute[Task]#CyclicException[_]
type AnyCyclic = Execute[({ type A[_] <: AnyRef })#A]#CyclicException[_]
def convertCyclicInc: Incomplete => Incomplete = {
case in @ Incomplete(_, _, _, _, Some(c: AnyCyclic)) =>
in.copy(directCause = Some(new RuntimeException(convertCyclic(c))))

View File

@ -13,23 +13,25 @@ final case class Extracted(structure: BuildStructure, session: SessionSettings,
lazy val currentUnit = structure units currentRef.build
lazy val currentProject = currentUnit defined currentRef.project
lazy val currentLoader: ClassLoader = currentUnit.loader
def get[T](key: TaskKey[T]): Task[T] = get(key.task)
/**
* Gets the value assigned to `key` in the computed settings map.
* If the project axis is not explicitly specified, it is resolved to be the current project according to the extracted `session`.
* Other axes are resolved to be `Global` if they are not specified.
*/
def get[T](key: SettingKey[T]) = getOrError(inCurrent(key), key.key)
def get[T](key: SettingKey[T]): T = getOrError(inCurrent(key.scope), key.key)
def get[T](key: TaskKey[T]): Task[T] = getOrError(inCurrent(key.scope), key.key)
/**
* Gets the value assigned to `key` in the computed settings map wrapped in Some. If it does not exist, None is returned.
* If the project axis is not explicitly specified, it is resolved to be the current project according to the extracted `session`.
* Other axes are resolved to be `Global` if they are not specified.
*/
def getOpt[T](key: SettingKey[T]): Option[T] = structure.data.get(inCurrent(key), key.key)
def getOpt[T](key: SettingKey[T]): Option[T] = structure.data.get(inCurrent(key.scope), key.key)
def getOpt[T](key: TaskKey[T]): Option[Task[T]] = structure.data.get(inCurrent(key.scope), key.key)
private[this] def inCurrent[T](key: SettingKey[T]): Scope = if (key.scope.project == This) key.scope.copy(project = Select(currentRef)) else key.scope
private[this] def inCurrent[T](scope: Scope): Scope =
if (scope.project == This) scope.copy(project = Select(currentRef)) else scope
/**
* Runs the task specified by `key` and returns the transformed State and the resulting value of the task.

View File

@ -148,8 +148,6 @@ object Keys {
// Output paths
val classDirectory = SettingKey[File]("class-directory", "Directory for compiled classes and copied resources.", AMinusSetting)
@deprecated("Use the cacheDirectory provided by streams.", "0.13.0")
val cacheDirectory = SettingKey[File]("cache-directory", "Directory used for caching task data.", BMinusSetting)
val cleanFiles = SettingKey[Seq[File]]("clean-files", "The files to recursively delete during a clean.", BSetting)
val cleanKeepFiles = SettingKey[Seq[File]]("clean-keep-files", "Files to keep during a clean.", CSetting)
val crossPaths = SettingKey[Boolean]("cross-paths", "If true, enables cross paths, which distinguish input and output directories for cross-building.", ASetting)
@ -275,6 +273,7 @@ object Keys {
val defaultConfiguration = SettingKey[Option[Configuration]]("default-configuration", "Defines the configuration used when none is specified for a dependency in ivyXML.", CSetting)
val products = TaskKey[Seq[File]]("products", "Build products that get packaged.", BMinusTask)
// TODO: This is used by exportedProducts, exportedProductsIfMissing, exportedProductsNoTracking..
@deprecated("This task is unused by the default project and will be removed.", "0.13.0")
val productDirectories = TaskKey[Seq[File]]("product-directories", "Base directories of build products.", CTask)
val exportJars = SettingKey[Boolean]("export-jars", "Determines whether the exported classpath for this project contains classes (false) or a packaged jar (true).", BSetting)

View File

@ -126,7 +126,7 @@ object BuiltinCommands {
def aboutPlugins(e: Extracted): String =
{
def list(b: BuildUnit) = b.plugins.detected.autoPlugins.map(_.value.label) ++ b.plugins.detected.plugins.names
def list(b: BuildUnit) = b.plugins.detected.autoPlugins.map(_.value.label)
val allPluginNames = e.structure.units.values.flatMap(u => list(u.unit)).toSeq.distinct
if (allPluginNames.isEmpty) "" else allPluginNames.mkString("Available Plugins: ", ", ", "")
}
@ -134,7 +134,7 @@ object BuiltinCommands {
{
val scalaVersion = e.getOpt(Keys.scalaVersion)
val scalaHome = e.getOpt(Keys.scalaHome).flatMap(idFun)
val instance = e.getOpt(Keys.scalaInstance.task).flatMap(_ => quiet(e.runTask(Keys.scalaInstance, s)._2))
val instance = e.getOpt(Keys.scalaInstance).flatMap(_ => quiet(e.runTask(Keys.scalaInstance, s)._2))
(scalaVersion, scalaHome, instance) match {
case (sv, Some(home), Some(si)) => "local Scala version " + selectScalaVersion(sv, si) + " at " + home.getAbsolutePath
case (_, Some(home), None) => "a local Scala build at " + home.getAbsolutePath

View File

@ -341,7 +341,7 @@ ${listConflicts(conflicting)}""")
val m = ru.runtimeMirror(loader)
val im = m.reflect(ap)
val hasGetterOpt = catching(classOf[ScalaReflectionException]) opt {
im.symbol.asType.toType.declaration(ru.newTermName("autoImport")) match {
im.symbol.asType.toType.decl(ru.TermName("autoImport")) match {
case ru.NoSymbol => false
case sym => sym.asTerm.isGetter || sym.asTerm.isModule
}

View File

@ -592,7 +592,8 @@ object Project extends ProjectExtra {
val p = EvaluateTask.executeProgress(extracted, extracted.structure, state)
val r = EvaluateTask.restrictions(state)
val fgc = EvaluateTask.forcegc(extracted, extracted.structure)
runTask(taskKey, state, EvaluateTaskConfig(r, checkCycles, p, ch, fgc))
val mfi = EvaluateTask.minForcegcInterval(extracted, extracted.structure)
runTask(taskKey, state, EvaluateTaskConfig(r, checkCycles, p, ch, fgc, mfi))
}
def runTask[T](taskKey: ScopedKey[Task[T]], state: State, config: EvaluateTaskConfig): Option[(State, Result[T])] = {
val extracted = Project.extract(state)
@ -627,21 +628,21 @@ object Project extends ProjectExtra {
private[sbt] trait GeneratedRootProject
trait ProjectExtra0 {
implicit def wrapProjectReferenceSeqEval[T <% ProjectReference](rs: => Seq[T]): Seq[Eval[ProjectReference]] =
implicit def wrapProjectReferenceSeqEval[T](rs: => Seq[T])(implicit ev: T => ProjectReference): Seq[Eval[ProjectReference]] =
rs map { r => Eval.later(r: ProjectReference) }
}
trait ProjectExtra extends ProjectExtra0 {
implicit def classpathDependencyEval[T <% ClasspathDep[ProjectReference]](p: => T): Eval[ClasspathDep[ProjectReference]] =
implicit def classpathDependencyEval[T](p: => T)(implicit ev: T => ClasspathDep[ProjectReference]): Eval[ClasspathDep[ProjectReference]] =
Eval.later(p: ClasspathDep[ProjectReference])
implicit def wrapProjectReferenceEval[T <% ProjectReference](ref: => T): Eval[ProjectReference] =
implicit def wrapProjectReferenceEval[T](ref: => T)(implicit ev: T => ProjectReference): Eval[ProjectReference] =
Eval.later(ref: ProjectReference)
implicit def wrapSettingDefinitionEval[T <% Def.SettingsDefinition](d: => T): Eval[Def.SettingsDefinition] = Eval.later(d)
implicit def wrapSettingDefinitionEval[T](d: => T)(implicit ev: T => Def.SettingsDefinition): Eval[Def.SettingsDefinition] = Eval.later(d)
implicit def wrapSettingSeqEval(ss: => Seq[Setting[_]]): Eval[Def.SettingsDefinition] = Eval.later(new Def.SettingList(ss))
implicit def configDependencyConstructor[T <% ProjectReference](p: T): Constructor = new Constructor(p)
implicit def classpathDependency[T <% ProjectReference](p: T): ClasspathDep[ProjectReference] = new ClasspathDependency(p, None)
implicit def configDependencyConstructor[T](p: T)(implicit ev: T => ProjectReference): Constructor = new Constructor(p)
implicit def classpathDependency[T](p: T)(implicit ev: T => ProjectReference): ClasspathDep[ProjectReference] = new ClasspathDependency(p, None)
// These used to be in Project so that they didn't need to get imported (due to Initialize being nested in Project).

View File

@ -97,9 +97,9 @@ object Resolvers {
abstract class DistributedVCS {
val scheme: String
def clone(from: String, to: File)
def clone(from: String, to: File): Unit
def checkout(branch: String, in: File)
def checkout(branch: String, in: File): Unit
def toResolver: Resolver = (info: ResolveInfo) => {
val uri = info.uri.withoutMarkerScheme
@ -167,7 +167,7 @@ object Resolvers {
}
private[this] def normalizeDirectoryName(name: String): String =
StringUtilities.normalize(dropExtensions(name))
dropExtensions(name).toLowerCase(Locale.ENGLISH).replaceAll("""\W+""", "-")
private[this] def dropExtensions(name: String): String = name.takeWhile(_ != '.')

View File

@ -187,7 +187,7 @@ object ScopeFilter {
/** Base functionality for filters on values of type `In` that need access to build data.*/
sealed abstract class Base[In] { self =>
/** Implements this filter. */
private[sbt] def apply(data: Data): In => Boolean
private[ScopeFilter] def apply(data: Data): In => Boolean
/** Constructs a filter that selects values that match this filter but not `other`.*/
def --(other: Base[In]): Base[In] = this && -other

View File

@ -10,7 +10,7 @@ final case class ScopedKeyData[A](scoped: ScopedKey[A], value: Any) {
def settingValue: Option[Any] = fold(const(None), const(None), Some(value))
def description: String = fold(fmtMf("Task: %s"), fmtMf("Input task: %s"),
"Setting: %s = %s" format (key.manifest.toString, value.toString))
def fold[A](targ: OptManifest[_] => A, itarg: OptManifest[_] => A, s: => A): A =
def fold[T](targ: OptManifest[_] => T, itarg: OptManifest[_] => T, s: => T): T =
if (key.manifest.runtimeClass == classOf[Task[_]]) targ(key.manifest.typeArguments.head)
else if (key.manifest.runtimeClass == classOf[InputTask[_]]) itarg(key.manifest.typeArguments.head)
else s

View File

@ -158,7 +158,7 @@ object Act {
val taskSeq = tasks.toSeq
def taskKeys(f: AttributeKey[_] => String): Seq[(String, AttributeKey[_])] = taskSeq.map(key => (f(key), key))
val normKeys = taskKeys(_.label)
val valid = allKnown ++ normKeys ++ taskKeys(_.rawLabel)
val valid = allKnown ++ normKeys
val suggested = normKeys.map(_._1).toSet
val keyP = filterStrings(examples(ID, suggested, "key"), valid.keySet, "key") map valid
(token(value(keyP) | GlobalString ^^^ ParsedGlobal) <~ token("::".id)) ?? Omitted

View File

@ -13,7 +13,6 @@ sealed abstract class AddSettings
object AddSettings {
private[sbt] final class Sequence(val sequence: Seq[AddSettings]) extends AddSettings
private[sbt] final object User extends AddSettings
private[sbt] final class Plugins(val include: OldPlugin => Boolean) extends AddSettings
private[sbt] final class AutoPlugins(val include: AutoPlugin => Boolean) extends AddSettings
private[sbt] final class DefaultSbtFiles(val include: File => Boolean) extends AddSettings
private[sbt] final class SbtFiles(val files: Seq[File]) extends AddSettings
@ -30,14 +29,8 @@ object AddSettings {
/** Settings specified in Build.scala `Project` constructors. */
val buildScalaFiles: AddSettings = BuildScalaFiles
/** All plugins that aren't auto plugins. */
val nonAutoPlugins: AddSettings = plugins(const(true))
/** Adds all settings from a plugin to a project. */
val allPlugins: AddSettings = seq(autoPlugins, nonAutoPlugins)
/** Allows the plugins whose names match the `names` filter to automatically add settings to a project. */
def plugins(include: OldPlugin => Boolean): AddSettings = new Plugins(include)
val allPlugins: AddSettings = seq(autoPlugins)
/** Includes user settings in the project. */
val userSettings: AddSettings = User
@ -52,7 +45,7 @@ object AddSettings {
def seq(autos: AddSettings*): AddSettings = new Sequence(autos)
/** The default inclusion of settings. */
val allDefaults: AddSettings = seq(autoPlugins, buildScalaFiles, userSettings, nonAutoPlugins, defaultSbtFiles)
val allDefaults: AddSettings = seq(autoPlugins, buildScalaFiles, userSettings, defaultSbtFiles)
/** Combines two automatic setting configurations. */
def append(a: AddSettings, b: AddSettings): AddSettings = (a, b) match {

View File

@ -123,9 +123,13 @@ case class DetectedAutoPlugin(name: String, value: AutoPlugin, hasAutoImport: Bo
*
* @param builds The [[Build]]s detected in the build definition. This does not include the default [[Build]] that sbt creates if none is defined.
*/
final class DetectedPlugins(val plugins: DetectedModules[OldPlugin], val autoPlugins: Seq[DetectedAutoPlugin], val builds: DetectedModules[BuildDef]) {
/** Sequence of import expressions for the build definition. This includes the names of the [[Plugin]], [[Build]], and [[AutoImport]] modules, but not the [[AutoPlugin]] modules. */
lazy val imports: Seq[String] = BuildUtil.getImports(plugins.names ++ builds.names) ++
final class DetectedPlugins(val autoPlugins: Seq[DetectedAutoPlugin], val builds: DetectedModules[BuildDef]) {
/**
* Sequence of import expressions for the build definition.
* This includes the names of the [[BuildDef]], and [[DetectedAutoPlugin]] modules,
* but not the [[AutoPlugin]] modules.
*/
lazy val imports: Seq[String] = BuildUtil.getImports(builds.names) ++
BuildUtil.importAllRoot(autoImports(autoPluginAutoImports)) ++
BuildUtil.importAll(autoImports(topLevelAutoPluginAutoImports)) ++
BuildUtil.importNamesRoot(autoPlugins.map(_.name).filter(nonTopLevelPlugin))
@ -168,12 +172,6 @@ final class DetectedPlugins(val plugins: DetectedModules[OldPlugin], val autoPlu
* @param detected Auto-detected modules in the build definition.
*/
final class LoadedPlugins(val base: File, val pluginData: PluginData, val loader: ClassLoader, val detected: DetectedPlugins) {
@deprecated("Use the primary constructor.", "0.13.2")
def this(base: File, pluginData: PluginData, loader: ClassLoader, plugins: Seq[OldPlugin], pluginNames: Seq[String]) =
this(base, pluginData, loader,
new DetectedPlugins(new DetectedModules(pluginNames zip plugins), Nil, new DetectedModules(Nil))
)
def fullClasspath: Seq[Attributed[File]] = pluginData.classpath
def classpath = data(fullClasspath)
}

View File

@ -212,53 +212,17 @@ private[sbt] object EvaluateConfigurations {
case _ => Nil
}
}
private[this] def isSpace = (c: Char) => Character isWhitespace c
private[this] def fstS(f: String => Boolean): ((String, Int)) => Boolean = { case (s, i) => f(s) }
private[this] def firstNonSpaceIs(lit: String) = (_: String).view.dropWhile(isSpace).startsWith(lit)
private[this] def or[A](a: A => Boolean, b: A => Boolean): A => Boolean = in => a(in) || b(in)
/** Configures the use of the old sbt parser. */
private[sbt] def useOldParser: Boolean =
sys.props.get("sbt.parser.simple").exists(java.lang.Boolean.parseBoolean)
/**
* Splits a set of lines into (imports, expressions). That is,
* anything on the right of the tuple is a scala expression (definition or setting).
*/
private[sbt] def splitExpressions(file: File, lines: Seq[String]): (Seq[(String, Int)], Seq[(String, LineRange)]) =
{
if (useOldParser) splitExpressions(lines)
else {
val split = SbtParser(file, lines)
// TODO - Look at pulling the parsed expression trees from the SbtParser and stitch them back into a different
// scala compiler rather than re-parsing.
(split.imports, split.settings)
}
}
@deprecated("This method is no longer part of the public API.", "0.13.7")
def splitExpressions(lines: Seq[String]): (Seq[(String, Int)], Seq[(String, LineRange)]) = {
val blank = (_: String).forall(isSpace)
val isImport = firstNonSpaceIs("import ")
val comment = firstNonSpaceIs("//")
val blankOrComment = or(blank, comment)
val importOrBlank = fstS(or(blankOrComment, isImport))
val (imports, settings) = lines.zipWithIndex span importOrBlank
(imports filterNot fstS(blankOrComment), groupedLines(settings, blank, blankOrComment))
}
@deprecated("This method is deprecated and no longer used.", "0.13.7")
def groupedLines(lines: Seq[(String, Int)], delimiter: String => Boolean, skipInitial: String => Boolean): Seq[(String, LineRange)] =
{
val fdelim = fstS(delimiter)
@tailrec def group0(lines: Seq[(String, Int)], accum: Seq[(String, LineRange)]): Seq[(String, LineRange)] =
if (lines.isEmpty) accum.reverse
else {
val start = lines dropWhile fstS(skipInitial)
val (next, tail) = start.span { case (s, _) => !delimiter(s) }
val grouped = if (next.isEmpty) accum else (next.map(_._1).mkString("\n"), LineRange(next.head._2, next.last._2 + 1)) +: accum
group0(tail, grouped)
}
group0(lines, Nil)
val split = SbtParser(file, lines)
// TODO - Look at pulling the parsed expression trees from the SbtParser and stitch them back into a different
// scala compiler rather than re-parsing.
(split.imports, split.settings)
}
private[this] def splitSettingsDefinitions(lines: Seq[(String, LineRange)]): (Seq[(String, LineRange)], Seq[(String, LineRange)]) =
@ -289,7 +253,7 @@ object Index {
def attributeKeys(settings: Settings[Scope]): Set[AttributeKey[_]] =
settings.data.values.flatMap(_.keys).toSet[AttributeKey[_]]
def stringToKeyMap(settings: Set[AttributeKey[_]]): Map[String, AttributeKey[_]] =
stringToKeyMap0(settings)(_.rawLabel) ++ stringToKeyMap0(settings)(_.label)
stringToKeyMap0(settings)(_.label)
private[this] def stringToKeyMap0(settings: Set[AttributeKey[_]])(label: AttributeKey[_] => String): Map[String, AttributeKey[_]] =
{

View File

@ -12,14 +12,16 @@ import java.io.File
object Inspect {
sealed trait Mode
final case class Details(actual: Boolean) extends Mode
private[this] final class Opt(override val toString: String) extends Mode
val DependencyTree: Mode = new Opt("tree")
val Uses: Mode = new Opt("inspect")
val Definitions: Mode = new Opt("definitions")
private[sbt] case object DependencyTreeMode extends Mode { override def toString = "tree" }
private[sbt] case object UsesMode extends Mode { override def toString = "inspect" }
private[sbt] case object DefinitionsMode extends Mode { override def toString = "definitions" }
val DependencyTree: Mode = DependencyTreeMode
val Uses: Mode = UsesMode
val Definitions: Mode = DefinitionsMode
def parser: State => Parser[(Inspect.Mode, ScopedKey[_])] = (s: State) => spacedModeParser(s) flatMap {
case opt @ (Uses | Definitions) => allKeyParser(s).map(key => (opt, Def.ScopedKey(Global, key)))
case opt @ (DependencyTree | Details(_)) => spacedKeyParser(s).map(key => (opt, key))
case opt @ (UsesMode | DefinitionsMode) => allKeyParser(s).map(key => (opt, Def.ScopedKey(Global, key)))
case opt @ (DependencyTreeMode | Details(_)) => spacedKeyParser(s).map(key => (opt, key))
}
val spacedModeParser: (State => Parser[Mode]) = (s: State) => {
val actual = "actual" ^^^ Details(true)
@ -43,12 +45,12 @@ object Inspect {
option match {
case Details(actual) =>
Project.details(structure, actual, sk.scope, sk.key)
case DependencyTree =>
case DependencyTreeMode =>
val basedir = new File(Project.session(s).current.build)
Project.settingGraph(structure, basedir, sk).dependsAscii
case Uses =>
case UsesMode =>
Project.showUses(Project.usedBy(structure, true, sk.key))
case Definitions =>
case DefinitionsMode =>
Project.showDefinitions(sk.key, Project.definitions(structure, true, sk.key))
}
}

View File

@ -70,7 +70,7 @@ trait ExtendableKeyIndex extends KeyIndex {
}
// task axis <-> key
private[sbt] final class AKeyIndex(val data: Relation[Option[AttributeKey[_]], String]) {
def add(task: Option[AttributeKey[_]], key: AttributeKey[_]): AKeyIndex = new AKeyIndex(data + (task, key.rawLabel) + (task, key.label))
def add(task: Option[AttributeKey[_]], key: AttributeKey[_]): AKeyIndex = new AKeyIndex(data + (task, key.label))
def keys(task: Option[AttributeKey[_]]): Set[String] = data.forward(task)
def allKeys: Set[String] = data._2s.toSet
def tasks: Set[AttributeKey[_]] = data._1s.flatten.toSet

View File

@ -5,7 +5,7 @@ package sbt
package internal
import sbt.internal.util.{ Settings, Show, ~> }
import sbt.librarymanagement.{ Configuration, Configurations, Resolver }
import sbt.librarymanagement.{ Configuration, Configurations, Resolver, UpdateOptions }
import sbt.internal.librarymanagement.{ InlineIvyConfiguration, IvyPaths }
import java.io.File
@ -58,7 +58,7 @@ private[sbt] object Load {
val checksums = Nil
val ivyPaths = new IvyPaths(baseDirectory, bootIvyHome(state.configuration))
val ivyConfiguration = new InlineIvyConfiguration(ivyPaths, Resolver.withDefaultResolvers(Nil),
Nil, Nil, localOnly, lock, checksums, None, log)
Nil, Nil, localOnly, lock, checksums, None, UpdateOptions(), log)
val compilers = Compiler.compilers(ClasspathOptions.boot, ivyConfiguration)(state.configuration, log)
val evalPluginDef = EvaluateTask.evalPluginDef(log) _
val delegates = defaultDelegates
@ -216,11 +216,10 @@ private[sbt] object Load {
{
((loadedBuild in GlobalScope :== loaded) +:
transformProjectOnly(loaded.root, rootProject, injectSettings.global)) ++
inScope(GlobalScope)(pluginGlobalSettings(loaded) ++ loaded.autos.globalSettings) ++
inScope(GlobalScope)(loaded.autos.globalSettings) ++
loaded.units.toSeq.flatMap {
case (uri, build) =>
val plugins = build.unit.plugins.detected.plugins.values
val pluginBuildSettings = plugins.flatMap(_.buildSettings) ++ loaded.autos.buildSettings(uri)
val pluginBuildSettings = loaded.autos.buildSettings(uri)
val projectSettings = build.defined flatMap {
case (id, project) =>
val ref = ProjectRef(uri, id)
@ -236,12 +235,6 @@ private[sbt] object Load {
buildSettings ++ projectSettings
}
}
@deprecated("Does not account for AutoPlugins and will be made private.", "0.13.2")
def pluginGlobalSettings(loaded: LoadedBuild): Seq[Setting[_]] =
loaded.units.toSeq flatMap {
case (_, build) =>
build.unit.plugins.detected.plugins.values flatMap { _.globalSettings }
}
def transformProjectOnly(uri: URI, rootProject: URI => String, settings: Seq[Setting[_]]): Seq[Setting[_]] =
Project.transform(Scope.resolveProject(uri, rootProject), settings)
@ -671,11 +664,6 @@ private[sbt] object Load {
val allSettings = {
// TODO - This mechanism of applying settings could be off... It's in two places now...
lazy val defaultSbtFiles = configurationSources(transformedProject.base)
// Grabs the plugin settings for old-style sbt plugins.
def pluginSettings(f: Plugins) = {
val included = loadedPlugins.detected.plugins.values.filter(f.include) // don't apply the filter to AutoPlugins, only Plugins
included.flatMap(p => p.projectSettings)
}
// Filter the AutoPlugin settings we included based on which ones are
// intended in the AddSettings.AutoPlugins filter.
def autoPluginSettings(f: AutoPlugins) =
@ -693,7 +681,6 @@ private[sbt] object Load {
case User => globalUserSettings.projectLoaded(loadedPlugins.loader)
case sf: SbtFiles => settings(sf.files.map(f => IO.resolve(rawProject.base, f)))
case sf: DefaultSbtFiles => settings(defaultSbtFiles.filter(sf.include))
case p: Plugins => pluginSettings(p)
case p: AutoPlugins => autoPluginSettings(p)
case q: Sequence => (Seq.empty[Setting[_]] /: q.sequence) { (b, add) => b ++ expandSettings(add) }
}
@ -744,7 +731,7 @@ private[sbt] object Load {
merge(fs.sortBy(_.getName).map(memoLoadSettingsFile))
// Finds all the build files associated with this project
import AddSettings.{ User, SbtFiles, DefaultSbtFiles, Plugins, AutoPlugins, Sequence, BuildScalaFiles }
import AddSettings.{ User, SbtFiles, DefaultSbtFiles, AutoPlugins, Sequence, BuildScalaFiles }
def associatedFiles(auto: AddSettings): Seq[File] = auto match {
case sf: SbtFiles => sf.files.map(f => IO.resolve(projectBase, f)).filterNot(_.isHidden)
case sf: DefaultSbtFiles => defaultSbtFiles.filter(sf.include).filterNot(_.isHidden)
@ -803,7 +790,7 @@ private[sbt] object Load {
(dir * -GlobFilter(DefaultTargetName)).get.nonEmpty
}
def noPlugins(dir: File, config: LoadBuildConfiguration): LoadedPlugins =
loadPluginDefinition(dir, config, PluginData(config.globalPluginClasspath, None, None))
loadPluginDefinition(dir, config, PluginData(config.globalPluginClasspath, Nil, None, None, Nil))
def buildPlugins(dir: File, s: State, config: LoadBuildConfiguration): LoadedPlugins =
loadPluginDefinition(dir, config, buildPluginDefinition(dir, s, config))
@ -926,10 +913,7 @@ final case class LoadBuildConfiguration(
globalPlugin: Option[GlobalPlugin],
extraBuilds: Seq[URI],
log: Logger) {
lazy val (globalPluginClasspath, globalPluginLoader) = Load.pluginDefinitionLoader(this, Load.globalPluginClasspath(globalPlugin))
lazy val globalPluginNames =
if (globalPluginClasspath.isEmpty) Nil
else PluginDiscovery.binarySourceModuleNames(classpath, loader, PluginDiscovery.Paths.Plugins, classOf[OldPlugin].getName)
lazy val (globalPluginClasspath, _) = Load.pluginDefinitionLoader(this, Load.globalPluginClasspath(globalPlugin))
private[sbt] lazy val globalPluginDefs = {
val pluginData = globalPlugin match {

View File

@ -1,16 +0,0 @@
package sbt
package internal
import Def.Setting
@deprecated("Use AutoPlugin", "0.13.8")
trait OldPlugin {
/** Settings to be appended to all projects in a build. */
def projectSettings: Seq[Setting[_]] = Nil
/** Settings to be appended at the build scope. */
def buildSettings: Seq[Setting[_]] = Nil
/** Settings to be appended at the global scope. */
def globalSettings: Seq[Setting[_]] = Nil
}

View File

@ -20,15 +20,14 @@ object PluginDiscovery {
*/
object Paths {
final val AutoPlugins = "sbt/sbt.autoplugins"
final val Plugins = "sbt/sbt.plugins"
final val Builds = "sbt/sbt.builds"
}
/** Names of top-level modules that subclass sbt plugin-related classes: [[Plugin]], [[AutoPlugin]], and [[BuildDef]]. */
final class DiscoveredNames(val plugins: Seq[String], val autoPlugins: Seq[String], val builds: Seq[String]) {
override def toString: String = s"""DiscoveredNames($plugins, $autoPlugins, $builds)"""
/** Names of top-level modules that subclass sbt plugin-related classes: [[AutoPlugin]], and [[BuildDef]]. */
final class DiscoveredNames(val autoPlugins: Seq[String], val builds: Seq[String]) {
override def toString: String = s"""DiscoveredNames($autoPlugins, $builds)"""
}
def emptyDiscoveredNames: DiscoveredNames = new DiscoveredNames(Nil, Nil, Nil)
def emptyDiscoveredNames: DiscoveredNames = new DiscoveredNames(Nil, Nil)
/** Discovers and loads the sbt-plugin-related top-level modules from the classpath and source analysis in `data` and using the provided class `loader`. */
def discoverAll(data: PluginData, loader: ClassLoader): DetectedPlugins =
@ -48,7 +47,7 @@ object PluginDiscovery {
case (name, value) =>
DetectedAutoPlugin(name, value, sbt.Plugins.hasAutoImportGetter(value, loader))
}
new DetectedPlugins(discover[OldPlugin](Plugins), allAutoPlugins, discover[BuildDef](Builds))
new DetectedPlugins(allAutoPlugins, discover[BuildDef](Builds))
}
/** Discovers the sbt-plugin-related top-level modules from the provided source `analysis`. */
@ -56,7 +55,7 @@ object PluginDiscovery {
{
def discover[T](implicit classTag: reflect.ClassTag[T]): Seq[String] =
sourceModuleNames(analysis, classTag.runtimeClass.getName)
new DiscoveredNames(discover[OldPlugin], discover[AutoPlugin], discover[BuildDef])
new DiscoveredNames(discover[AutoPlugin], discover[BuildDef])
}
// TODO: for 0.14.0, consider consolidating into a single file, which would make the classpath search 4x faster
@ -65,8 +64,7 @@ object PluginDiscovery {
{
import Paths._
val files =
writeDescriptor(names.plugins, dir, Plugins) ::
writeDescriptor(names.autoPlugins, dir, AutoPlugins) ::
writeDescriptor(names.autoPlugins, dir, AutoPlugins) ::
writeDescriptor(names.builds, dir, Builds) ::
Nil
files.flatMap(_.toList)

View File

@ -39,7 +39,7 @@ private[sbt] class PluginsDebug(val available: List[AutoPlugin], val nameToKey:
if(possible.nonEmpty) {
val explained = possible.map(explainPluginEnable)
val possibleString =
if(explained.size > 1) explained.zipWithIndex.map{case (s,i) => s"$i. $s"}.mkString("Multiple plugins are available that can provide $notFoundKey:\n", "\n", "")
if(explained.size > 1) explained.zipWithIndex.map{case (s,i) => s"$i. $s"}.mkString(s"Multiple plugins are available that can provide $notFoundKey:\n", "\n", "")
else s"$notFoundKey is provided by an available (but not activated) plugin:\n${explained.mkString}"
def impossiblePlugins = impossible.map(_.plugin.label).mkString(", ")
val imPostfix = if(impossible.isEmpty) "" else s"\n\nThere are other available plugins that provide $notFoundKey, but they are impossible to add: $impossiblePlugins"

View File

@ -135,7 +135,6 @@ object SessionSettings {
oldState.log.warn("Discarding " + pluralize(oldSettings.size, " session setting") + ". Use 'session save' to persist session settings.")
}
@deprecated("This method will no longer be public", "0.13.7")
def removeRanges[T](in: Seq[T], ranges: Seq[(Int, Int)]): Seq[T] = {
val asSet = (Set.empty[Int] /: ranges) { case (s, (hi, lo)) => s ++ (hi to lo) }
in.zipWithIndex.flatMap { case (t, index) => if (asSet(index + 1)) Nil else t :: Nil }
@ -181,7 +180,6 @@ object SessionSettings {
reapply(newSession.copy(original = newSession.mergeSettings, append = Map.empty), s)
}
@deprecated("This method will no longer be public", "0.13.7")
def writeSettings(pref: ProjectRef, settings: List[SessionSetting], original: Seq[Setting[_]], structure: BuildStructure): (Seq[SessionSetting], Seq[Setting[_]]) = {
val project = Project.getProject(pref, structure).getOrElse(sys.error("Invalid project reference " + pref))
val writeTo: File = BuildPaths.configurationSources(project.base).headOption.getOrElse(new File(project.base, "build.sbt"))
@ -222,7 +220,6 @@ object SessionSettings {
(newWithPos.reverse, other ++ oldShifted)
}
@deprecated("This method will no longer be public", "0.13.7")
def needsTrailingBlank(lines: Seq[String]) = lines.nonEmpty && !lines.takeRight(1).exists(_.trim.isEmpty)
/** Prints all the user-defined SessionSettings (not raw) to System.out. */

View File

@ -27,8 +27,7 @@ object JvmPlugin extends AutoPlugin {
Defaults.paths ++
Classpaths.jvmPublishSettings ++
Classpaths.jvmBaseSettings ++
Defaults.projectTasks ++
Defaults.packageBase ++
Defaults.baseTasks ++
Defaults.compileBase ++
Defaults.defaultConfigs
override lazy val globalSettings: Seq[Setting[_]] =

View File

@ -1 +0,0 @@
*

View File

@ -1,66 +0,0 @@
import SonatypeKeys._
xerial.sbt.Sonatype.sonatypeSettings
organization := "me.benoitguigal"
name := "twitter"
version := "1.1-SNAPSHOT"
scalaVersion := "2.10.2"
resolvers += "spray repo" at "http://repo.spray.io"
libraryDependencies ++= {
val sprayV = "1.2.1"
Seq(
"com.typesafe.akka" %% "akka-actor" % "2.2.3",
"joda-time" % "joda-time" % "2.3",
"org.joda" % "joda-convert" % "1.2",
"io.spray" % "spray-http" % sprayV,
"io.spray" % "spray-httpx" % sprayV,
"io.spray" % "spray-util" % sprayV,
"io.spray" % "spray-client" % sprayV,
"io.spray" % "spray-can" % sprayV,
"com.netflix.rxjava" % "rxjava-scala" % "0.19.6",
"io.spray" %% "spray-json" % "1.2.6",
"org.scalatest" % "scalatest_2.10" % "2.1.3" % "test",
"org.mockito" % "mockito-core" % "1.9.5" % "test")
}
publishMavenStyle := true
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
pomIncludeRepository := { _ => false }
pomExtra := (
<url>https://github.com/benoitguigal/twitter-spray</url>
<licenses>
<license>
<name>BSD-style</name>
<url>http://www.opensource.org/licenses/bsd-license.php</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>git@github.com:benoitguigal/twitter-spray.git</url>
<connection>scm:git:git@github.com:benoitguigal/twitter-spray.git</connection>
</scm>
<developers>
<developer>
<id>BGuigal</id>
<name>Benoit Guigal</name>
<url>http://benoitguigal.me</url>
</developer>
</developers>
)

View File

@ -1,81 +0,0 @@
//////////////////////////////////////
// Root project settings
//////////////////////////////////////
name := Common.PROJECT_NAME
unidocSettings
Common.commonSettings
//////////////////////////////////////
// Subproject definitions
//////////////////////////////////////
lazy val core = Common.subproject("core").dependsOn(util)
lazy val util = Common.subproject("util")
//////////////////////////////////////
// Common settings shared by all projects
//////////////////////////////////////
version in ThisBuild := Common.PROJECT_VERSION
organization in ThisBuild := Common.ORGANIZATION
scalaVersion in ThisBuild := Common.SCALA_VERSION
libraryDependencies in ThisBuild ++= Seq(
"org.scala-lang" % "scala-reflect" % Common.SCALA_VERSION,
"org.slf4j" % "slf4j-api" % Common.SLF4J_VERSION,
"ch.qos.logback" % "logback-classic" % Common.LOGBACK_VERSION % "runtime",
"org.scalatest" %% "scalatest" % Common.SCALATEST_VERSION % "test"
)
scalacOptions in (ThisBuild, Compile) ++= Seq(
"-unchecked",
"-deprecation",
"-feature"
)
parallelExecution in (ThisBuild, Test) := false
fork in (ThisBuild, Test) := true
//////////////////////////////////////
// Publishing settings
//////////////////////////////////////
publishMavenStyle in (ThisBuild) := true
pomIncludeRepository in (ThisBuild) := { _ => false }
licenses in (ThisBuild) := Seq(
"BSD-style" -> url("http://opensource.org/licenses/BSD-2-Clause")
)
homepage in (ThisBuild) := Some(url("http://genslerappspod.github.io/scalavro/"))
pomExtra in (ThisBuild) := (
<scm>
<url>git@github.com:GenslerAppsPod/scalavro.git</url>
<connection>scm:git:git@github.com:GenslerAppsPod/scalavro.git</connection>
</scm>
<developers>
<developer>
<id>ConnorDoyle</id>
<name>Connor Doyle</name>
<url>http://gensler.com</url>
</developer>
</developers>
)
publishTo in (ThisBuild) <<= version { (v: String) =>
val nexus = "https://oss.sonatype.org/"
if (v.trim.endsWith("SNAPSHOT"))
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}

View File

@ -1,52 +0,0 @@
name := "core"
resolvers += "spray repo" at "http://repo.spray.io"
libraryDependencies ++= Seq(
"com.github.scala-incubator.io" %% "scala-io-core" % "0.4.2",
"com.github.scala-incubator.io" %% "scala-io-file" % "0.4.2",
"com.typesafe.akka" %% "akka-actor" % "2.2.4",
"com.typesafe.akka" %% "akka-slf4j" % "2.2.4",
"com.typesafe.scala-logging" %% "scala-logging-slf4j" % "2.1.2",
"io.spray" % "spray-client" % "1.2.1",
"jline" % "jline" % "2.12",
"org.apache.curator" % "curator-recipes" % "2.4.2",
"org.apache.zookeeper" % "zookeeper" % "3.4.6",
"org.fusesource" % "sigar" % "1.6.4" classifier "native" classifier "",
"org.mozilla" % "rhino" % "1.7R4",
"org.reactivemongo" %% "play2-reactivemongo" % "0.10.2",
"org.reactivemongo" %% "reactivemongo" % "0.10.0",
"org.scalaz" %% "scalaz-core" % "7.0.6"
).map(_.exclude("org.slf4j", "slf4j-log4j12"))
val copyNativeLibraries = taskKey[Set[File]]("Copy native libraries to native libraries directory")
copyNativeLibraries := {
val cp = (managedClasspath in Runtime).value
// FIXME: Currently, only sigar has a native library.
// Extract this as a setting when more native libraries are added.
val nativeJarFile = cp.map(_.data).find(_.getName == "sigar-1.6.4-native.jar").get
val nativeLibrariesDirectory = target.value / "native_libraries" / (System.getProperty("sun.arch.data.model") + "bits")
IO.unzip(nativeJarFile, nativeLibrariesDirectory)
}
run <<= (run in Runtime) dependsOn copyNativeLibraries
(test in Test) <<= (test in Test) dependsOn copyNativeLibraries
val toolsJar = if (System.getProperty("os.name") != "Mac OS X") {
Seq(Attributed.blank(file(System.getProperty("java.home").dropRight(3) + "lib/tools.jar")))
} else {
Nil
}
// adding the tools.jar to the unmanaged-jars seq
unmanagedJars in Compile ~= (toolsJar ++ _)
lazy val root = (project in file(".")).enablePlugins(PlayScala)
org.scalastyle.sbt.ScalastylePlugin.Settings
scalariformSettings
Common.settings

View File

@ -1,55 +0,0 @@
name := "play-recaptcha"
description := "Google reCAPTCHA integration for Play Framework"
organization := "com.nappin"
version := "0.9-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
crossScalaVersions := Seq("2.10.4", "2.11.1")
libraryDependencies ++= Seq(
ws,
"org.mockito" % "mockito-core" % "1.+" % "test"
)
// needed to publish to maven central
publishMavenStyle := true
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
publishArtifact in Test := false
pomIncludeRepository := { _ => false }
pomExtra := (
<url>http://chrisnappin.github.io/play-recaptcha</url>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<connection>scm:git:git@github.com:chrisnappin/play-recaptcha.git</connection>
<developerConnection>scm:git:git@github.com:chrisnappin/play-recaptcha.git</developerConnection>
<url>git@github.com:chrisnappin/play-recaptcha.git</url>
</scm>
<developers>
<developer>
<id>chrisnappin</id>
<name>Chris Nappin</name>
<email>chris@nappin.com</email>
<timezone>UTC</timezone>
</developer>
</developers>)

View File

@ -1,75 +0,0 @@
name := """FTL"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.11.1"
resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
libraryDependencies ++= Seq(
jdbc,
anorm,
cache,
ws,
filters,
"org.webjars" % "bootstrap" % "3.0.2",
"com.typesafe.play.plugins" %% "play-plugins-util" % "2.3.0",
"com.typesafe.play.plugins" %% "play-plugins-mailer" % "2.3.0",
"org.mindrot" % "jbcrypt" % "0.3m",
"org.specs2" %% "specs2" % "2.3.12" % "test",
"org.mockito" % "mockito-all" % "1.9.5" % "test",
"org.reactivemongo" %% "play2-reactivemongo" % "0.11.0-SNAPSHOT",
"org.reactivemongo" %% "reactivemongo" % "0.11.0-SNAPSHOT"
)
resolvers ++= Seq(
Resolver.typesafeRepo("releases")
)
organization := "ws.securesocial"
organizationName := "SecureSocial"
organizationHomepage := Some(new URL("http://www.securesocial.ws"))
publishMavenStyle := true
publishArtifact in Test := false
pomIncludeRepository := { _ => false }
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (version.value.trim.endsWith("SNAPSHOT"))
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
startYear := Some(2012)
description := "An authentication module for Play Framework applications supporting OAuth, OAuth2, OpenID, Username/Password and custom authentication schemes."
licenses := Seq("The Apache Software License, Version 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
homepage := Some(url("http://www.securesocial.ws"))
pomExtra := (
<scm>
<url>https://github.com/jaliss/securesocial</url>
<connection>scm:git:git@github.com:jaliss/securesocial.git</connection>
<developerConnection>scm:git:https://github.com/jaliss/securesocial.git</developerConnection>
</scm>
<developers>
<developer>
<id>jaliss</id>
<name>Jorge Aliss</name>
<email>jaliss [at] gmail.com</email>
<url>https://twitter.com/jaliss</url>
</developer>
</developers>
)
scalacOptions := Seq("-feature", "-deprecation")

View File

@ -1,41 +0,0 @@
name := "cms"
organization := "org.qirx"
scalaVersion := "2.11.1"
resolvers += "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases/"
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play" % "2.3.0",
"com.typesafe.play" %% "play-test" % "2.3.0",
"com.typesafe.play" %% "play-json" % "2.3.0",
"org.qirx" %% "little-spec" % "0.4-SNAPSHOT" % "test",
"org.qirx" %% "little-spec-extra-documentation" % "0.4-SNAPSHOT" % "test"
)
unmanagedSourceDirectories in Compile := Seq((scalaSource in Compile).value)
unmanagedSourceDirectories in Test := Seq((scalaSource in Test).value)
testFrameworks += new TestFramework("org.qirx.littlespec.sbt.TestFramework")
val x = taskKey[Unit /* Geef niets terug */]("test")
x := {
val cacheDir = (streams in x).value.cacheDirectory / "unzipped"
val dependencies = (externalDependencyClasspath in Compile).value
val possibleJar = dependencies
.map(a => a.data)
.filter(f => f.getName contains "play-json")
.headOption
possibleJar match {
case Some(file) =>
val unzippedFiles = IO.unzip(from = file, toDirectory = cacheDir)
// use flatmap because relativize returns an option, which can be flattened
val names = unzippedFiles.flatMap(file => IO.relativize(base = cacheDir, file))
println(s"Unzipped the following files in `$cacheDir`")
names.foreach(println)
case None => sys.error("Could not find jar")
}
}

View File

@ -1,18 +0,0 @@
name := "play-html-compressor"
scalaVersion := "2.11.1"
val pom = <scm>
<url>git@github.com:mohiva/play-html-compressor.git</url>
<connection>scm:git:git@github.com:mohiva/play-html-compressor.git</connection>
</scm>
<developers>
<developer>
<id>akkie</id>
<name>Christian Kaps</name>
<url>http://mohiva.com</url>
</developer>
</developers>
publishMavenStyle := true

View File

@ -1,141 +0,0 @@
import sbt._
import AssemblyKeys._
import aether.Aether._
name := "conjecture"
version := "0.1.2-SNAPSHOT"
organization := "com.etsy"
scalaVersion := "2.9.3"
sbtVersion := "0.12.1"
scalacOptions ++= Seq("-unchecked", "-deprecation")
compileOrder := CompileOrder.JavaThenScala
javaHome := Some(file("/usr/java/latest"))
publishArtifact in packageDoc := false
resolvers ++= {
Seq(
"Concurrent Maven Repo" at "http://conjars.org/repo",
"cloudera" at "https://repository.cloudera.com/artifactory/cloudera-repos/"
)
}
libraryDependencies += "cascading" % "cascading-core" % "2.0.0"
libraryDependencies += "cascading" % "cascading-local" % "2.0.0" exclude("com.google.guava", "guava")
libraryDependencies += "cascading" % "cascading-hadoop" % "2.0.0"
libraryDependencies += "cascading.kryo" % "cascading.kryo" % "0.4.6"
libraryDependencies += "com.google.code.gson" % "gson" % "2.2.2"
libraryDependencies += "com.twitter" % "maple" % "0.2.4"
libraryDependencies += "com.twitter" % "algebird-core_2.9.2" % "0.1.12"
libraryDependencies += "com.twitter" % "scalding-core_2.9.2" % "0.8.5"
libraryDependencies += "commons-lang" % "commons-lang" % "2.4"
libraryDependencies += "com.joestelmach" % "natty" % "0.7"
libraryDependencies += "io.backchat.jerkson" % "jerkson_2.9.2" % "0.7.0"
libraryDependencies += "com.google.guava" % "guava" % "13.0.1"
libraryDependencies += "org.apache.commons" % "commons-math3" % "3.2"
libraryDependencies += "org.apache.hadoop" % "hadoop-common" % "2.0.0-cdh4.1.1" exclude("commons-daemon", "commons-daemon")
libraryDependencies += "org.apache.hadoop" % "hadoop-hdfs" % "2.0.0-cdh4.1.1" exclude("commons-daemon", "commons-daemon")
libraryDependencies += "org.apache.hadoop" % "hadoop-tools" % "2.0.0-mr1-cdh4.1.1" exclude("commons-daemon", "commons-daemon")
libraryDependencies += "net.sf.trove4j" % "trove4j" % "3.0.3"
libraryDependencies += "com.esotericsoftware.kryo" % "kryo" % "2.21"
libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test"
parallelExecution in Test := false
publishArtifact in Test := false
seq(assemblySettings: _*)
publishTo <<= version { v : String =>
val nexus = "https://oss.sonatype.org/"
if (v.trim.endsWith("SNAPSHOT")) {
Some("snapshots" at nexus + "content/repositories/snapshots")
} else {
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
}
publishMavenStyle := true
pomIncludeRepository := { x => false }
pomExtra := (
<url>https://github.com/etsy/Conjecture</url>
<licenses>
<license>
<name>MIT License</name>
<url>http://opensource.org/licenses/MIT</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>git@github.com:etsy/Conjecture.git</url>
<connection>scm:git:git@github.com:etsy/Conjecture.git</connection>
</scm>
<developers>
<developer>
<id>jattenberg</id>
<name>Josh Attenberg</name>
<url>github.com/jattenberg</url>
</developer>
<developer>
<id>rjhall</id>
<name>Rob Hall</name>
<url>github.com/rjhall</url>
</developer>
</developers>
)
credentials += Credentials(Path.userHome / ".sbt" / ".credentials")
seq(aetherPublishSettings: _*)
pomIncludeRepository := { _ => false }
// Uncomment if you don't want to run all the tests before building assembly
// test in assembly := {}
// Janino includes a broken signature, and is not needed:
excludedJars in assembly <<= (fullClasspath in assembly) map { cp =>
val excludes = Set("jsp-api-2.1-6.1.14.jar", "jsp-2.1-6.1.14.jar",
"jasper-compiler-5.5.12.jar", "janino-2.5.16.jar")
cp filter { jar => excludes(jar.data.getName)}
}
// Some of these files have duplicates, let's ignore:
mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
{
case s if s.endsWith(".class") => MergeStrategy.last
case s if s.endsWith("project.clj") => MergeStrategy.concat
case s if s.endsWith(".html") => MergeStrategy.last
case s if s.contains("servlet") => MergeStrategy.last
case x => old(x)
}
}

View File

@ -1,52 +0,0 @@
name := "Programming Scala, Second Edition: Code examples"
version := "2.0"
organization := "org.programming-scala"
scalaVersion := "2.11.2"
// Build against several versions of Scala
crossScalaVersions := Seq("2.11.2", "2.10.4")
// Scala 2.11 split the standard library into smaller components.
// The XML and parser combinator support are now separate jars.
// I use the if condition to conditionally add these extra dependencies.
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.3.3",
"org.scalaz" %% "scalaz-core" % "7.0.6",
"org.scalacheck" %% "scalacheck" % "1.11.4" % "test",
"org.scalatest" %% "scalatest" % "2.2.0" % "test",
"org.specs2" %% "specs2" % "2.3.12" % "test",
// JUnit is used for some Java interop. examples. A driver for JUnit:
"junit" % "junit-dep" % "4.10" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test"
) ++ (
if (scalaVersion.value startsWith "2.11")
Seq(
// Could use this to get everything:
// "org.scala-lang.modules" %% "scala-library-all" % "2.11.1")
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.1",
"org.scala-lang.modules" %% "scala-xml" % "1.0.2")
else Seq.empty)
val commonOptions = Seq(
"-encoding", "UTF-8", "-optimise",
"-deprecation", "-unchecked", "-feature", "-Xlint")
// "-explaintypes" - Use when you need more detailed messages for type errors.
// "-Yinline-warnings" - Warns if constructs have the @inline annotation, but
// inlining isn't possible. Can be more annoying than useful most of the time,
// but consider using it for performance critical code.
// Options passed to the Scala and Java compilers:
scalacOptions <<= scalaVersion map { version: String =>
if (version.startsWith("2.10")) commonOptions
else commonOptions ++ Seq("-Ywarn-infer-any") // Warn if "Any" is inferred
}
javacOptions ++= Seq(
"-Xlint:unchecked", "-Xlint:deprecation") // Java 8: "-Xdiags:verbose")
// Enable improved incremental compilation feature in 2.11.X.
// see http://www.scala-lang.org/news/2.11.1
incOptions := incOptions.value.withNameHashing(true)

View File

@ -1,93 +0,0 @@
//
// Copyright (c) 2013-2014 Alexey Aksenov ezh@ezh.msk.ru
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
ScriptedPlugin.scriptedSettings
name := "sbt-osgi-manager"
description := "OSGi development bridge based on Bndtools and Tycho."
licenses := Seq("The Apache Software License, Version 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
organization := "org.digimead"
organizationHomepage := Some(url("http://digimead.org"))
homepage := Some(url("https://github.com/digimead/sbt-osgi-manager"))
version <<= (baseDirectory) { (b) => scala.io.Source.fromFile(b / "version").mkString.trim }
// There is no "-Xfatal-warnings" because we have cross compilation against different Scala versions
scalacOptions ++= Seq("-encoding", "UTF-8", "-unchecked", "-deprecation", "-Xcheckinit")
// http://vanillajava.blogspot.ru/2012/02/using-java-7-to-target-much-older-jvms.html
javacOptions ++= Seq("-Xlint:unchecked", "-Xlint:deprecation", "-source", "1.6", "-target", "1.6")
javacOptions in doc := Seq("-source", "1.6")
if (sys.env.contains("XBOOTCLASSPATH")) Seq(javacOptions += "-Xbootclasspath:" + sys.env("XBOOTCLASSPATH")) else Seq()
sbtPlugin := true
resourceGenerators in Compile <+=
(resourceManaged in Compile, name, version) map { (dir, n, v) =>
val file = dir / "version-%s.properties".format(n)
val contents = "name=%s\nversion=%s\nbuild=%s\n".format(n, v, ((System.currentTimeMillis / 1000).toInt).toString)
IO.write(file, contents)
Seq(file)
}
libraryDependencies ++= {
val mavenVersion = "3.0" // based on Tycho, MUST be the same
val mavenWagonVersion = "2.4"
val tychoVersion = "0.18.0"
val aetherAPIVersion = "1.7" // based on Tycho, MUST be the same
Seq(
"biz.aQute.bnd" % "bndlib" % "2.1.0",
"org.apache.felix" % "org.apache.felix.resolver" % "1.0.0",
"org.apache.maven" % "maven-aether-provider" % mavenVersion,
"org.apache.maven" % "maven-artifact" % mavenVersion,
"org.apache.maven" % "maven-compat" % mavenVersion,
"org.apache.maven" % "maven-core" % mavenVersion,
"org.apache.maven" % "maven-plugin-api" % mavenVersion,
"org.apache.maven" % "maven-embedder" % mavenVersion, // provide org.apache.maven.cli.MavenCli
"org.apache.maven.wagon" % "wagon-http" % mavenWagonVersion, // HTTP connector for remore repositories
"org.apache.maven.wagon" % "wagon-file" % mavenWagonVersion, // File connector for local repositories
"org.eclipse.tycho" % "tycho-core" % tychoVersion,
"org.eclipse.tycho" % "tycho-p2-facade" % tychoVersion,
"org.osgi" % "org.osgi.core" % "5.0.0",
"org.osgi" % "org.osgi.enterprise" % "5.0.0",
"org.sonatype.aether" % "aether-connector-wagon" % aetherAPIVersion
)
}
scriptedBufferLog := false
resolvers ++= Seq(
"sbt-osgi-mananger-digimead-maven" at "http://storage.googleapis.com/maven.repository.digimead.org/",
Resolver.url("sbt-osgi-manager-typesafe-ivy-releases", url("http://repo.typesafe.com/typesafe/ivy-releases/"))(Resolver.defaultIvyPatterns),
Resolver.url("sbt-osgi-manager-typesafe-ivy-snapshots", url("http://repo.typesafe.com/typesafe/ivy-snapshots/"))(Resolver.defaultIvyPatterns),
Resolver.url("sbt-osgi-manager-typesafe-repository", url("http://repo.typesafe.com/typesafe/ivy-releases/"))(Resolver.defaultIvyPatterns),
Resolver.url("sbt-osgi-manager-typesafe-shapshots", url("http://repo.typesafe.com/typesafe/ivy-snapshots/"))(Resolver.defaultIvyPatterns))
sourceGenerators in Compile <+= (sbtVersion, sourceDirectory in Compile, sourceManaged in Compile) map { (v, sourceDirectory, sourceManaged) =>
val interface = v.split("""\.""").take(2).mkString(".")
val source = sourceDirectory / ".." / "patch" / interface
val generated = (PathFinder(source) ***) x Path.rebase(source, sourceManaged)
IO.copy(generated, true, false)
generated.map(_._2).filter(_.getName endsWith ".scala")
}
//logLevel := Level.Debug

View File

@ -1,2 +0,0 @@
//import sbt._
// val a = 3

View File

@ -1,39 +0,0 @@
import AssemblyKeys._
name := "s3_website"
version := "0.0.1"
scalaVersion := "2.11.2"
scalacOptions += "-feature"
scalacOptions += "-language:implicitConversions"
scalacOptions += "-language:postfixOps"
scalacOptions += "-target:jvm-1.6"
libraryDependencies += "org.yaml" % "snakeyaml" % "1.13"
libraryDependencies += "org.jruby" % "jruby" % "1.7.11"
libraryDependencies += "com.amazonaws" % "aws-java-sdk" % "1.7.7"
libraryDependencies += "log4j" % "log4j" % "1.2.17"
libraryDependencies += "commons-codec" % "commons-codec" % "1.9"
libraryDependencies += "commons-io" % "commons-io" % "2.4"
libraryDependencies += "org.apache.tika" % "tika-core" % "1.4"
libraryDependencies += "com.lexicalscope.jewelcli" % "jewelcli" % "0.8.9"
libraryDependencies += "org.specs2" %% "specs2" % "2.3.11" % "test"
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
jarName in assembly := "s3_website.jar"
test in assembly := {}

View File

@ -1,18 +0,0 @@
/* */
/** Project */
name := "signal-collect-yarn"
/* */
/*
AAA
*/
val a = 3
// OK
libraryDependencies ++= Seq("org.scala-lang" % "scala-compiler" % "2.10.4") map {
(dependency) =>{
dependency
} /* OK */
}

View File

@ -1,5 +0,0 @@
val x = bar
{
val a,b = project
}

View File

@ -1,71 +0,0 @@
name := "scala-stm"
organization := "org.scala-stm"
version := "0.8-SNAPSHOT"
scalaVersion := "2.11.2"
crossScalaVersions := Seq("2.11.2", "2.10.4", "2.9.3")
libraryDependencies += ("org.scalatest" %% "scalatest" % "[1.5,)" % "test")
libraryDependencies += ("junit" % "junit" % "4.5" % "test")
// skip exhaustive tests
testOptions += Tests.Argument("-l", "slow")
// test of TxnExecutor.transformDefault must be run by itself
parallelExecution in Test := false
////////////////////
// publishing
pomExtra :=
<url>http://nbronson.github.com/scala-stm/</url>
<licenses>
<license>
<name>BSD</name>
<url>https://github.com/nbronson/scala-stm/blob/master/LICENSE.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<connection>scm:git:git@github.com:nbronson/scala-stm.git</connection>
<url>git@github.com:nbronson/scala-stm.git</url>
</scm>
<developers>
<developer>
<id>nbronson</id>
<name>Nathan Bronson</name>
<email>ngbronson@gmail.com</email>
</developer>
</developers>
publishMavenStyle := true
publishTo <<= (version) { v: String =>
val base = "https://oss.sonatype.org/"
if (v.trim.endsWith("SNAPSHOT"))
Some("snapshots" at base + "content/repositories/snapshots/")
else
Some("releases" at base + "service/local/staging/deploy/maven2/")
}
// exclude scalatest from the Maven POM
pomPostProcess := { xi: scala.xml.Node =>
import scala.xml._
val badDeps = (xi \\ "dependency") filter {
x => (x \ "artifactId").text != "scala-library"
} toSet
def filt(root: Node): Node = root match {
case x: Elem => {
val ch = x.child filter { !badDeps(_) } map { filt(_) }
Elem(x.prefix, x.label, x.attributes, x.scope, ch: _*)
}
case x => x
}
filt(xi)
}
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")

View File

@ -1,7 +0,0 @@
import sbt._, Keys._,java.util._
import a._
import c._
import d._
import g._,h._
scalaVersion := "2.11.4"

View File

@ -1,51 +0,0 @@
parallelExecution in Global := false
val commonSettings = Seq(
organization := "com.github.germanosin",
version := "1.0",
javacOptions in Compile ++= Seq("-source", "1.6", "-target", "1.6"),
scalaVersion := "2.11.1"
)
lazy val foldermessages = project.settings(commonSettings: _*)
.settings(
name := "play-foldermessages",
crossScalaVersions := Seq("2.10.4", "2.11.1"),
libraryDependencies += "com.typesafe.play" %% "play" % "2.3.2",
resolvers += "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases/",
publishMavenStyle := true,
publishTo := {
val nexus = "https://oss.sonatype.org"
if (isSnapshot.value) Some("snapshots" at s"$nexus/content/repositories/snapshots")
else Some("releases" at s"$nexus/service/local/staging/deploy/maven2")
},
pomExtra := (
<url>http://github.com/germanosin/play-foldermessages</url>
<licenses>
<license>
<name>MIT License</name>
<url>http://opensource.org/licenses/mit-license.php</url>
</license>
</licenses>
<scm>
<url>git@github.com:germanosin/play-foldermessages.git</url>
<connection>scm:git:git@github.com:germanosin/play-foldermessages.git</connection>
</scm>
<developers>
<developer>
<id>germanosin</id>
<name>German Osin</name>
</developer>
</developers>
),
useGpg := true
)
lazy val sampleApp = Project("sample-app", file("sample-app"))
.settings(commonSettings: _*)
.enablePlugins(PlayScala)
.dependsOn(foldermessages)
lazy val playFolderMessages = project.in(file("."))
.settings(commonSettings: _*)
.aggregate(foldermessages,sampleApp)

View File

@ -1,74 +0,0 @@
import AssemblyKeys._
assemblySettings
/** Project */
name := "signal-collect-yarn"
version := "1.0-SNAPSHOT"
organization := "com.signalcollect"
scalaVersion := "2.11.1"
val hadoopVersion = "2.3.0"
net.virtualvoid.sbt.graph.Plugin.graphSettings
scalacOptions ++= Seq("-optimize", "-Yinline-warnings", "-feature", "-deprecation", "-Xelide-below", "INFO" )
EclipseKeys.createSrc := EclipseCreateSrc.Default + EclipseCreateSrc.Resource
EclipseKeys.withSource := true
parallelExecution in Test := false
test in assembly := {}
mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
{
case PathList("org", "apache", "hadoop", xs @ _*) => MergeStrategy.last
case PathList("org", "apache", "commons", "collections", xs @ _*) => MergeStrategy.last
case PathList("org", "objectweb", "asm", xs @ _*) => MergeStrategy.last
case PathList("com", "thoughtworks", xs @ _*) => MergeStrategy.last
case PathList("META-INF", "maven", xs @ _*) => MergeStrategy.last
case PathList("log4j.properties") => MergeStrategy.last
case x => old(x)
}
}
excludedJars in assembly <<= (fullClasspath in assembly) map { cp =>
cp filter { entry =>
(entry.data.getName == "asm-3.2.jar" ||
entry.data.getName == "asm-3.1.jar"
)}
}
/** Dependencies */
libraryDependencies ++= Seq(
"org.scala-lang.modules" %% "scala-async" % "0.9.1",
"org.scala-lang" % "scala-library" % "2.11.1" % "compile",
("org.apache.hadoop" % "hadoop-common" % hadoopVersion % "compile").
exclude("commons-beanutils", "commons-beanutils-core"),
"org.apache.hadoop" % "hadoop-yarn-common" % hadoopVersion % "compile",
("org.apache.hadoop" % "hadoop-yarn-client" % hadoopVersion % "compile").
exclude("hadoop-yarn-api", "org.apache.hadoop"),
"org.apache.hadoop" % "hadoop-yarn-server-resourcemanager" % hadoopVersion % "compile",
"org.apache.hadoop" % "hadoop-yarn-server-nodemanager" % hadoopVersion % "compile",
"org.apache.hadoop" % "minicluster" % "2.2.0" ,
"org.apache.hadoop" % "hadoop-hdfs" % hadoopVersion,
"com.github.romix.akka" %% "akka-kryo-serialization-custom" % "0.3.5" % "compile",
"com.amazonaws" % "aws-java-sdk" % "1.7.12" % "compile",
"com.jcraft" % "jsch" % "0.1.51" % "compile",
"org.apache.commons" % "commons-compress" % "1.5" % "compile",
"log4j" % "log4j" % "1.2.17" % "compile",
"com.typesafe.scala-logging" %% "scala-logging-slf4j" % "2.1.2",
"com.typesafe.akka" % "akka-slf4j_2.11" % "2.3.4",
"junit" % "junit" % "4.8.2" % "test",
"org.specs2" %% "specs2" % "2.3.11" % "test",
"org.scalacheck" %% "scalacheck" % "1.11.3" % "test",
"org.scalatest" %% "scalatest" % "2.1.3" % "test",
"org.easymock" % "easymock" % "3.2" % "test",
"com.typesafe.akka" %% "akka-remote" % "2.3.4" force()
)
resolvers += "Ifi Public" at "https://maven.ifi.uzh.ch/maven2/content/groups/public/"

View File

@ -1,41 +0,0 @@
sbtPlugin := true
name := "sbt-docker"
organization := "se.marcuslonnberg"
organizationHomepage := Some(url("https://github.com/marcuslonnberg"))
version := "0.6.0-SNAPSHOT"
libraryDependencies += "org.scalatest" %% "scalatest" % "2.1.0" % "test"
licenses := Seq("MIT License" -> url("https://github.com/marcuslonnberg/sbt-docker/blob/master/LICENSE"))
homepage := Some(url("https://github.com/marcuslonnberg/sbt-docker"))
scmInfo := Some(ScmInfo(url("https://github.com/marcuslonnberg/sbt-docker"), "scm:git:git://github.com:marcuslonnberg/sbt-docker.git"))
scalacOptions := Seq("-deprecation", "-unchecked", "-feature")
publishMavenStyle := true
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
pomIncludeRepository := { _ => false}
pomExtra := (
<developers>
<developer>
<id>marcuslonnberg</id>
<name>Marcus Lönnberg</name>
<url>http://marcuslonnberg.se</url>
</developer>
</developers>
)

View File

@ -1,67 +0,0 @@
organization := "com.sksamuel.akka"
name := "akka-patterns"
version := "0.11.0"
scalaVersion := "2.11.2"
crossScalaVersions := Seq("2.11.2", "2.10.4")
scalacOptions := Seq("-unchecked", "-deprecation", "-encoding", "utf8")
javacOptions ++= Seq("-source", "1.6", "-target", "1.6")
publishTo <<= version {
(v: String) =>
val nexus = "https://oss.sonatype.org/"
if (v.trim.endsWith("SNAPSHOT"))
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
publishMavenStyle := true
publishArtifact in Test := false
parallelExecution in Test := false
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")
libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.3.3"
libraryDependencies += "com.typesafe.akka" %% "akka-testkit" % "2.3.3"
libraryDependencies += "org.slf4j" % "slf4j-api" % "1.7.7"
libraryDependencies += "org.slf4j" % "log4j-over-slf4j" % "1.7.7" % "test"
libraryDependencies += "log4j" % "log4j" % "1.2.17" % "test"
libraryDependencies += "commons-io" % "commons-io" % "2.4"
libraryDependencies += "org.mockito" % "mockito-all" % "1.9.5" % "test"
libraryDependencies += "org.scalatest" %% "scalatest" % "2.2.0" % "test"
pomExtra := (
<url>https://github.com/sksamuel/akka-patterns</url>
<licenses>
<license>
<name>Apache 2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>git@github.com:sksamuel/akka-patterns.git</url>
<connection>scm:git@github.com:sksamuel/akka-patterns.git</connection>
</scm>
<developers>
<developer>
<id>sksamuel</id>
<name>sksamuel</name>
<url>http://github.com/akka-patterns</url>
</developer>
</developers>)

View File

@ -1,160 +0,0 @@
name <<= submitProjectName(pname => "progfun-"+ pname)
version := "1.0.0"
scalaVersion := "2.10.2"
scalacOptions ++= Seq("-deprecation", "-feature")
libraryDependencies += "org.scalatest" %% "scalatest" % "1.9.1" % "test"
libraryDependencies += "junit" % "junit" % "4.10" % "test"
libraryDependencies += "org.scala-lang" % "scala-reflect" % "2.10.2"
// This setting defines the project to which a solution is submitted. When creating a
// handout, the 'createHandout' task will make sure that its value is correct.
submitProjectName := "suggestions"
libraryDependencies <++= (currentProject) { c =>
if (c.isEmpty || c == "quickcheck") Seq(
"org.scalacheck" %% "scalacheck" % "1.10.1"
)
else Seq.empty
}
libraryDependencies <++= (currentProject) { c =>
if (c.isEmpty || c == "nodescala" || c == "suggestions") Seq(
"com.netflix.rxjava" % "rxjava-scala" % "0.15.0",
"org.json4s" % "json4s-native_2.10" % "3.2.5",
"org.scala-lang" % "scala-swing" % "2.10.3",
"net.databinder.dispatch" % "dispatch-core_2.10" % "0.11.0",
"org.scala-lang" % "scala-reflect" % "2.10.3",
"org.slf4j" % "slf4j-api" % "1.7.5",
"org.slf4j" % "slf4j-simple" % "1.7.5",
"com.squareup.retrofit" % "retrofit" % "1.0.0",
"org.scala-lang.modules" %% "scala-async" % "0.9.0-M2"
)
else Seq.empty
}
libraryDependencies <++= (currentProject) { c =>
if (c.isEmpty || c == "actorbintree") Seq(
"com.typesafe.akka" %% "akka-actor" % "2.2.3",
"com.typesafe.akka" %% "akka-testkit" % "2.2.3"
)
else Seq.empty
}
// See documentation in ProgFunBuild.scala
projectDetailsMap := {
val currentCourseId = "reactive-001"
Map(
"example" -> ProjectDetails(
packageName = "example",
assignmentPartId = "fTzFogNl",
maxScore = 10d,
styleScoreRatio = 0.2,
courseId=currentCourseId),
"recfun" -> ProjectDetails(
packageName = "recfun",
assignmentPartId = "3Rarn9Ki",
maxScore = 10d,
styleScoreRatio = 0.2,
courseId=currentCourseId),
"funsets" -> ProjectDetails(
packageName = "funsets",
assignmentPartId = "fBXOL6Rd",
maxScore = 10d,
styleScoreRatio = 0.2,
courseId=currentCourseId),
"objsets" -> ProjectDetails(
packageName = "objsets",
assignmentPartId = "05dMMEz7",
maxScore = 10d,
styleScoreRatio = 0.2,
courseId=currentCourseId),
"patmat" -> ProjectDetails(
packageName = "patmat",
assignmentPartId = "4gPmpcif",
maxScore = 10d,
styleScoreRatio = 0.2,
courseId=currentCourseId),
"forcomp" -> ProjectDetails(
packageName = "forcomp",
assignmentPartId = "fG2oZGIO",
maxScore = 10d,
styleScoreRatio = 0.2,
courseId=currentCourseId),
"streams" -> ProjectDetails(
packageName = "streams",
assignmentPartId = "DWKgCFCi",
maxScore = 10d,
styleScoreRatio = 0.2,
courseId=currentCourseId),
"quickcheck" -> ProjectDetails(
packageName = "quickcheck",
assignmentPartId = "02Vi5q7m",
maxScore = 10d,
styleScoreRatio = 0.0,
courseId=currentCourseId),
"simulations" -> ProjectDetails(
packageName = "simulations",
assignmentPartId = "pA3TAeu1",
maxScore = 10d,
styleScoreRatio = 0.0,
courseId=currentCourseId),
"nodescala" -> ProjectDetails(
packageName = "nodescala",
assignmentPartId = "RvoTAbRy",
maxScore = 10d,
styleScoreRatio = 0.0,
courseId=currentCourseId),
"suggestions" -> ProjectDetails(
packageName = "suggestions",
assignmentPartId = "rLLdQLGN",
maxScore = 10d,
styleScoreRatio = 0.0,
courseId=currentCourseId),
"actorbintree" -> ProjectDetails(
packageName = "actorbintree",
assignmentPartId = "VxIlIKoW",
maxScore = 10d,
styleScoreRatio = 0.0,
courseId=currentCourseId)
)}
// Files that we hand out to the students
handoutFiles <<= (baseDirectory, projectDetailsMap, commonSourcePackages) map { (basedir, detailsMap, commonSrcs) =>
(projectName: String) => {
val details = detailsMap.getOrElse(projectName, sys.error("Unknown project name: "+ projectName))
val commonFiles = (PathFinder.empty /: commonSrcs)((files, pkg) =>
files +++ (basedir / "src" / "main" / "scala" / pkg ** "*.scala")
)
(basedir / "src" / "main" / "scala" / details.packageName ** "*.scala") +++
commonFiles +++
(basedir / "src" / "main" / "resources" / details.packageName ** "*") +++
(basedir / "src" / "test" / "scala" / details.packageName ** "*.scala") +++
(basedir / "build.sbt") +++
(basedir / "project" / "build.properties") +++
(basedir / "project" ** ("*.scala" || "*.sbt")) +++
(basedir / "project" / "scalastyle_config.xml") +++
(basedir / "project" / "scalastyle_config_reactive.xml") +++
(basedir / "lib_managed" ** "*.jar") +++
(basedir * (".classpath" || ".project")) +++
(basedir / ".settings" / "org.scala-ide.sdt.core.prefs")
}
}
// This setting allows to restrict the source files that are compiled and tested
// to one specific project. It should be either the empty string, in which case all
// projects are included, or one of the project names from the projectDetailsMap.
currentProject := ""
// Packages in src/main/scala that are used in every project. Included in every
// handout, submission.
commonSourcePackages += "common"
// Packages in src/test/scala that are used for grading projects. Always included
// compiling tests, grading a project.
gradingTestPackages += "grading"

View File

@ -1,55 +0,0 @@
name := "apidoc"
scalaVersion in ThisBuild := "2.11.1"
lazy val core = project
.in(file("core"))
.settings(commonSettings: _*)
.settings(
// play-json needs this to resolve correctly when not using Gilt's internal mirrors
resolvers += "Typesafe Maven Repository" at "http://repo.typesafe.com/typesafe/maven-releases/",
version := "1.0-SNAPSHOT",
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % "2.3.0"
)
)
lazy val api = project
.in(file("api"))
.dependsOn(core)
.aggregate(core)
.enablePlugins(PlayScala)
.settings(commonSettings: _*)
.settings(
version := "1.0-SNAPSHOT",
libraryDependencies ++= Seq(
jdbc,
anorm,
"org.postgresql" % "postgresql" % "9.3-1101-jdbc4",
"org.mindrot" % "jbcrypt" % "0.3m"
)
)
lazy val www = project
.in(file("www"))
.dependsOn(core)
.aggregate(core)
.enablePlugins(PlayScala)
.settings(commonSettings: _*)
.settings(
version := "1.0-SNAPSHOT",
libraryDependencies ++= Seq(
ws
)
)
lazy val commonSettings: Seq[Setting[_]] = Seq(
name <<= name("apidoc-" + _),
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "2.2.0" % "test"
),
scalacOptions += "-feature"
) ++ instrumentSettings ++ Seq(ScoverageKeys.highlighting := true)

View File

@ -1,40 +0,0 @@
organization := "com.typesafe"
name := "jse"
version := "1.0.1-SNAPSHOT"
scalaVersion := "2.10.4"
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.3.2",
"com.typesafe.akka" %% "akka-contrib" % "2.3.2",
"io.apigee.trireme" % "trireme-core" % "0.8.0",
"io.apigee.trireme" % "trireme-node10src" % "0.8.0",
"io.spray" %% "spray-json" % "1.2.6",
"org.slf4j" % "slf4j-simple" % "1.7.7",
"org.specs2" %% "specs2" % "2.3.11" % "test",
"junit" % "junit" % "4.11" % "test",
"com.typesafe.akka" %% "akka-testkit" % "2.3.2" % "test"
)
resolvers ++= Seq(
Resolver.sonatypeRepo("snapshots"),
"Typesafe Releases Repository" at "http://repo.typesafe.com/typesafe/releases/"
)
publishTo := {
val typesafe = "http://private-repo.typesafe.com/typesafe/"
val (name, url) = if (isSnapshot.value)
("sbt-plugin-snapshots", typesafe + "maven-snapshots")
else
("sbt-plugin-releases", typesafe + "maven-releases")
Some(Resolver.url(name, new URL(url)))
}
lazy val root = project in file(".")
lazy val `js-engine-tester` = project.dependsOn(root)
// Somehow required to get a js engine in tests (https://github.com/sbt/sbt/issues/1214)
fork in Test := true

View File

@ -83,11 +83,10 @@ object FakeState {
)
val pluginData = PluginData(Nil, Nil, None, None, Nil)
val detectedModules: DetectedModules[OldPlugin] = new DetectedModules(Nil)
val builds: DetectedModules[BuildDef] = new DetectedModules[BuildDef](Nil)
val detectedAutoPlugins: Seq[DetectedAutoPlugin] = plugins.map(p => DetectedAutoPlugin(p.label, p, hasAutoImport = false))
val detectedPlugins = new DetectedPlugins(detectedModules, detectedAutoPlugins, builds)
val detectedPlugins = new DetectedPlugins(detectedAutoPlugins, builds)
val loadedPlugins = new LoadedPlugins(base, pluginData, ClassLoader.getSystemClassLoader, detectedPlugins)
val buildUnit = new BuildUnit(base.toURI, base, loadedDefinitions, loadedPlugins)

View File

@ -1,19 +0,0 @@
package sbt
package internal
package parser
import java.io.File
import sbt.internal.util.LineRange
import scala.annotation.tailrec
@deprecated("This class is be removed. Only for test backward compatibility", "1.0")
object EvaluateConfigurationsOriginal {
def splitExpressions(file: File, lines: Seq[String]): (Seq[(String, Int)], Seq[(String, LineRange)]) =
{
EvaluateConfigurations.splitExpressions(lines)
}
}

View File

@ -13,55 +13,6 @@ trait SplitExpression {
trait SplitExpressionsBehavior extends SplitExpression {
this: SpecificationLike =>
def oldExpressionsSplitter(implicit splitter: SplitExpressions.SplitExpression): Unit = {
"parse a simple setting" in {
val (imports, settingsAndDefs) = split("""version := "1.0"""")
settingsAndDefs.head._1 === """version := "1.0""""
imports.isEmpty should beTrue
settingsAndDefs.isEmpty should beFalse
}
"parse a config containing a single import" in {
val (imports, settingsAndDefs) = split("""import foo.Bar""")
imports.isEmpty should beFalse
settingsAndDefs.isEmpty should beTrue
}
"parse a config containing two imports and a setting" in {
val (imports, settingsAndDefs) = split(
"""import foo.Bar
import foo.Bar
version := "1.0"
""".stripMargin)
imports.size === 2
settingsAndDefs.size === 1
}
"parse a config containgn a def" in {
val (imports, settingsAndDefs) = split("""def foo(x: Int) = {
x + 1
}""")
imports.isEmpty should beTrue
settingsAndDefs.isEmpty should beFalse
}
"parse a config containgn a val" in {
val (imports, settingsAndDefs) = split("""val answer = 42""")
imports.isEmpty should beTrue
settingsAndDefs.isEmpty should beFalse
}
"parse a config containgn a lazy val" in {
val (imports, settingsAndDefs) = split("""lazy val root = (project in file(".")).enablePlugins­(PlayScala)""")
imports.isEmpty should beTrue
settingsAndDefs.isEmpty should beFalse
}
}
def newExpressionsSplitter(implicit splitter: SplitExpressions.SplitExpression): Unit = {
"parse a two settings without intervening blank line" in {

View File

@ -1,154 +0,0 @@
package sbt
package internal
package parser
import java.io.File
import org.specs2.mutable.Specification
import scala.annotation.tailrec
import scala.io.Source
import scala.tools.reflect.ToolBoxError
import sbt.internal.util.LineRange
class SplitExpressionsFilesTest extends AbstractSplitExpressionsFilesTest("/old-format/")
//class SplitExpressionsFilesFailedTest extends AbstractSplitExpressionsFilesTest("/fail-format/")
abstract class AbstractSplitExpressionsFilesTest(pathName: String) extends Specification {
case class SplitterComparison(oldSplitterResult: scala.util.Try[(Seq[(String, Int)], Seq[LineRange])], newSplitterResult: scala.util.Try[(Seq[(String, Int)], Seq[LineRange])])
val oldSplitter: SplitExpressions.SplitExpression = EvaluateConfigurationsOriginal.splitExpressions
val newSplitter: SplitExpressions.SplitExpression = EvaluateConfigurations.splitExpressions
final val REVERTED_LINES = true
final val START_COMMENT = "/*"
final val END_COMMENT = START_COMMENT.reverse
s"$getClass " should {
"split whole sbt files" in {
val rootPath = getClass.getClassLoader.getResource("").getPath + pathName
println(s"Reading files from: $rootPath")
val allFiles = new File(rootPath).listFiles.toList
val results = for {
path <- allFiles
lines = Source.fromFile(path).getLines().toList
comparison = SplitterComparison(splitLines(path, oldSplitter, lines), splitLines(path, newSplitter, lines))
} yield path -> comparison
printResults(results)
val validResults = results.collect {
case (path, SplitterComparison(scala.util.Success(oldRes), scala.util.Success(newRes))) if oldRes == newRes => path
}
validResults.length must be_==(results.length)
}
}
def removeCommentFromStatement(statement: String, lineRange: LineRange): Option[LineRange] = {
val lines = statement.lines.toList
val optionStatements = removeSlashAsterisk(lines, lineRange, !REVERTED_LINES) match {
case Some((st, lr)) =>
removeDoubleSlash(st, lr)
case _ => None
}
optionStatements.map(t => t._2)
}
@tailrec
private def removeSlashAsterisk(statements: Seq[String], lineRange: LineRange, reverted: Boolean): Option[(Seq[String], LineRange)] =
statements match {
case statement +: _ =>
val openSlashAsteriskIndex = statement.indexOf(START_COMMENT, 0)
if (openSlashAsteriskIndex == -1 || statement.substring(0, openSlashAsteriskIndex).trim.nonEmpty) {
Some((statements, lineRange))
} else {
val closeSlashAsteriskLine = statements.indexWhere(s => s.contains(END_COMMENT))
if (closeSlashAsteriskLine == -1) {
Some((statements, lineRange))
} else {
val newLineRange = if (reverted) {
lineRange.copy(end = lineRange.end - closeSlashAsteriskLine - 1)
} else {
lineRange.copy(start = lineRange.start + closeSlashAsteriskLine + 1)
}
removeSlashAsterisk(statements.drop(closeSlashAsteriskLine + 1), newLineRange, reverted)
}
}
case _ =>
None
}
/**
* Remove // and /* */
* @param statements - lines
* @param lineRange - LineRange
* @return (lines,lineRange) without comments
*/
def removeDoubleSlash(statements: Seq[String], lineRange: LineRange): Option[(Seq[String], LineRange)] = {
@tailrec
def removeDoubleSlashReversed(lines: Seq[String], lineRange: LineRange): Option[(Seq[String], LineRange)] =
lines match {
case statement +: _ =>
val doubleSlashIndex = statement.indexOf("//")
if (doubleSlashIndex == -1 || statement.substring(0, doubleSlashIndex).trim.nonEmpty) {
removeSlashAsterisk(lines, lineRange, REVERTED_LINES) match {
case some @ Some((s, ln)) if ln == lineRange =>
some
case Some((s, ln)) =>
removeDoubleSlashReversed(s, ln)
case _ => None
}
} else {
removeDoubleSlashReversed(lines.tail, lineRange.copy(end = lineRange.end - 1))
}
case _ =>
None
}
removeDoubleSlashReversed(statements.reverse, lineRange).map(t => (t._1.reverse, t._2))
}
def splitLines(file: File, splitter: SplitExpressions.SplitExpression, lines: List[String]): scala.util.Try[(Seq[(String, Int)], Seq[LineRange])] = {
try {
val (imports, settingsAndDefs) = splitter(file, lines)
//TODO: Return actual contents (after making both splitter...
//TODO: ...implementations return CharRanges instead of LineRanges)
val settingsAndDefWithoutComments = settingsAndDefs.flatMap(t => removeCommentFromStatement(t._1, t._2))
scala.util.Success((imports.map(imp => (imp._1.trim, imp._2)), settingsAndDefWithoutComments))
} catch {
case e: ToolBoxError =>
scala.util.Failure(e)
case e: Throwable =>
scala.util.Failure(e)
}
}
def printResults(results: List[(File, SplitterComparison)]) = {
for ((file, comparison) <- results) {
val fileName = file.getName
comparison match {
case SplitterComparison(scala.util.Failure(ex), _) =>
println(s"In file: $fileName, old splitter failed. ${ex.toString}")
case SplitterComparison(_, scala.util.Failure(ex)) =>
println(s"In file: $fileName, new splitter failed. ${ex.toString}")
ex.printStackTrace()
case SplitterComparison(scala.util.Success(resultOld), scala.util.Success(resultNew)) =>
if (resultOld != resultNew) {
println(
s"""In file: $fileName, results differ:
|resultOld:
|$resultOld
|resultNew:
|$resultNew""".stripMargin)
}
}
}
}
}

View File

@ -6,10 +6,6 @@ import org.specs2.mutable.Specification
class SplitExpressionsTest extends Specification with SplitExpressionsBehavior {
"EvaluateConfigurationsOriginal" should oldExpressionsSplitter(EvaluateConfigurationsOriginal.splitExpressions)
"EvaluateConfigurations" should oldExpressionsSplitter(EvaluateConfigurations.splitExpressions)
"EvaluateConfigurations" should newExpressionsSplitter(EvaluateConfigurations.splitExpressions)
}
}

View File

@ -23,7 +23,19 @@ object Util {
scalacOptions ++= Seq("-Xelide-below", "0"),
scalacOptions <++= scalaVersion map CrossVersion.partialVersion map {
case Some((2, 9)) | Some((2, 8)) => Nil // support 2.9 for some subprojects for the Scala Eclipse IDE
case _ => Seq("-feature", "-language:implicitConversions", "-language:postfixOps", "-language:higherKinds", "-language:existentials")
case _ => Seq(
"-encoding", "utf8",
"-deprecation", "-feature", "-unchecked", "-Xlint",
"-language:existentials",
"-language:higherKinds",
"-language:implicitConversions",
"-language:postfixOps",
"-Xfuture",
"-Yinline-warnings",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen"
)
},
scalacOptions <++= scalaVersion map CrossVersion.partialVersion map {
case Some((2, 10)) => Seq("-deprecation", "-Xlint")

View File

@ -9,22 +9,6 @@ import java.util.Locale
import sbt.util.Logger
import scala.sys.process.{ Process, ProcessBuilder }
@deprecated("Use ForkOptions", "0.13.0")
trait ForkJava {
def javaHome: Option[File]
def outputStrategy: Option[OutputStrategy]
def connectInput: Boolean
}
@deprecated("Use ForkOptions", "0.13.0")
trait ForkScala extends ForkJava {
def scalaJars: Iterable[File]
}
@deprecated("Use ForkOptions", "0.13.0")
trait ForkScalaRun extends ForkScala {
def workingDirectory: Option[File]
def runJVMOptions: Seq[String]
}
/**
* Configures forking.
*
@ -36,10 +20,7 @@ trait ForkScalaRun extends ForkScala {
* @param connectInput If true, the standard input of the forked process is connected to the standard input of this process. Otherwise, it is connected to an empty input stream. Connecting input streams can be problematic, especially on versions before Java 7.
* @param envVars The environment variables to provide to the forked process. By default, none are provided.
*/
final case class ForkOptions(javaHome: Option[File] = None, outputStrategy: Option[OutputStrategy] = None, bootJars: Seq[File] = Nil, workingDirectory: Option[File] = None, runJVMOptions: Seq[String] = Nil, connectInput: Boolean = false, envVars: Map[String, String] = Map.empty) extends ForkScalaRun {
@deprecated("Use bootJars.", "0.13.0")
def scalaJars: Iterable[File] = bootJars
}
final case class ForkOptions(javaHome: Option[File] = None, outputStrategy: Option[OutputStrategy] = None, bootJars: Seq[File] = Nil, workingDirectory: Option[File] = None, runJVMOptions: Seq[String] = Nil, connectInput: Boolean = false, envVars: Map[String, String] = Map.empty)
/** Configures where the standard output and error streams from a forked process go.*/
sealed abstract class OutputStrategy
@ -73,7 +54,7 @@ import java.lang.{ ProcessBuilder => JProcessBuilder }
* @param commandName The java-like binary to fork. This is expected to exist in bin/ of the Java home directory.
* @param runnerClass If Some, this will be prepended to the `arguments` passed to the `apply` or `fork` methods.
*/
sealed class Fork(val commandName: String, val runnerClass: Option[String]) {
final class Fork(val commandName: String, val runnerClass: Option[String]) {
/**
* Forks the configured process, waits for it to complete, and returns the exit code.
* The command executed is the `commandName` defined for this Fork instance.
@ -121,8 +102,8 @@ object Fork {
private val ScalaMainClass = "scala.tools.nsc.MainGenericRunner"
private val JavaCommandName = "java"
val java = new ForkJava(JavaCommandName)
val javac = new ForkJava("javac")
val java = new Fork(JavaCommandName, None)
val javac = new Fork("javac", None)
val scala = new Fork(JavaCommandName, Some(ScalaMainClass))
val scalac = new Fork(JavaCommandName, Some(ScalacMainClass))
@ -156,74 +137,4 @@ object Fork {
val home = javaHome.getOrElse(new File(System.getProperty("java.home")))
new File(new File(home, "bin"), name)
}
@deprecated("Use Fork", "0.13.0")
final class ForkJava(commandName: String) extends Fork(commandName, None) {
@deprecated("Use apply(ForkOptions, Seq[String])", "0.13.0")
def apply(javaHome: Option[File], options: Seq[String], log: Logger): Int =
apply(javaHome, options, BufferedOutput(log))
@deprecated("Use apply(ForkOptions, Seq[String])", "0.13.0")
def apply(javaHome: Option[File], options: Seq[String], outputStrategy: OutputStrategy): Int =
apply(javaHome, options, None, outputStrategy)
@deprecated("Use apply(ForkOptions, Seq[String])", "0.13.0")
def apply(javaHome: Option[File], options: Seq[String], workingDirectory: Option[File], log: Logger): Int =
apply(javaHome, options, workingDirectory, BufferedOutput(log))
@deprecated("Use apply(ForkOptions, Seq[String])", "0.13.0")
def apply(javaHome: Option[File], options: Seq[String], workingDirectory: Option[File], outputStrategy: OutputStrategy): Int =
apply(javaHome, options, workingDirectory, Map.empty, outputStrategy)
@deprecated("Use apply(ForkOptions, Seq[String])", "0.13.0")
def apply(javaHome: Option[File], options: Seq[String], workingDirectory: Option[File], env: Map[String, String], outputStrategy: OutputStrategy): Int =
fork(javaHome, options, workingDirectory, env, false, outputStrategy).exitValue
@deprecated("Use apply(ForkOptions, Seq[String])", "0.13.0")
def fork(javaHome: Option[File], options: Seq[String], workingDirectory: Option[File], env: Map[String, String], connectInput: Boolean, outputStrategy: OutputStrategy): Process =
{
val executable = javaCommand(javaHome, commandName).getAbsolutePath
val command = (executable :: options.toList).toArray
val builder = new JProcessBuilder(command: _*)
workingDirectory.foreach(wd => builder.directory(wd))
val environment = builder.environment
for ((key, value) <- env)
environment.put(key, value)
outputStrategy match {
case StdoutOutput => Process(builder).run(connectInput)
case BufferedOutput(logger) => logger.buffer { Process(builder).run(logger, connectInput) }
case LoggedOutput(logger) => Process(builder).run(logger, connectInput)
case CustomOutput(output) => (Process(builder) #> output).run(connectInput)
}
}
}
@deprecated("Use Fork", "0.13.0")
final class ForkScala(mainClassName: String) {
@deprecated("Use apply(ForkOptions, Seq[String])", "0.13.0")
def apply(javaHome: Option[File], jvmOptions: Seq[String], scalaJars: Iterable[File], arguments: Seq[String], log: Logger): Int =
apply(javaHome, jvmOptions, scalaJars, arguments, None, BufferedOutput(log))
@deprecated("Use apply(ForkOptions, Seq[String])", "0.13.0")
def apply(javaHome: Option[File], jvmOptions: Seq[String], scalaJars: Iterable[File], arguments: Seq[String], workingDirectory: Option[File], log: Logger): Int =
apply(javaHome, jvmOptions, scalaJars, arguments, workingDirectory, BufferedOutput(log))
@deprecated("Use apply(ForkOptions, Seq[String])", "0.13.0")
def apply(javaHome: Option[File], jvmOptions: Seq[String], scalaJars: Iterable[File], arguments: Seq[String], workingDirectory: Option[File], outputStrategy: OutputStrategy): Int =
fork(javaHome, jvmOptions, scalaJars, arguments, workingDirectory, false, outputStrategy).exitValue()
@deprecated("Use fork(ForkOptions, Seq[String])", "0.13.0")
def fork(javaHome: Option[File], jvmOptions: Seq[String], scalaJars: Iterable[File], arguments: Seq[String], workingDirectory: Option[File], connectInput: Boolean, outputStrategy: OutputStrategy): Process =
fork(javaHome, jvmOptions, scalaJars, arguments, workingDirectory, Map.empty, connectInput, outputStrategy)
@deprecated("Use apply(ForkOptions, Seq[String])", "0.13.0")
def fork(javaHome: Option[File], jvmOptions: Seq[String], scalaJars: Iterable[File], arguments: Seq[String], workingDirectory: Option[File], env: Map[String, String], connectInput: Boolean, outputStrategy: OutputStrategy): Process =
{
if (scalaJars.isEmpty) sys.error("Scala jars not specified")
val scalaClasspathString = "-Xbootclasspath/a:" + scalaJars.map(_.getAbsolutePath).mkString(File.pathSeparator)
val mainClass = if (mainClassName.isEmpty) Nil else mainClassName :: Nil
val options = jvmOptions ++ (scalaClasspathString :: mainClass ::: arguments.toList)
Fork.java.fork(javaHome, options, workingDirectory, env, connectInput, outputStrategy)
}
}
}

View File

@ -18,9 +18,6 @@ trait ScalaRun {
def run(mainClass: String, classpath: Seq[File], options: Seq[String], log: Logger): Option[String]
}
class ForkRun(config: ForkOptions) extends ScalaRun {
@deprecated("Use the `ForkRun(ForkOptions) constructor`", "0.13.0")
def this(options: ForkScalaRun) = this(ForkOptions(options.javaHome, options.outputStrategy, options.scalaJars.toSeq, options.workingDirectory, options.runJVMOptions, options.connectInput))
def run(mainClass: String, classpath: Seq[File], options: Seq[String], log: Logger): Option[String] =
{
log.info("Running " + mainClass + " " + options.mkString(" "))

View File

@ -485,7 +485,7 @@ private final class TrapExit(delegateManager: SecurityManager) extends SecurityM
allFrames.foreach(_.dispose) // dispose all top-level windows, which will cause the AWT-EventQueue-* threads to exit
val waitSeconds = 2
log.debug(s"Waiting $waitSeconds s to let AWT thread exit.")
Thread.sleep(waitSeconds * 1000) // AWT Thread doesn't exit immediately, so wait to interrupt it
Thread.sleep(waitSeconds * 1000L) // AWT Thread doesn't exit immediately, so wait to interrupt it
}
}
/** Returns true if the given thread is in the 'system' thread group or is an AWT thread other than AWT-EventQueue.*/

View File

@ -51,7 +51,7 @@ object ForkTest extends Properties("Fork") {
private[this] def trimClasspath(cp: String): String =
if (cp.length > MaximumClasspathLength) {
val lastEntryI = cp.lastIndexOf(File.pathSeparatorChar, MaximumClasspathLength)
val lastEntryI = cp.lastIndexOf(File.pathSeparatorChar.toInt, MaximumClasspathLength)
if (lastEntryI > 0)
cp.substring(0, lastEntryI)
else

View File

@ -75,13 +75,13 @@ trait Import {
val ConsoleOut = sbt.internal.util.ConsoleOut
type ConsoleOut = sbt.internal.util.ConsoleOut
val Dag = sbt.internal.util.Dag
type Dag[Node <: Dag[Node]] = sbt.internal.util.Dag[Node]
type Dag[A <: Dag[A]] = sbt.internal.util.Dag[A]
type DelegatingPMap[K[_], V[_]] = sbt.internal.util.DelegatingPMap[K, V]
val Difference = sbt.internal.util.Difference
type Difference = sbt.internal.util.Difference
type EmptyChangeReport[T] = sbt.internal.util.EmptyChangeReport[T]
val ErrorHandling = sbt.internal.util.ErrorHandling
type EvaluateSettings[Scope] = sbt.internal.util.EvaluateSettings[Scope]
type EvaluateSettings[S] = sbt.internal.util.EvaluateSettings[S]
val EvaluationState = sbt.internal.util.EvaluationState
val ExitHook = sbt.internal.util.ExitHook
type ExitHook = sbt.internal.util.ExitHook
@ -116,7 +116,7 @@ trait Import {
type IDSet[T] = sbt.internal.util.IDSet[T]
val IMap = sbt.internal.util.IMap
type IMap[K[_], V[_]] = sbt.internal.util.IMap[K, V]
type Init[Scope] = sbt.internal.util.Init[Scope]
type Init[S] = sbt.internal.util.Init[S]
val InputCache = sbt.internal.util.InputCache
type InputCache[I] = sbt.internal.util.InputCache[I]
type JLine = sbt.internal.util.JLine
@ -151,7 +151,7 @@ trait Import {
type Relation[A, B] = sbt.internal.util.Relation[A, B]
type SBinaryFormats = sbt.internal.util.SBinaryFormats
val ScalaKeywords = sbt.internal.util.ScalaKeywords
type Settings[Scope] = sbt.internal.util.Settings[Scope]
type Settings[S] = sbt.internal.util.Settings[S]
type SharedAttributeKey[T] = sbt.internal.util.SharedAttributeKey[T]
val Show = sbt.internal.util.Show
type Show[T] = sbt.internal.util.Show[T]

View File

@ -1,8 +1,6 @@
package sbt
import java.lang.{ Process => JProcess, ProcessBuilder => JProcessBuilder }
import java.net.URL
import java.io.File
trait ProcessExtra {
import scala.sys.process._

View File

@ -2,24 +2,24 @@
lazy val root = (project in file(".")).
settings(
a <<= baseDirectory map (b => if( (b / "succeed").exists) () else sys.error("fail")),
b <<= a.task(at => nop dependsOn(at) ),
a <<= baseDirectory map (b => if ((b / "succeed").exists) () else sys.error("fail")),
b <<= a.task(at => nop dependsOn(at)),
c <<= a map { _ => () },
d <<= a flatMap { _ => task { () } }
)
lazy val a = TaskKey[Unit]("a")
lazy val b = TaskKey[Unit]("b")
lazy val c = TaskKey[Unit]("c")
lazy val d = TaskKey[Unit]("d")
lazy val a = taskKey[Unit]("")
lazy val b = taskKey[Unit]("")
lazy val c = taskKey[Unit]("")
lazy val d = taskKey[Unit]("")
lazy val input = (project in file("input")).
settings(
f <<= inputTask { _ map { args => if(args(0) == "succeed") () else sys.error("fail") } },
f <<= inputTask { _ map { args => if (args(0) == "succeed") () else sys.error("fail") } },
j := sys.error("j"),
g <<= f dependsOn(j),
h <<= f map { _ => IO.touch(file("h")) }
)
lazy val f = InputKey[Unit]("f")
lazy val g = InputKey[Unit]("g")
lazy val h = InputKey[Unit]("h")
lazy val j = TaskKey[Unit]("j")
lazy val f = inputKey[Unit]("")
lazy val g = inputKey[Unit]("")
lazy val h = inputKey[Unit]("")
lazy val j = taskKey[Unit]("")

0
sbt/src/sbt-test/actions/reload/build.sbt Executable file → Normal file
View File

0
sbt/src/sbt-test/actions/reload/changes/changed.sbt Executable file → Normal file
View File

0
sbt/src/sbt-test/actions/reload/external/build.sbt vendored Executable file → Normal file
View File

0
sbt/src/sbt-test/actions/reload/test Executable file → Normal file
View File

View File

@ -6,8 +6,8 @@ lazy val root = (project in file(".")).
myIn
)
lazy val demoIn = InputKey[Unit]("demo-in", "Demo run input task", demo)
lazy val demo = TaskKey[Unit]("demo", "Demo run task")
lazy val demoIn = InputKey[Unit]("demoIn", "Demo run input task", demo)
lazy val demo = taskKey[Unit]("Demo run task")
def myRun = fullRunTask( demo, Compile, "A", "1", "1")
def myIn = fullRunInputTask( demoIn, Compile, "A", "1")
def myRun = fullRunTask(demo, Compile, "A", "1", "1")
def myIn = fullRunInputTask(demoIn, Compile, "A", "1")

View File

@ -1,5 +1,5 @@
> demo
-> demo 1
> demo-in 1
-> demo-in 2
> demo-in 1 2
> demoIn 1
-> demoIn 2
> demoIn 1 2

View File

@ -1,4 +1,4 @@
> helloWorldTest
> buildSbtTest
> evil-clear-logger
> set version := { sLog.value.info("yo"); version.value }
> evilClearLogger
> set version := { sLog.value.info("yo"); version.value }

View File

@ -3,13 +3,13 @@ import complete.DefaultParsers._
import sbinary.DefaultProtocol._
import Def.Initialize
val keep = TaskKey[Int]("keep")
val persisted = TaskKey[Int]("persist")
val checkKeep = InputKey[Unit]("check-keep")
val checkPersisted = InputKey[Unit]("check-persist")
val keep = taskKey[Int]("")
val persist = taskKey[Int]("")
val checkKeep = inputKey[Unit]("")
val checkPersist = inputKey[Unit]("")
val updateDemo = TaskKey[Int]("demo")
val check = InputKey[Unit]("check")
val updateDemo = taskKey[Int]("")
val check = inputKey[Unit]("")
val sample = AttributeKey[Int]("demo-key")
def updateDemoInit = state map { s => (s get sample getOrElse 9) + 1 }
@ -34,11 +34,11 @@ def checkInit: Initialize[InputTask[Unit]] = InputTask( (_: State) => token(Spac
}
}
def inMemorySetting = keep <<= getPrevious(keep) map { case None => 3; case Some(x) => x + 1} keepAs(keep)
def persistedSetting = persisted <<= loadPrevious(persisted) map { case None => 17; case Some(x) => x + 1} storeAs(persisted)
def inMemorySetting = keep <<= getPrevious(keep) map { case None => 3; case Some(x) => x + 1} keepAs(keep)
def persistedSetting = persist <<= loadPrevious(persist) map { case None => 17; case Some(x) => x + 1} storeAs(persist)
def inMemoryCheck = checkKeep <<= inputCheck( (ctx, s) => Space ~> str(getFromContext(keep, ctx, s)) )
def persistedCheck = checkPersisted <<= inputCheck( (ctx, s) => Space ~> str(loadFromContext(persisted, ctx, s)) )
def inMemoryCheck = checkKeep <<= inputCheck( (ctx, s) => Space ~> str( getFromContext( keep, ctx, s)) )
def persistedCheck = checkPersist <<= inputCheck( (ctx, s) => Space ~> str(loadFromContext(persist, ctx, s)) )
def inputCheck[T](f: (ScopedKey[_], State) => Parser[T]): Initialize[InputTask[Unit]] =
InputTask( resolvedScoped(ctx => (s: State) => f(ctx, s)) )( dummyTask )

View File

@ -5,35 +5,35 @@
> check 16 15
-> check-keep 3
> check-keep blue
-> checkKeep 3
> checkKeep blue
> keep
> check-keep 3
-> check-keep 4
> check-keep 3
> checkKeep 3
-> checkKeep 4
> checkKeep 3
> keep
-> check-keep 3
> check-keep 4
> check-keep 4
-> checkKeep 3
> checkKeep 4
> checkKeep 4
> reload
> check-keep blue
> checkKeep blue
> keep
> check-keep 3
> checkKeep 3
-> check-persist 17
> check-persist blue
-> checkPersist 17
> checkPersist blue
> persist
> check-persist 17
-> check-persist blue
> checkPersist 17
-> checkPersist blue
> persist
> check-persist 18
> checkPersist 18
> reload
> check-persist 18
> checkPersist 18
> persist
> check-persist 19
> checkPersist 19

View File

@ -1,6 +1,6 @@
lazy val akey = AttributeKey[Int]("TestKey")
lazy val t = TaskKey[String]("test-task")
lazy val check = InputKey[Unit]("check")
lazy val testTask = taskKey[String]("")
lazy val check = inputKey[Unit]("")
lazy val root = (project in file(".")).
aggregate(a, b).
@ -10,12 +10,12 @@ lazy val root = (project in file(".")).
lazy val a = project.
settings(
t := sys.error("Failing")
testTask := sys.error("Failing")
)
lazy val b = project.
settings(
t <<= Def.task("").updateState(updater)
testTask <<= Def.task("").updateState(updater)
)
def checkState(runs: Int, s: State): Unit = {

View File

@ -1,9 +1,9 @@
> check 0
-> test-task
-> testTask
> check 1
-> test-task
-> testTask
> check 2
> b/test-task
> b/testTask
> check 3
-> a/testTask
> check 3
-> a/test-task
> check 3

View File

View File

@ -1,4 +1,4 @@
# test case for http://github.com/sbt/sbt/issues/676
> compile
# fails with StackOverflowException
> show-apis
> showApis

View File

@ -9,4 +9,4 @@ $ copy-file changes/Foo1.scala src/main/scala/Foo.scala
# second iteration
> compile
# check if there are only two compile iterations being performed
> check-number-of-compiler-iterations 2
> checkNumberOfCompilerIterations 2

View File

@ -4,4 +4,4 @@
> compile
# verifies that there's no dependency on a class file corresponding
# to a package
> verify-binary-deps
> verifyBinaryDeps

View File

@ -9,4 +9,4 @@ $ copy-file changes/B1.scala src/main/scala/B.scala
# second iteration
> compile
# check if there are only two compile iterations being performed
> check-number-of-compiler-iterations 2
> checkNumberOfCompilerIterations 2

View File

@ -11,4 +11,4 @@ $ copy-file changes/Impl1.scala src/main/scala/Impl.scala
# second iteration
> compile
# check if there are only two compile iterations performed
> check-number-of-compiler-iterations 2
> checkNumberOfCompilerIterations 2

View File

@ -1,7 +1,7 @@
import sbt.internal.inc.classpath.ClasspathUtilities
lazy val checkFull = TaskKey[Unit]("check-full")
lazy val check = TaskKey[Unit]("check")
lazy val checkFull = taskKey[Unit]("")
lazy val check = taskKey[Unit]("")
lazy val root = (project in file(".")).
settings(

View File

@ -2,7 +2,7 @@
-> check
# verify that check-full succeeds
> check-full
> checkFull
# publish test jar to test repository
> publish
@ -16,4 +16,4 @@ $ touch retrieve
> reload
# verify that artifact with extension, type, and classifier can be retreieved
> check
> check

View File

@ -1,7 +1,7 @@
$ copy-file changes/def.sbt build.sbt
$ copy-file changes/resolver.sbt resolver.sbt
> reload
> publish-local
> publishLocal
> publish
$ delete build.sbt

View File

@ -3,7 +3,7 @@
$ copy-file changes/def/build.sbt build.sbt
$ copy-file changes/def/Def.java b/Def.java
> reload
> publish-local
> publishLocal
> clean
@ -27,7 +27,7 @@ $ delete build.sbt
$ copy-file changes/both/build.sbt build.sbt
$ copy-file changes/def/Def.java b/Def.java
> reload
> publish-local
> publishLocal
> clean

View File

@ -1,4 +1,4 @@
> a/publish-local
> a/publishLocal
> b/update
# verify that A's artifact was published and available for B to compile/run against
> b/run
> b/run

View File

@ -2,8 +2,8 @@ lazy val root = (project in file(".")).
settings(
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))),
libraryDependencies <+= baseDirectory(transitive("javax.mail" % "mail" % "1.4.1")),
TaskKey[Unit]("check-transitive") <<= check(true),
TaskKey[Unit]("check-intransitive") <<= check(false)
TaskKey[Unit]("checkTransitive") <<= check(true),
TaskKey[Unit]("checkIntransitive") <<= check(false)
)
def transitive(dep: ModuleID)(base: File) =

Some files were not shown because too many files have changed in this diff Show More