Skip to content

Commit 8a2325d

Browse files
committed
Fix sbt tests and make error messages more helpul in case of conflicts in docs
1 parent 8f78f33 commit 8a2325d

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

sbt-test/sbt-dotty/scaladoc/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ TaskKey[Unit]("checkScaladocOptions") := {
66
}
77

88
TaskKey[Unit]("checkHtmlFiles") := {
9-
val helloHtml = (Compile / doc / target).value / "api" / "hello.html"
9+
val helloHtml = (Compile / doc / target).value / "hello.html"
1010
assert(helloHtml.exists)
1111
}

scaladoc/src/dotty/tools/scaladoc/renderers/HtmlRenderer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class HtmlRenderer(rootPackage: Member, val members: Map[DRI, Member])(using ctx
9292
if page.link.dri.isStaticFile then
9393
val dest = absolutePath(page.link.dri)
9494
if apiPaths.contains(dest) then
95-
report.error(s"Conflict between static page and API member for $dest")
95+
report.error(s"Conflict between static page and API member for $dest. $pathsConflictResoultionMsg")
9696
page.children.foreach(walk)
9797

9898
all.foreach (walk)

scaladoc/src/dotty/tools/scaladoc/renderers/Locations.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ trait Locations(using ctx: DocContext):
2525

2626
var cache = new JHashMap[DRI, Seq[String]]()
2727

28+
private[renderers] def pathsConflictResoultionMsg =
29+
"Using `-Ylegacy-api-layout` flag will move all API documentaiton into `api` subdirectory and will fix this conflict."
30+
2831
// TODO verify if location exisits
2932
def rawLocation(dri: DRI): Seq[String] =
3033
cache.get(dri) match

scaladoc/src/dotty/tools/scaladoc/renderers/Resources.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ trait Resources(using ctx: DocContext) extends Locations, Writer:
172172

173173
def renderResource(resource: Resource): Seq[String] =
174174
if resource.path.endsWith(".html") && apiPaths.contains(resource.path) then
175-
report.error(s"Conflict between resource and API member for ${resource.path}")
175+
report.error(s"Conflict between resource and API member for ${resource.path}. $pathsConflictResoultionMsg")
176176
Nil
177177
else
178178
resource match

0 commit comments

Comments
 (0)