Skip to content

Commit 179f79f

Browse files
committed
Improve implementation of sbt dotc
1 parent 3b70a5c commit 179f79f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

project/Build.scala

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -619,13 +619,12 @@ object Build {
619619

620620
def dotDynTask(main: String) = Def.inputTaskDyn {
621621
val dottyLib = packageAll.value("dotty-library")
622-
val args: Seq[String] = spaceDelimited("<arg>").parsed
622+
val args: List[String] = spaceDelimited("<arg>").parsed.toList
623623

624-
val fullArgs = main +: {
625-
args.span(_ != "-classpath") match {
626-
case (beforeCp, "-classpath" :: cp :: rest) => beforeCp ++ List("-classpath", cp + ":" + dottyLib) ++ rest
627-
case (beforeCp, _) => beforeCp ++ List("-classpath", dottyLib)
628-
}
624+
val fullArgs = main :: {
625+
val (beforeCp, fromCp) = args.span(_ != "-classpath")
626+
val classpath = fromCp.drop(1).headOption.fold(dottyLib)(_ + ":" + dottyLib)
627+
beforeCp ::: "-classpath" :: classpath :: fromCp.drop(2)
629628
}
630629

631630
(runMain in Compile).toTask(fullArgs.mkString(" ", " ", ""))

0 commit comments

Comments
 (0)