Skip to content

Commit 3f4b101

Browse files
committed
Document stdlib in a separate task
Avoid Tasty errors, and allows us to use wiki syntax for the project.
1 parent 29880b4 commit 3f4b101

File tree

3 files changed

+33
-6
lines changed

3 files changed

+33
-6
lines changed

.github/workflows/scala3doc.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ jobs:
5757
- name: Generate Scala 3 documentation
5858
run: ./project/scripts/sbt scala3doc/generateScala3Documentation
5959

60+
- name: Generate Scala 3 stdlib documentation
61+
run: ./project/scripts/sbt scala3doc/generateScala3StdlibDocumentation
62+
6063
- name: Generate documentation for example project using dotty-sbt
6164
run: ./project/scripts/sbt "sbt-dotty/scripted sbt-dotty/scala3doc"
6265

project/Build.scala

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,9 @@ object Build {
11601160
val testcasesOutputDir = taskKey[String]("Root directory where tests classses are generated")
11611161
val testcasesSourceRoot = taskKey[String]("Root directory where tests sources are generated")
11621162
val generateSelfDocumentation = taskKey[Unit]("Generate example documentation")
1163+
// Note: the two tasks below should be one, but a bug in Tasty prevents that
11631164
val generateScala3Documentation = taskKey[Unit]("Generate documentation for dotty lib")
1165+
val generateScala3StdlibDocumentation = taskKey[Unit]("Generate documentation for Scala3 standard library")
11641166
val generateTestcasesDocumentation = taskKey[Unit]("Generate documentation for testcases, usefull for debugging tests")
11651167
lazy val `scala3doc` = project.in(file("scala3doc")).asScala3doc
11661168
lazy val `scala3doc-testcases` = project.in(file("scala3doc-testcases")).asScala3docTestcases
@@ -1503,17 +1505,27 @@ object Build {
15031505
}.value,
15041506
generateScala3Documentation := Def.taskDyn {
15051507
val dottyJars: Seq[java.io.File] = Seq(
1506-
// (`scala3-interfaces`/Compile/products).value,
1507-
// (`tasty-core-bootstrapped`/Compile/products).value,
1508-
// (`scala3-library-bootstrapped`/Compile/products).value,
1509-
(`stdlib-bootstrapped`/Compile/products).value,
1508+
(`scala3-interfaces`/Compile/products).value,
1509+
(`tasty-core-bootstrapped`/Compile/products).value,
1510+
(`scala3-library-bootstrapped`/Compile/products).value,
15101511
).flatten
15111512

15121513
val roots = joinProducts(dottyJars)
15131514

15141515
if (dottyJars.isEmpty) Def.task { streams.value.log.error("Dotty lib wasn't found") }
15151516
else generateDocumentation(roots, "Scala 3", "scala3", "-p scala3doc/scala3-docs --projectLogo scala3doc/scala3-docs/logo.svg --revision master")
15161517
}.value,
1518+
1519+
generateScala3StdlibDocumentation:= Def.taskDyn {
1520+
val dottyJars: Seq[java.io.File] = Seq(
1521+
(`stdlib-bootstrapped`/Compile/products).value,
1522+
).flatten
1523+
1524+
val roots = joinProducts(dottyJars)
1525+
1526+
if (dottyJars.isEmpty) Def.task { streams.value.log.error("Dotty lib wasn't found") }
1527+
else generateDocumentation(roots, "Scala 3", "scala3-stdlib", "-p scala3doc/scala3-docs --syntax wiki --projectLogo scala3doc/scala3-docs/logo.svg --revision master")
1528+
}.value,
15171529
generateTestcasesDocumentation := Def.taskDyn {
15181530
generateDocumentation(Build.testcasesOutputDir.in(Test).value, "Scala3doc testcases", "testcases", "--revision master")
15191531
}.value,

scala3doc/src/dotty/dokka/tasty/comments/wiki/Converter.scala

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,20 @@ class Converter(val repr: Repr) extends BaseConverter {
113113
resolveLinkQuery(target, Some(body).filter(!_.isEmpty))
114114
})
115115

116-
case _: (Superscript | Subscript | RepresentationLink | HtmlTag) =>
117-
sys.error("not yet supported: Superscript | Subscript | RepresentationLink | HtmlTag")
116+
case Superscript(i) =>
117+
def name = inl.getClass.getSimpleName
118+
println(s"WARN: not yet supported: $name")
119+
emitInline(i)
120+
121+
case Subscript(i) =>
122+
def name = inl.getClass.getSimpleName
123+
println(s"WARN: not yet supported: $name")
124+
emitInline(i)
125+
126+
case _: (RepresentationLink | HtmlTag) =>
127+
def name = inl.getClass.getSimpleName
128+
println(s"WARN: not yet supported: $name")
129+
name // doesn't compile if name is a val
118130
}
119131

120132
def convertInline(inl: Inline): Seq[dkkd.DocTag] =

0 commit comments

Comments
 (0)