support wildcards in test-only

This commit is contained in:
Mark Harrah 2011-05-24 23:54:49 -04:00
parent 04a3f090f6
commit 50294c1519
1 changed files with 12 additions and 3 deletions

View File

@ -444,13 +444,22 @@ object Defaults extends BuildCommon
def testOnlyParser: (State, Seq[String]) => Parser[(Seq[String],Seq[String])] =
{ (state, tests) =>
import DefaultParsers._
def distinctParser(exs: Set[String]): Parser[Seq[String]] =
(token(Space) ~> token((NotSpace - "--") examples exs) ).flatMap(ex => distinctParser(exs - ex).map(ex +: _)) ?? Nil
val selectTests = distinctParser(tests.toSet) // todo: proper IDs
val selectTests = distinctParser(tests.toSet)
val options = (token(Space) ~> token("--") ~> spaceDelimited("<option>")) ?? Nil
selectTests ~ options
}
def distinctParser(exs: Set[String]): Parser[Seq[String]] =
{
import DefaultParsers._
val base = token(Space) ~> token(NotSpace - "--" examples exs)
val recurse = base flatMap { ex =>
val (matching, notMatching) = exs.partition( GlobFilter(ex).accept _ )
distinctParser(notMatching).map(matching.toSeq ++ _)
}
recurse ?? Nil
}
def inAllDependencies[T](base: ProjectRef, key: ScopedSetting[T], structure: Load.BuildStructure): Seq[T] =
{
def deps(ref: ProjectRef): Seq[ProjectRef] =