Skip to content

sbt-dotty: Don't break scaladoc in non-Dotty projects #6164

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 2 commits into from
Mar 26, 2019
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
4 changes: 2 additions & 2 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ object Build {
val scalacVersion = "2.12.8"

val baseVersion = "0.14.0"
val baseSbtDottyVersion = "0.3.1"
val baseSbtDottyVersion = "0.3.2"

// Versions used by the vscode extension to create a new project
// This should be the latest published releases.
// TODO: Have the vscode extension fetch these numbers from the Internet
// instead of hardcoding them ?
val publishedDottyVersion = "0.13.0-RC1"
val publishedSbtDottyVersion = "0.3.0"
val publishedSbtDottyVersion = "0.3.1"


val dottyOrganization = "ch.epfl.lamp"
Expand Down
35 changes: 26 additions & 9 deletions sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ object DottyPlugin extends AutoPlugin {
scalaOrganization.value
},

scalacOptions in (Compile, doc) ++= Seq("-project", name.value),

incOptions in Compile := {
val inc = (incOptions in Compile).value
if (isDotty.value)
Expand Down Expand Up @@ -326,13 +324,32 @@ object DottyPlugin extends AutoPlugin {
}

private val docSettings = inTask(doc)(Seq(
sources := {
val _ = compile.value // Ensure that everything is compiled, so TASTy is available.
val prev = sources.value
val tastyFiles = (classDirectory.value ** "*.tasty").get.map(_.getAbsoluteFile)
prev ++ tastyFiles
},
scalacOptions += "-from-tasty"
sources := Def.taskDyn {
val old = sources.value

if (isDotty.value) Def.task {
val _ = compile.value // Ensure that everything is compiled, so TASTy is available.
val tastyFiles = (classDirectory.value ** "*.tasty").get.map(_.getAbsoluteFile)
old ++ tastyFiles
} else Def.task {
old
}
}.value,
scalacOptions ++= {
if (isDotty.value) {
val projectName =
if (configuration.value == Compile)
name.value
else
s"${name.value}-${configuration.value}"
Seq(
"-project", projectName,
"-from-tasty"
)
}
else
Seq()
}
))

/** Fetch artifacts for moduleID */
Expand Down