@@ -114,7 +114,7 @@ object Doc extends ScalaCommand[DocOptions] {
114114
115115 value(alreadyExistsCheck())
116116
117- val docJarPath = value(generateScaladocDirPath(build, logger, extraArgs))
117+ val docJarPath = value(generateScaladocDirPath(Seq ( build) , logger, extraArgs))
118118 value(alreadyExistsCheck())
119119 if (force) os.copy.over(docJarPath, destPath)
120120 else os.copy(docJarPath, destPath)
@@ -136,84 +136,77 @@ object Doc extends ScalaCommand[DocOptions] {
136136 )
137137
138138 def generateScaladocDirPath (
139- build : Build .Successful ,
139+ builds : Seq [ Build .Successful ] ,
140140 logger : Logger ,
141141 extraArgs : Seq [String ]
142142 ): Either [BuildException , os.Path ] = either {
143- val docContentDir = build .scalaParams match {
143+ val docContentDir = builds.head .scalaParams match {
144144 case Some (scalaParams) if scalaParams.scalaVersion.startsWith(" 2." ) =>
145- build .project.scaladocDir
145+ builds.head .project.scaladocDir
146146 case Some (scalaParams) =>
147147 val res = value {
148148 Artifacts .fetchAnyDependencies(
149149 Seq (Positioned .none(dep " org.scala-lang::scaladoc: ${scalaParams.scalaVersion}" )),
150- value(build .options.finalRepositories),
150+ value(builds.head .options.finalRepositories),
151151 Some (scalaParams),
152152 logger,
153- build .options.finalCache,
153+ builds.head .options.finalCache,
154154 None
155155 )
156156 }
157- val destDir = build .project.scaladocDir
157+ val destDir = builds.head .project.scaladocDir
158158 os.makeDir.all(destDir)
159- val ext = if ( Properties .isWin) " .exe" else " "
159+ val ext = if Properties .isWin then " .exe" else " "
160160 val baseArgs = Seq (
161161 " -classpath" ,
162- build. fullClassPath.map(_.toString).mkString(File .pathSeparator),
162+ builds.flatMap(_. fullClassPath).distinct .map(_.toString).mkString(File .pathSeparator),
163163 " -d" ,
164164 destDir.toString
165165 )
166166 val defaultArgs =
167- if (
168- build.options.notForBloopOptions.packageOptions.useDefaultScaladocOptions.getOrElse(
169- true
170- )
171- )
172- defaultScaladocArgs
173- else
174- Nil
167+ if builds.head.options.notForBloopOptions.packageOptions.useDefaultScaladocOptions
168+ .getOrElse(true )
169+ then defaultScaladocArgs
170+ else Nil
175171 val args = baseArgs ++
176- build .project.scalaCompiler.map(_.scalacOptions).getOrElse(Nil ) ++
172+ builds.head .project.scalaCompiler.map(_.scalacOptions).getOrElse(Nil ) ++
177173 extraArgs ++
178174 defaultArgs ++
179- Seq (build .output.toString)
175+ builds.map(_ .output.toString)
180176 val retCode = Runner .runJvm(
181- (build .options.javaHomeLocation().value / " bin" / s " java $ext" ).toString,
177+ (builds.head .options.javaHomeLocation().value / " bin" / s " java $ext" ).toString,
182178 Nil , // FIXME Allow to customize that?
183179 res.files.map(os.Path (_, os.pwd)),
184180 " dotty.tools.scaladoc.Main" ,
185181 args,
186182 logger,
187- cwd = Some (build .inputs.workspace)
183+ cwd = Some (builds.head .inputs.workspace)
188184 ).waitFor()
189- if (retCode == 0 )
190- destDir
191- else
192- value(Left (new ScaladocGenerationFailedError (retCode)))
185+ if retCode == 0 then destDir
186+ else value(Left (new ScaladocGenerationFailedError (retCode)))
193187 case None =>
194- val destDir = build .project.scaladocDir
188+ val destDir = builds.head .project.scaladocDir
195189 os.makeDir.all(destDir)
196190 val ext = if (Properties .isWin) " .exe" else " "
197191 val javaSources =
198- (build.sources.paths.map(_._1) ++ build.generatedSources.map(_.generated))
192+ builds
193+ .flatMap(b => b.sources.paths.map(_._1) ++ b.generatedSources.map(_.generated))
194+ .distinct
199195 .filter(_.last.endsWith(" .java" ))
200196 val command = Seq (
201- (build .options.javaHomeLocation().value / " bin" / s " javadoc $ext" ).toString,
197+ (builds.head .options.javaHomeLocation().value / " bin" / s " javadoc $ext" ).toString,
202198 " -d" ,
203199 destDir.toString,
204200 " -classpath" ,
205- build.fullClassPath.map(_.toString).mkString(File .pathSeparator)
206- ) ++
207- javaSources.map(_.toString)
201+ builds.flatMap(_.fullClassPath).distinct.map(_.toString).mkString(File .pathSeparator)
202+ ) ++ javaSources.map(_.toString)
208203 val retCode = Runner .run(
209204 command,
210205 logger,
211- cwd = Some (build .inputs.workspace)
206+ cwd = Some (builds.head .inputs.workspace)
212207 ).waitFor()
213- if (retCode == 0 )
214- destDir
215- else
216- value(Left (new ScaladocGenerationFailedError (retCode)))
208+ if retCode == 0 then destDir
209+ else value(Left (new ScaladocGenerationFailedError (retCode)))
217210 }
218211 docContentDir
219212 }
0 commit comments