mirror of https://github.com/sbt/sbt.git
Allow -cp argument to 'apply' command to be quoted. Fixes #724.
This commit is contained in:
parent
36c8326625
commit
8d0c1408c0
|
|
@ -96,11 +96,9 @@ object BasicCommands
|
|||
token(base, compl)
|
||||
}
|
||||
private[this] def classpathOptionParser: Parser[Seq[String]] =
|
||||
token( ("-cp" | "-classpath") ~> Space ) ~> rep1sep(classpathString, token(File.pathSeparatorChar)) <~ token(Space)
|
||||
private[this] def classpathString: Parser[String] =
|
||||
token(charClass(entryClass, "<classpath-entry>").+.string, "<classpath-entry>")
|
||||
private[this] def entryClass(c: Char): Boolean =
|
||||
c != File.pathSeparatorChar && !java.lang.Character.isWhitespace(c)
|
||||
token( ("-cp" | "-classpath") ~> Space ) ~> classpathStrings <~ token(Space)
|
||||
private[this] def classpathStrings: Parser[Seq[String]] =
|
||||
token(StringBasic.map(s => IO.pathSplit(s).toSeq), "<classpath>")
|
||||
|
||||
def exit = Command.command(TerminateAction, exitBrief, exitBrief ) ( _ exit true )
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@ val copyOutputDir = taskKey[Unit]("Copies the compiled classes to a root-level d
|
|||
|
||||
copyOutputDir := {
|
||||
val cd = (classDirectory in Compile).value
|
||||
val to = baseDirectory.value / "out"
|
||||
val to = baseDirectory.value / "out spaced"
|
||||
IO.copyDirectory(cd, to)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
# compiles a new State => State instance
|
||||
> compile
|
||||
# puts the classes in a stable location (out/)
|
||||
# puts the classes in a stable location (out spaced/ to test escaping)
|
||||
> copyOutputDir
|
||||
|
||||
# checks that `apply` can load from a specific classpath
|
||||
> apply -cp out demo.AddNewCommand
|
||||
> 'apply -cp """out spaced/""" demo.AddNewCommand'
|
||||
|
||||
# check that AddNewCommand was actually run
|
||||
# If it was, it should have registered `newCommand`
|
||||
> newCommand
|
||||
> newCommand
|
||||
|
|
|
|||
Loading…
Reference in New Issue