@@ -1243,16 +1243,19 @@ 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
12501250 IO .createDirectory(file(outDir))
12511251 val stdLibVersion = stdlibVersion(Bootstrapped )
1252+ val scalaLib = findArtifactPath(externalCompilerClasspathTask.value, " scala-library" )
1253+ val dottyLib = (`scala3-library` / Compile / classDirectory).value
12521254 // TODO add versions etc.
12531255 def srcManaged (v : String , s : String ) = s " out/bootstrap/stdlib-bootstrapped/scala- $v/src_managed/main/ $s-library-src "
12541256 def scalaSrcLink (v : String , s : String ) = s " -source-links: $s=github://scala/scala/v $v#src/library "
12551257 def dottySrcLink (v : String , s : String ) = s " -source-links: $s=github://lampepfl/dotty/ $v#library/src "
1258+
12561259 val revision = Seq (" -revision" , ref, " -project-version" , projectVersion)
12571260 val cmd = Seq (
12581261 " -d" ,
@@ -1264,7 +1267,20 @@ object Build {
12641267 s " -source-links:github://lampepfl/dotty/ $referenceVersion" ,
12651268 ) ++ scalacOptionsDocSettings ++ revision ++ params ++ targets
12661269 import _root_ .scala .sys .process ._
1267- 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+
12681284 }
12691285
12701286 val SourceLinksIntegrationTest = config(" sourceLinksIntegrationTest" ) extend Test
@@ -1311,7 +1327,7 @@ object Build {
13111327 generateSelfDocumentation := Def .taskDyn {
13121328 generateDocumentation(
13131329 (Compile / classDirectory).value.getAbsolutePath :: Nil ,
1314- " scaladoc" , " scaladoc/output/self" , VersionUtil .gitHash,
1330+ " scaladoc" , " scaladoc/output/self" , VersionUtil .gitHash
13151331 )
13161332 }.value,
13171333 generateScalaDocumentation := Def .inputTaskDyn {
@@ -1352,7 +1368,7 @@ object Build {
13521368 s " -source-links:docs=github://lampepfl/dotty/master#docs " ,
13531369 " -doc-root-content" , docRootFile.toString,
13541370 " -Ydocument-synthetic-types"
1355- )
1371+ ), usingScript = false
13561372 ))
13571373 }.evaluated,
13581374
@@ -1361,7 +1377,8 @@ object Build {
13611377 (Test / Build .testcasesOutputDir).value,
13621378 " scaladoc testcases" ,
13631379 " scaladoc/output/testcases" ,
1364- " master" )
1380+ " master"
1381+ )
13651382 }.value,
13661383
13671384 Test / buildInfoKeys := Seq [BuildInfoKey ](
0 commit comments