Skip to content

Commit 4ffe90f

Browse files
committed
FIx tests on windows
1 parent 5bd1d92 commit 4ffe90f

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

project/Build.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,7 @@ object Build {
15321532
val projectRoot = (ThisBuild/baseDirectory).value.toPath
15331533
val stdLibRoot = projectRoot.relativize(managedSources.toPath.normalize())
15341534
val scalaSourceLink =
1535-
s"$stdLibRoot=https://github.com/scala/scala/blob/v${stdlibVersion(Bootstrapped)}/src/library€{FILE_PATH}#L€{FILE_LINE}"
1535+
s"$stdLibRoot=github://scala/scala/v${stdlibVersion(Bootstrapped)}#src/library"
15361536
val sourcesAndRevision = s"-source-links $scalaSourceLink,github://lampepfl/dotty -revision $ref -project-version $projectVersion"
15371537
val cmd = s""" -d $outDir -project "$name" $sourcesAndRevision $params $targets"""
15381538
run.in(Compile).toTask(cmd)

scala3doc/src/dotty/dokka/SourceLinks.scala

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import dotty.dokka.model.api._
66
import dotty.tools.dotc.core.Contexts.Context
77
import scala.util.matching.Regex
88

9-
def pathToString(p: Path) = "/" + p.toString.replace('\\', '/')
9+
def pathToString(p: Path) = p.toString.replace('\\', '/')
1010

1111
trait SourceLink:
1212
val path: Option[Path] = None
@@ -22,14 +22,15 @@ case class PrefixedSourceLink(val myPath: Path, nested: SourceLink) extends Sour
2222
case class TemplateSourceLink(val urlTemplate: String) extends SourceLink:
2323
override val path: Option[Path] = None
2424
override def render(memberName: String, path: Path, operation: String, line: Option[Int]): String =
25+
val pathString = "/" + pathToString(path)
2526
val mapping = Map(
26-
"\\{\\{ path \\}\\}".r -> pathToString(path),
27+
"\\{\\{ path \\}\\}".r -> pathString,
2728
"\\{\\{ line \\}\\}".r -> line.fold("")(_.toString),
2829
"\\{\\{ ext \\}\\}".r -> Some(
29-
pathToString(path)).filter(_.lastIndexOf(".") == -1).fold("")(p => p.substring(p.lastIndexOf("."))
30+
pathString).filter(_.lastIndexOf(".") == -1).fold("")(p => p.substring(p.lastIndexOf("."))
3031
),
3132
"\\{\\{ path_no_ext \\}\\}".r -> Some(
32-
pathToString(path)).filter(_.lastIndexOf(".") == -1).fold(pathToString(path))(p => p.substring(0, p.lastIndexOf("."))
33+
pathString).filter(_.lastIndexOf(".") == -1).fold(pathString)(p => p.substring(0, p.lastIndexOf("."))
3334
),
3435
"\\{\\{ name \\}\\}".r -> memberName
3536
)
@@ -43,7 +44,7 @@ case class WebBasedSourceLink(prefix: String, revision: String, subPath: String)
4344
override def render(memberName: String, path: Path, operation: String, line: Option[Int]): String =
4445
val action = if operation == "view" then "blob" else operation
4546
val linePart = line.fold("")(l => s"#L$l")
46-
s"$prefix/$action/$revision$subPath/$path$linePart"
47+
s"$prefix/$action/$revision$subPath/${pathToString(path)}$linePart"
4748

4849
object SourceLink:
4950
val SubPath = "([^=]+)=(.+)".r

0 commit comments

Comments
 (0)