Skip to content

Commit 263b484

Browse files
committed
Review CRs 4
1 parent e238841 commit 263b484

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

dist/bin/scaladoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ eval "\"$JAVACMD\"" \
127127
${JAVA_OPTS:-$default_java_opts} \
128128
"${java_args[@]}" \
129129
"${jvm_cp_args-}" \
130+
-Dscala.usejavacp=true \
130131
"dotty.tools.scaladoc.Main" \
131132
"${scala_args[@]}" \
132133
"${residual_args[@]}" \

project/Build.scala

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,7 +1243,7 @@ object Build {
12431243
libraryDependencies += ("org.scala-js" %%% "scalajs-dom" % "1.1.0").cross(CrossVersion.for3Use2_13)
12441244
)
12451245

1246-
def generateDocumentation(targets: Seq[String], name: String, outDir: String, ref: String, params: Seq[String] = Nil) =
1246+
def generateDocumentation(targets: Seq[String], name: String, outDir: String, ref: String, params: Seq[String] = Nil, usingScript: Boolean = true) =
12471247
Def.taskDyn {
12481248
val distLocation = (dist / pack).value
12491249
val projectVersion = version.value
@@ -1267,7 +1267,20 @@ object Build {
12671267
s"-source-links:github://lampepfl/dotty/$referenceVersion",
12681268
) ++ scalacOptionsDocSettings ++ revision ++ params ++ targets
12691269
import _root_.scala.sys.process._
1270-
Def.task((s"$distLocation/bin/scaladoc" +: cmd).!)
1270+
if (usingScript)
1271+
Def.task((s"$distLocation/bin/scaladoc" +: cmd).!)
1272+
else {
1273+
val escapedCmd = cmd.map(arg => if(arg.contains(" ")) s""""$arg"""" else arg)
1274+
Def.task {
1275+
try {
1276+
(Compile / run).toTask(escapedCmd.mkString(" ", " ", "")).value
1277+
0
1278+
} catch {
1279+
case _ : Throwable => 1
1280+
}
1281+
}
1282+
}
1283+
12711284
}
12721285

12731286
val SourceLinksIntegrationTest = config("sourceLinksIntegrationTest") extend Test
@@ -1314,8 +1327,7 @@ object Build {
13141327
generateSelfDocumentation := Def.taskDyn {
13151328
generateDocumentation(
13161329
(Compile / classDirectory).value.getAbsolutePath :: Nil,
1317-
"scaladoc", "scaladoc/output/self", VersionUtil.gitHash,
1318-
Seq("-usejavacp")
1330+
"scaladoc", "scaladoc/output/self", VersionUtil.gitHash
13191331
)
13201332
}.value,
13211333
generateScalaDocumentation := Def.inputTaskDyn {
@@ -1356,7 +1368,7 @@ object Build {
13561368
s"-source-links:docs=github://lampepfl/dotty/master#docs",
13571369
"-doc-root-content", docRootFile.toString,
13581370
"-Ydocument-synthetic-types"
1359-
)
1371+
), usingScript = false
13601372
))
13611373
}.evaluated,
13621374

@@ -1365,8 +1377,7 @@ object Build {
13651377
(Test / Build.testcasesOutputDir).value,
13661378
"scaladoc testcases",
13671379
"scaladoc/output/testcases",
1368-
"master",
1369-
Seq("-usejavacp")
1380+
"master"
13701381
)
13711382
}.value,
13721383

0 commit comments

Comments
 (0)