Skip to content

Add missing features to scala3doc to match dotty docs #10320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1455,10 +1455,11 @@ object Build {

def asScala3doc: Project = {
def generateDocumentation(targets: String, name: String, outDir: String, params: String = "") = Def.taskDyn {
val sourcesAndRevision = "-s github://lampepfl/dotty --revision master"
val projectVersion = version.value
val sourcesAndRevision = s"-s github://lampepfl/dotty --projectVersion $projectVersion"
run.in(Compile).toTask(
s""" -d output/$outDir -t $targets -n "$name" $sourcesAndRevision $params"""
)
s""" -d scala3doc/output/$outDir -t $targets -n "$name" $sourcesAndRevision $params"""
)
}

def joinProducts(products: Seq[java.io.File]): String =
Expand Down Expand Up @@ -1491,8 +1492,14 @@ object Build {
Compile / mainClass := Some("dotty.dokka.Main"),
// There is a bug in dokka that prevents parallel tests withing the same jvm
fork.in(test) := true,
baseDirectory.in(run) := baseDirectory.in(ThisBuild).value,
generateSelfDocumentation := Def.taskDyn {
generateDocumentation(classDirectory.in(Compile).value.getAbsolutePath, "scala3doc", "self", "-p documentation")
val revision = VersionUtil.gitHash
generateDocumentation(
classDirectory.in(Compile).value.getAbsolutePath,
"scala3doc", "self",
s"-p scala3doc/documentation --projectLogo scala3doc/documentation/logo.svg --revision $revision",
)
}.value,
generateScala3Documentation := Def.taskDyn {
val dottyJars: Seq[java.io.File] = Seq(
Expand All @@ -1506,10 +1513,10 @@ object Build {
val roots = joinProducts(dottyJars)

if (dottyJars.isEmpty) Def.task { streams.value.log.error("Dotty lib wasn't found") }
else generateDocumentation(roots, "Scala 3", "scala3", "-p scala3-docs")
else generateDocumentation(roots, "Scala 3", "scala3", "-p scala3doc/scala3-docs --projectLogo scala3doc/scala3-docs/logo.svg --revision master")
}.value,
generateTestcasesDocumentation := Def.taskDyn {
generateDocumentation(Build.testcasesOutputDir.in(Test).value, "Scala3doc testcases", "testcases")
generateDocumentation(Build.testcasesOutputDir.in(Test).value, "Scala3doc testcases", "testcases", "--revision master")
}.value,
buildInfoKeys in Test := Seq[BuildInfoKey](
Build.testcasesOutputDir.in(Test),
Expand Down
16 changes: 16 additions & 0 deletions scala3doc-testcases/src/tests/links.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package tests.links

object AnObject:
def method(a: Int): Int
= 123 + a
val field =
123

/**
* Broken link, that should result a warning not break compilation
* [[tests.links.AnObject]]

*/
class LinksTest:
def verifyIfLinksTestIsGenerated(b: Int): Int
= 123
7 changes: 7 additions & 0 deletions scala3doc/documentation/docs/design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Design of scala3doc

**BEWARE this is not complete documentation yet but rather a draft mainly to test linking from static site to code**

## Interface

Scala3doc is intednted to be use with sbt as well as from commend line or from other buildtools. The main entry point to processing is [Main](dotty.dokka.Main$) class with [[dotty.dokka.Main$.main]].
1 change: 1 addition & 0 deletions scala3doc/documentation/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions scala3doc/resources/dotty_res/images/scala3doc_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 23 additions & 12 deletions scala3doc/resources/dotty_res/styles/scalastyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -129,22 +129,33 @@ th {
#paneSearch {
display: none;
}
#logo {
background-size: contain;
background-repeat: no-repeat;
background-image: url(../images/dotty-logo-white.svg);
background-origin: content-box;
padding: 8px 0 8px 16px;
height: 42px;
#logo>span {
display: inline-block;
padding: 8px 8px 8px 8px;
vertical-align: middle;
}

#logo img {
max-height: 54px;
max-width: 54px;
cursor: pointer;
}
#logo::after {

#logo .projectName {
color: var(--leftbar-fg);
font-size: 22px;
content: "Scala3doc";
margin-left: 42px;
line-height: 42px;
font-size: 28px;
font-weight: bold;
}

#logo .projectVersion {
color: var(--leftbar-fg);
font-size: 12px;
}

.scala3doc_logo {
width: 116px;
}

.sideMenuPart {
padding-left: 1em;
}
Expand Down
2 changes: 1 addition & 1 deletion scala3doc/resources/dotty_res/styles/search-bar.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.search-content {
padding: 0;
margin: var(--content-padding);
position: absolute;
position: fixed;
top: 0;
right: 0;
z-index: 5;
Expand Down
2 changes: 1 addition & 1 deletion scala3doc/scala3-docs/_layouts/doc-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<header>
<h1>{{ page.title }}</h1>
<div class="byline">
<a href="{{ site.projectUrl }}/edit/master/{{ site.root }}/{{ page.url }}">
<a href="{{ urls.editSource }}">
<i class="far fa-edit"></i>
Edit this page on GitHub
</a>
Expand Down
Loading