Skip to content

Commit c28b3a8

Browse files
committed
Fix support for empty docs
bump sbtDotty version to 0.5.1
1 parent 75365ea commit c28b3a8

File tree

6 files changed

+19
-4
lines changed

6 files changed

+19
-4
lines changed

project/Build.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ object Build {
5656
val referenceVersion = "3.0.0-M3"
5757

5858
val baseVersion = "3.0.0-RC1"
59-
val baseSbtDottyVersion = "0.5.0"
59+
val baseSbtDottyVersion = "0.5.1"
6060

6161
// Versions used by the vscode extension to create a new project
6262
// This should be the latest published releases.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
scalaVersion := sys.props("plugin.scalaVersion")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % sys.props("plugin.version"))
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package hello
2+
/** Hello, world! */
3+
object Hello {
4+
def main(args: Array[String]): Unit = {
5+
val dotty: Int | String = "dotty"
6+
println(s"Hello $dotty!")
7+
}
8+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
> doc
2+
> test:doc
3+

sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,14 +444,16 @@ object DottyPlugin extends AutoPlugin {
444444

445445
private val docSettings = inTask(doc)(Seq(
446446
tastyFiles := {
447-
val _ = compile.value // Ensure that everything is compiled, so TASTy is available.
447+
val sources = compile.value // Ensure that everything is compiled, so TASTy is available.
448448
// sbt is too smart and do not start doc task if there are no *.scala files defined
449449
file("___fake___.scala") +:
450450
(classDirectory.value ** "*.tasty").get.map(_.getAbsoluteFile)
451451
},
452452
sources := Def.taskDyn[Seq[File]] {
453-
if (isDotty.value && useScala3doc.value) Def.task { tastyFiles.value }
454-
else Def.task { sources.value }
453+
val originalSources = sources.value
454+
if (isDotty.value && useScala3doc.value && originalSources.nonEmpty)
455+
Def.task { tastyFiles.value }
456+
else Def.task { originalSources }
455457
}.value,
456458
scalacOptions ++= {
457459
if (isDotty.value) {

0 commit comments

Comments
 (0)