@@ -114,7 +114,7 @@ object Doc extends ScalaCommand[DocOptions] {
114
114
115
115
value(alreadyExistsCheck())
116
116
117
- val docJarPath = value(generateScaladocDirPath(build, logger, extraArgs))
117
+ val docJarPath = value(generateScaladocDirPath(Seq ( build) , logger, extraArgs))
118
118
value(alreadyExistsCheck())
119
119
if (force) os.copy.over(docJarPath, destPath)
120
120
else os.copy(docJarPath, destPath)
@@ -136,84 +136,77 @@ object Doc extends ScalaCommand[DocOptions] {
136
136
)
137
137
138
138
def generateScaladocDirPath (
139
- build : Build .Successful ,
139
+ builds : Seq [ Build .Successful ] ,
140
140
logger : Logger ,
141
141
extraArgs : Seq [String ]
142
142
): Either [BuildException , os.Path ] = either {
143
- val docContentDir = build .scalaParams match {
143
+ val docContentDir = builds.head .scalaParams match {
144
144
case Some (scalaParams) if scalaParams.scalaVersion.startsWith(" 2." ) =>
145
- build .project.scaladocDir
145
+ builds.head .project.scaladocDir
146
146
case Some (scalaParams) =>
147
147
val res = value {
148
148
Artifacts .fetchAnyDependencies(
149
149
Seq (Positioned .none(dep " org.scala-lang::scaladoc: ${scalaParams.scalaVersion}" )),
150
- value(build .options.finalRepositories),
150
+ value(builds.head .options.finalRepositories),
151
151
Some (scalaParams),
152
152
logger,
153
- build .options.finalCache,
153
+ builds.head .options.finalCache,
154
154
None
155
155
)
156
156
}
157
- val destDir = build .project.scaladocDir
157
+ val destDir = builds.head .project.scaladocDir
158
158
os.makeDir.all(destDir)
159
- val ext = if ( Properties .isWin) " .exe" else " "
159
+ val ext = if Properties .isWin then " .exe" else " "
160
160
val baseArgs = Seq (
161
161
" -classpath" ,
162
- build. fullClassPath.map(_.toString).mkString(File .pathSeparator),
162
+ builds.flatMap(_. fullClassPath).distinct .map(_.toString).mkString(File .pathSeparator),
163
163
" -d" ,
164
164
destDir.toString
165
165
)
166
166
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
175
171
val args = baseArgs ++
176
- build .project.scalaCompiler.map(_.scalacOptions).getOrElse(Nil ) ++
172
+ builds.head .project.scalaCompiler.map(_.scalacOptions).getOrElse(Nil ) ++
177
173
extraArgs ++
178
174
defaultArgs ++
179
- Seq (build .output.toString)
175
+ builds.map(_ .output.toString)
180
176
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,
182
178
Nil , // FIXME Allow to customize that?
183
179
res.files.map(os.Path (_, os.pwd)),
184
180
" dotty.tools.scaladoc.Main" ,
185
181
args,
186
182
logger,
187
- cwd = Some (build .inputs.workspace)
183
+ cwd = Some (builds.head .inputs.workspace)
188
184
).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)))
193
187
case None =>
194
- val destDir = build .project.scaladocDir
188
+ val destDir = builds.head .project.scaladocDir
195
189
os.makeDir.all(destDir)
196
190
val ext = if (Properties .isWin) " .exe" else " "
197
191
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
199
195
.filter(_.last.endsWith(" .java" ))
200
196
val command = Seq (
201
- (build .options.javaHomeLocation().value / " bin" / s " javadoc $ext" ).toString,
197
+ (builds.head .options.javaHomeLocation().value / " bin" / s " javadoc $ext" ).toString,
202
198
" -d" ,
203
199
destDir.toString,
204
200
" -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)
208
203
val retCode = Runner .run(
209
204
command,
210
205
logger,
211
- cwd = Some (build .inputs.workspace)
206
+ cwd = Some (builds.head .inputs.workspace)
212
207
).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)))
217
210
}
218
211
docContentDir
219
212
}
0 commit comments