Skip to content

Fix support for project with no sources #10843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
scalaVersion := sys.props("plugin.scalaVersion")
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % sys.props("plugin.version"))
Original file line number Diff line number Diff line change
@@ -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!")
}
}
3 changes: 3 additions & 0 deletions sbt-dotty/sbt-test/sbt-dotty/scala3doc-empty-test/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
> doc
> test:doc

8 changes: 5 additions & 3 deletions sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down