Skip to content

Commit 655a80c

Browse files
committed
use File.pathSeparator for classpath in genDocs and dottydocs
- use File.pathSeparator instead of hard-coded path separator `:` => this way Windows user can run the command as well - reduce code duplication: move classpath string generation to own task and reuse it in genDocs and dottydocs
1 parent 8f069b0 commit 655a80c

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

project/Build.scala

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,13 @@ object Build {
345345
javacOptions in (Compile, doc) --= Seq("-Xlint:unchecked", "-Xlint:deprecation")
346346
)
347347

348+
private lazy val dottydocClasspath = Def.task {
349+
val dottyLib = (packageAll in `dotty-compiler`).value("dotty-library")
350+
val dottyInterfaces = (packageAll in `dotty-compiler`).value("dotty-interfaces")
351+
val otherDeps = (dependencyClasspath in Compile).value.map(_.data).mkString(File.pathSeparator)
352+
dottyLib + File.pathSeparator + dottyInterfaces + File.pathSeparator + otherDeps
353+
}
354+
348355
// Settings shared between dotty-doc and dotty-doc-bootstrapped
349356
lazy val dottyDocSettings = Seq(
350357
baseDirectory in (Compile, run) := baseDirectory.value / "..",
@@ -363,10 +370,7 @@ object Build {
363370
// Used by sbt-dotty to resolve the latest nightly
364371
val majorVersion = baseVersion.take(baseVersion.lastIndexOf('.'))
365372
IO.write(file("./docs/_site/versions/latest-nightly-base"), majorVersion)
366-
367-
val dottyLib = (packageAll in `dotty-compiler`).value("dotty-library")
368-
val dottyInterfaces = (packageAll in `dotty-compiler`).value("dotty-interfaces")
369-
val otherDeps = (dependencyClasspath in Compile).value.map(_.data).mkString(":")
373+
370374
val sources =
371375
(unmanagedSources in (Compile, compile)).value ++
372376
(unmanagedSources in (`dotty-compiler`, Compile)).value
@@ -375,7 +379,7 @@ object Build {
375379
"-project", "Dotty",
376380
"-project-version", dottyVersion,
377381
"-project-url", dottyGithubUrl,
378-
"-classpath", s"$dottyLib:$dottyInterfaces:$otherDeps"
382+
"-classpath", dottydocClasspath.value
379383
)
380384
(runMain in Compile).toTask(
381385
s""" dotty.tools.dottydoc.Main ${args.mkString(" ")} ${sources.mkString(" ")}"""
@@ -384,10 +388,7 @@ object Build {
384388

385389
dottydoc := Def.inputTaskDyn {
386390
val args: Seq[String] = spaceDelimited("<arg>").parsed
387-
val dottyLib = (packageAll in `dotty-compiler`).value("dotty-library")
388-
val dottyInterfaces = (packageAll in `dotty-compiler`).value("dotty-interfaces")
389-
val otherDeps = (dependencyClasspath in Compile).value.map(_.data).mkString(":")
390-
val cp: Seq[String] = Seq("-classpath", s"$dottyLib:$dottyInterfaces:$otherDeps")
391+
val cp: Seq[String] = Seq("-classpath", dottydocClasspath.value)
391392
(runMain in Compile).toTask(s""" dotty.tools.dottydoc.Main ${cp.mkString(" ")} """ + args.mkString(" "))
392393
}.evaluated,
393394

0 commit comments

Comments
 (0)