diff options
author | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2015-02-20 19:04:07 +0100 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2015-04-17 11:43:25 -0700 |
commit | 79a760dbb19f65122b567da0c030a1d57a8b8a3f (patch) | |
tree | 01236d382b36faf2b00470996d8c01b08b6ee0a0 /build.sbt | |
parent | ae55324fd07e0042eb14098a2ad9fad0279d24ec (diff) | |
download | scala-79a760dbb19f65122b567da0c030a1d57a8b8a3f.tar.gz scala-79a760dbb19f65122b567da0c030a1d57a8b8a3f.tar.bz2 scala-79a760dbb19f65122b567da0c030a1d57a8b8a3f.zip |
Scaladoc
Put library class files to scaladoc's classpath when documenting the library.
TODO: why is this needed? Bug in scaladoc?
Pass `src/library-aux` to scaladoc using `-doc-no-compile` option.
To mimic ant, output docs into `buildDirectory/scaladoc/$name`.
Diffstat (limited to 'build.sbt')
-rw-r--r-- | build.sbt | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -71,6 +71,7 @@ lazy val commonSettings = Seq[Setting[_]]( scalaSource in Compile := (sourceDirectory in Compile).value, javaSource in Compile := (sourceDirectory in Compile).value, target := (baseDirectory in ThisBuild).value / "target" / name.value, + target in Compile in doc := buildDirectory.value / "scaladoc" / name.value, classDirectory in Compile := buildDirectory.value / "quick/classes" / name.value, // given that classDirectory is overriden to be _outside_ of target directory, we have // to make sure its being cleaned properly @@ -96,7 +97,18 @@ lazy val scalaSubprojectSettings = commonSettings ++ Seq[Setting[_]]( lazy val library = configureAsSubproject(project). settings( - scalacOptions ++= Seq[String]("-sourcepath", (scalaSource in Compile).value.toString) + scalacOptions in Compile ++= Seq[String]("-sourcepath", (scalaSource in Compile).value.toString), + // Workaround for a bug in `scaladoc` that it seems to not respect the `-sourcepath` option + // as a result of this bug, the compiler cannot even initialize Definitions without + // binaries of the library on the classpath. Specifically, we get this error: + // (library/compile:doc) scala.reflect.internal.FatalError: package class scala does not have a member Int + // Ant build does the same thing always: it puts binaries for documented classes on the classpath + // sbt never does this by default (which seems like a good default) + dependencyClasspath in Compile in doc += (classDirectory in Compile).value, + scalacOptions in Compile in doc ++= { + val libraryAuxDir = (baseDirectory in ThisBuild).value / "src/library-aux" + Seq("-doc-no-compile", libraryAuxDir.toString) + } ) dependsOn (forkjoin) lazy val reflect = configureAsSubproject(project). |