Skip to content

Commit 49f2d03

Browse files
committed
rename legacyAPILayout to apiSubdirectory
1 parent 8a2325d commit 49f2d03

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

project/Build.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ object Build {
13551355
s"-source-links:docs=github://lampepfl/dotty/master#docs",
13561356
"-doc-root-content", docRootFile.toString,
13571357
"-Ydocument-synthetic-types"
1358-
) ++ (if (justAPI) Nil else Seq("-siteroot", "docs", "-Ylegacy-api-layout")))
1358+
) ++ (if (justAPI) Nil else Seq("-siteroot", "docs", "-Yapi-subdirectory")))
13591359

13601360
if (dottyJars.isEmpty) Def.task { streams.value.log.error("Dotty lib wasn't found") }
13611361
else if (justAPI) generateDocTask

scaladoc/src/dotty/tools/scaladoc/Scaladoc.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ object Scaladoc:
5959
noLinkWarnings: Boolean = false,
6060
versionsDictionaryUrl: Option[String] = None,
6161
generateInkuire : Boolean = false,
62-
legacyAPILayout : Boolean = false
62+
apiSubdirectory : Boolean = false
6363
)
6464

6565
def run(args: Array[String], rootContext: CompilerContext): Reporter =
@@ -225,7 +225,7 @@ object Scaladoc:
225225
snippetCompilerDebug.get,
226226
versionsDictionaryUrl.nonDefault,
227227
generateInkuire.get,
228-
legacyAPILayout.get,
228+
apiSubdirectory.get,
229229
)
230230
(Some(docArgs), newContext)
231231
}

scaladoc/src/dotty/tools/scaladoc/ScaladocSettings.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ class ScaladocSettings extends SettingGroup with AllScalaSettings:
120120
val generateInkuire: Setting[Boolean] =
121121
BooleanSetting("-Ygenerate-inkuire", "Generates InkuireDB and enables Hoogle-like searches", false)
122122

123-
val legacyAPILayout: Setting[Boolean] =
124-
BooleanSetting("-Ylegacy-api-layout", "Keep all api member inside `api` directory", false)
123+
val apiSubdirectory: Setting[Boolean] =
124+
BooleanSetting("-Yapi-subdirectory", "Keep all api member inside `api` directory", false)
125125

126126
def scaladocSpecificSettings: Set[Setting[_]] =
127127
Set(sourceLinks, syntax, revision, externalDocumentationMappings, socialLinks, skipById, skipByRegex, deprecatedSkipPackages, docRootContent, snippetCompiler, snippetCompilerDebug, generateInkuire)

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

+7-1
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,14 @@ class HtmlRenderer(rootPackage: Member, val members: Map[DRI, Member])(using ctx
5858

5959
val hiddenPages: Seq[Page] =
6060
staticSite match
61-
case None => Nil
61+
case None =>
62+
Seq(navigablePage.copy( // Add index page that is a copy of api/index.html
63+
link = navigablePage.link.copy(dri = docsRootDRI),
64+
children = Nil
65+
))
6266
case Some(siteContext) =>
67+
// In case that we do not have an index page and we do not have any API entries
68+
// we want to create empty index page, so there is one
6369
val actualIndexTemplate = siteContext.indexTemplates() match
6470
case Nil if effectiveMembers.isEmpty => Seq(siteContext.emptyIndexTemplate)
6571
case templates => templates

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ trait Locations(using ctx: DocContext):
2626
var cache = new JHashMap[DRI, Seq[String]]()
2727

2828
private[renderers] def pathsConflictResoultionMsg =
29-
"Using `-Ylegacy-api-layout` flag will move all API documentaiton into `api` subdirectory and will fix this conflict."
29+
"Using `-Yapi-subdirectory` flag will move all API documentation into `api` subdirectory and will fix this conflict."
3030

3131
// TODO verify if location exisits
3232
def rawLocation(dri: DRI): Seq[String] =
@@ -35,7 +35,7 @@ trait Locations(using ctx: DocContext):
3535
val path = dri match
3636
case `docsRootDRI` => List("docs", "index")
3737
case `apiPageDRI` =>
38-
if ctx.args.legacyAPILayout || ctx.staticSiteContext.fold(false)(_.hasIndexFile)
38+
if ctx.args.apiSubdirectory || ctx.staticSiteContext.fold(false)(_.hasIndexFile)
3939
then List("api", "index")
4040
else List("index")
4141
case dri if dri.isStaticFile =>
@@ -46,7 +46,7 @@ trait Locations(using ctx: DocContext):
4646
case "<empty>" :: Nil => "_empty_" :: Nil
4747
case "<empty>" :: tail => "_empty_" :: tail
4848
case other => other
49-
if ctx.args.legacyAPILayout then "api" :: fqn else fqn
49+
if ctx.args.apiSubdirectory then "api" :: fqn else fqn
5050
cache.put(dri, path)
5151
path
5252
case cached => cached

0 commit comments

Comments
 (0)