diff --git a/compile/CompilerArguments.scala b/compile/CompilerArguments.scala index 8841b3ff7..d8be529ee 100644 --- a/compile/CompilerArguments.scala +++ b/compile/CompilerArguments.scala @@ -18,7 +18,10 @@ final class CompilerArguments(scalaInstance: ScalaInstance, cp: ClasspathOptions { checkScalaHomeUnset() val cpWithCompiler = finishClasspath(classpath) - val classpathOption = Seq("-classpath", if(cpWithCompiler.isEmpty) "" else absString(cpWithCompiler) ) + // Scala compiler's treatment of empty classpath is troublesome (as of 2.9.1). + // We append a random dummy element as workaround. + val dummy = "dummy_" + Integer.toHexString(util.Random.nextInt) + val classpathOption = Seq("-classpath", if(cpWithCompiler.isEmpty) dummy else absString(cpWithCompiler)) val outputOption = Seq("-d", outputDirectory.getAbsolutePath) options ++ outputOption ++ bootClasspathOption ++ classpathOption ++ abs(sources) } @@ -55,4 +58,4 @@ object CompilerArguments def abs(files: Set[File]): Seq[String] = abs(files.toSeq) def absString(files: Seq[File]): String = abs(files).mkString(File.pathSeparator) def absString(files: Set[File]): String = absString(files.toSeq) -} \ No newline at end of file +} diff --git a/sbt/src/sbt-test/actions/doc/package.scala b/sbt/src/sbt-test/actions/doc/package.scala new file mode 100644 index 000000000..2f0fa21e1 --- /dev/null +++ b/sbt/src/sbt-test/actions/doc/package.scala @@ -0,0 +1,5 @@ +package pkg + +package object foo { + final val foo = "Foo" +} diff --git a/sbt/src/sbt-test/actions/doc/test b/sbt/src/sbt-test/actions/doc/test index 58652e8ce..96a23eef0 100644 --- a/sbt/src/sbt-test/actions/doc/test +++ b/sbt/src/sbt-test/actions/doc/test @@ -13,7 +13,9 @@ $ exists "target/api/java" > 'set sources in (Compile, doc) <<= sources in (Compile, doc) map { _.filterNot(_.getName endsWith ".java") }' -> ; clean ; doc +# compile task is superfluous. Since doc task preceded by compile task has been problematic due to scala +# compiler's way of handling empty classpath. We have it here to test that our workaround works. +> ; clean ; compile ; doc # pure scala project, only scaladoc at top level $ exists "target/api/index.js"