Skip to content

Commit

Permalink
Review CRs 4
Browse files Browse the repository at this point in the history
  • Loading branch information
pikinier20 committed May 31, 2021
1 parent e238841 commit 263b484
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions dist/bin/scaladoc
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ eval "\"$JAVACMD\"" \
${JAVA_OPTS:-$default_java_opts} \
"${java_args[@]}" \
"${jvm_cp_args-}" \
-Dscala.usejavacp=true \
"dotty.tools.scaladoc.Main" \
"${scala_args[@]}" \
"${residual_args[@]}" \
Expand Down
25 changes: 18 additions & 7 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ object Build {
libraryDependencies += ("org.scala-js" %%% "scalajs-dom" % "1.1.0").cross(CrossVersion.for3Use2_13)
)

def generateDocumentation(targets: Seq[String], name: String, outDir: String, ref: String, params: Seq[String] = Nil) =
def generateDocumentation(targets: Seq[String], name: String, outDir: String, ref: String, params: Seq[String] = Nil, usingScript: Boolean = true) =
Def.taskDyn {
val distLocation = (dist / pack).value
val projectVersion = version.value
Expand All @@ -1267,7 +1267,20 @@ object Build {
s"-source-links:github://lampepfl/dotty/$referenceVersion",
) ++ scalacOptionsDocSettings ++ revision ++ params ++ targets
import _root_.scala.sys.process._
Def.task((s"$distLocation/bin/scaladoc" +: cmd).!)
if (usingScript)
Def.task((s"$distLocation/bin/scaladoc" +: cmd).!)
else {
val escapedCmd = cmd.map(arg => if(arg.contains(" ")) s""""$arg"""" else arg)
Def.task {
try {
(Compile / run).toTask(escapedCmd.mkString(" ", " ", "")).value
0
} catch {
case _ : Throwable => 1
}
}
}

}

val SourceLinksIntegrationTest = config("sourceLinksIntegrationTest") extend Test
Expand Down Expand Up @@ -1314,8 +1327,7 @@ object Build {
generateSelfDocumentation := Def.taskDyn {
generateDocumentation(
(Compile / classDirectory).value.getAbsolutePath :: Nil,
"scaladoc", "scaladoc/output/self", VersionUtil.gitHash,
Seq("-usejavacp")
"scaladoc", "scaladoc/output/self", VersionUtil.gitHash
)
}.value,
generateScalaDocumentation := Def.inputTaskDyn {
Expand Down Expand Up @@ -1356,7 +1368,7 @@ object Build {
s"-source-links:docs=github://lampepfl/dotty/master#docs",
"-doc-root-content", docRootFile.toString,
"-Ydocument-synthetic-types"
)
), usingScript = false
))
}.evaluated,

Expand All @@ -1365,8 +1377,7 @@ object Build {
(Test / Build.testcasesOutputDir).value,
"scaladoc testcases",
"scaladoc/output/testcases",
"master",
Seq("-usejavacp")
"master"
)
}.value,

Expand Down

0 comments on commit 263b484

Please sign in to comment.