Skip to content

Commit

Permalink
Generate docs for dotty library
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki committed Jun 29, 2023
1 parent 52c1bf2 commit d7f7694
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion library/src/scala/quoted/ToExpr.scala
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,8 @@ object ToExpr {
/** Default implementation of `ToExpr[BigDecimal using the default MathContext]` */
given BigDecimalToExpr: ToExpr[BigDecimal] with {
def apply(x: BigDecimal)(using Quotes): Expr[BigDecimal] =
'{ BigDecimal(${Expr(x.toString)}) }
val bigDecimal: String = "" + x // workaround "method toString in class BigDecimal does not take parameters" in scaladoc/generateScalaDocumentation
'{ BigDecimal(${Expr(bigDecimal)}) }
}

/** Default implementation of `ToExpr[StringContext]` */
Expand Down
18 changes: 11 additions & 7 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1962,7 +1962,7 @@ object ScaladocConfigs {
SourceLinks(
List(
scalaSrcLink(stdLibVersion, srcManaged(version, "scala") + "="),
dottySrcLink(refVersion, srcManaged(version, "dotty") + "=", "#library/src"),
dottySrcLink(refVersion, "library/src=", "#library/src"),
dottySrcLink(refVersion),
"docs=github://lampepfl/dotty/main#docs"
)
Expand Down Expand Up @@ -2047,6 +2047,7 @@ object ScaladocConfigs {
lazy val Scala3 = Def.task {
val dottyJars: Seq[java.io.File] = Seq(
(`stdlib-bootstrapped`/Compile/products).value,
(`scala3-library-bootstrapped`/Compile/products).value,
(`scala3-interfaces`/Compile/products).value,
(`tasty-core-bootstrapped`/Compile/products).value,
).flatten
Expand All @@ -2060,7 +2061,7 @@ object ScaladocConfigs {
val docRootFile = stdLibRoot.resolve("rootdoc.txt")

val dottyManagesSources =
(`stdlib-bootstrapped`/Compile/sourceManaged).value / "dotty-library-src"
(`scala3-library-bootstrapped`/Compile/sourceDirectory).value

val tastyCoreSources = projectRoot.relativize((`tasty-core-bootstrapped`/Compile/scalaSource).value.toPath().normalize())

Expand Down Expand Up @@ -2088,24 +2089,27 @@ object ScaladocConfigs {
}

def stableScala3(version: String) = Def.task {
val scalaLibrarySrc = s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed"
val dottyLibrarySrc = "library/src"
Scala3.value
.add(defaultSourceLinks(version + "-bin-SNAPSHOT-nonbootstrapped", version).value)
.add(ProjectVersion(version))
.add(SnippetCompiler(
List(
s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/dotty-library-src/scala/quoted=compile",
s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/dotty-library-src/scala/compiletime=compile"
s"$dottyLibrarySrc/scala/quoted=compile",
s"$dottyLibrarySrc/scala/compiletime=compile"
)
))
.add(CommentSyntax(List(
s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/dotty-library-src=markdown",
s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/scala-library-src=wiki",
s"$dottyLibrarySrc=markdown",
s"$scalaLibrarySrc=wiki",
"wiki"
)))
.add(DocRootContent(s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/scala-library-src/rootdoc.txt"))
.add(DocRootContent(s"$scalaLibrarySrc/rootdoc.txt"))
.withTargets(
Seq(
s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/classes",
s"out/bootstrap/scala3-library-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/classes",
s"tmp/interfaces/target/classes",
s"out/bootstrap/tasty-core-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/classes"
)
Expand Down

0 comments on commit d7f7694

Please sign in to comment.