diff --git a/project/Build.scala b/project/Build.scala index 7bf90daa7b3e..f977c5e08ac5 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -56,7 +56,7 @@ object Build { val referenceVersion = "3.0.0-M3" val baseVersion = "3.0.0-RC1" - val baseSbtDottyVersion = "0.5.0" + val baseSbtDottyVersion = "0.5.1" // Versions used by the vscode extension to create a new project // This should be the latest published releases. diff --git a/sbt-dotty/sbt-test/sbt-dotty/scala3doc-empty-test/build.sbt b/sbt-dotty/sbt-test/sbt-dotty/scala3doc-empty-test/build.sbt new file mode 100644 index 000000000000..cacc2d6592b6 --- /dev/null +++ b/sbt-dotty/sbt-test/sbt-dotty/scala3doc-empty-test/build.sbt @@ -0,0 +1 @@ +scalaVersion := sys.props("plugin.scalaVersion") \ No newline at end of file diff --git a/sbt-dotty/sbt-test/sbt-dotty/scala3doc-empty-test/project/plugins.sbt b/sbt-dotty/sbt-test/sbt-dotty/scala3doc-empty-test/project/plugins.sbt new file mode 100644 index 000000000000..c17caab2d98c --- /dev/null +++ b/sbt-dotty/sbt-test/sbt-dotty/scala3doc-empty-test/project/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % sys.props("plugin.version")) diff --git a/sbt-dotty/sbt-test/sbt-dotty/scala3doc-empty-test/src/main/scala/hello/Hello.scala b/sbt-dotty/sbt-test/sbt-dotty/scala3doc-empty-test/src/main/scala/hello/Hello.scala new file mode 100644 index 000000000000..0b5f90467eff --- /dev/null +++ b/sbt-dotty/sbt-test/sbt-dotty/scala3doc-empty-test/src/main/scala/hello/Hello.scala @@ -0,0 +1,8 @@ +package hello +/** Hello, world! */ +object Hello { + def main(args: Array[String]): Unit = { + val dotty: Int | String = "dotty" + println(s"Hello $dotty!") + } +} diff --git a/sbt-dotty/sbt-test/sbt-dotty/scala3doc-empty-test/test b/sbt-dotty/sbt-test/sbt-dotty/scala3doc-empty-test/test new file mode 100644 index 000000000000..3d86bb0f6d7d --- /dev/null +++ b/sbt-dotty/sbt-test/sbt-dotty/scala3doc-empty-test/test @@ -0,0 +1,3 @@ +> doc +> test:doc + diff --git a/sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala b/sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala index a6dd6a74f3a4..0b536a61575c 100644 --- a/sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala +++ b/sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala @@ -444,14 +444,16 @@ object DottyPlugin extends AutoPlugin { private val docSettings = inTask(doc)(Seq( tastyFiles := { - val _ = compile.value // Ensure that everything is compiled, so TASTy is available. + val sources = compile.value // Ensure that everything is compiled, so TASTy is available. // sbt is too smart and do not start doc task if there are no *.scala files defined file("___fake___.scala") +: (classDirectory.value ** "*.tasty").get.map(_.getAbsoluteFile) }, sources := Def.taskDyn[Seq[File]] { - if (isDotty.value && useScala3doc.value) Def.task { tastyFiles.value } - else Def.task { sources.value } + val originalSources = sources.value + if (isDotty.value && useScala3doc.value && originalSources.nonEmpty) + Def.task { tastyFiles.value } + else Def.task { originalSources } }.value, scalacOptions ++= { if (isDotty.value) {