Skip to content

Commit d249926

Browse files
authored
Merge pull request #6164 from dotty-staging/fix/sbt-dotty-doc
sbt-dotty: Don't break scaladoc in non-Dotty projects
2 parents 6067ab7 + 78ed9e8 commit d249926

File tree

2 files changed

+28
-11
lines changed

2 files changed

+28
-11
lines changed

project/Build.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ object Build {
3232
val scalacVersion = "2.12.8"
3333

3434
val baseVersion = "0.14.0"
35-
val baseSbtDottyVersion = "0.3.1"
35+
val baseSbtDottyVersion = "0.3.2"
3636

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

4444

4545
val dottyOrganization = "ch.epfl.lamp"

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

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@ object DottyPlugin extends AutoPlugin {
153153
scalaOrganization.value
154154
},
155155

156-
scalacOptions in (Compile, doc) ++= Seq("-project", name.value),
157-
158156
incOptions in Compile := {
159157
val inc = (incOptions in Compile).value
160158
if (isDotty.value)
@@ -326,13 +324,32 @@ object DottyPlugin extends AutoPlugin {
326324
}
327325

328326
private val docSettings = inTask(doc)(Seq(
329-
sources := {
330-
val _ = compile.value // Ensure that everything is compiled, so TASTy is available.
331-
val prev = sources.value
332-
val tastyFiles = (classDirectory.value ** "*.tasty").get.map(_.getAbsoluteFile)
333-
prev ++ tastyFiles
334-
},
335-
scalacOptions += "-from-tasty"
327+
sources := Def.taskDyn {
328+
val old = sources.value
329+
330+
if (isDotty.value) Def.task {
331+
val _ = compile.value // Ensure that everything is compiled, so TASTy is available.
332+
val tastyFiles = (classDirectory.value ** "*.tasty").get.map(_.getAbsoluteFile)
333+
old ++ tastyFiles
334+
} else Def.task {
335+
old
336+
}
337+
}.value,
338+
scalacOptions ++= {
339+
if (isDotty.value) {
340+
val projectName =
341+
if (configuration.value == Compile)
342+
name.value
343+
else
344+
s"${name.value}-${configuration.value}"
345+
Seq(
346+
"-project", projectName,
347+
"-from-tasty"
348+
)
349+
}
350+
else
351+
Seq()
352+
}
336353
))
337354

338355
/** Fetch artifacts for moduleID */

0 commit comments

Comments
 (0)