Skip to content

Commit acca7b1

Browse files
committed
Support the --test flag with the publish & publish local sub-commands
1 parent fdd08e1 commit acca7b1

File tree

9 files changed

+353
-289
lines changed

9 files changed

+353
-289
lines changed

modules/build/src/main/scala/scala/build/Build.scala

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -318,13 +318,13 @@ object Build {
318318

319319
val baseOptions = overrideOptions.orElse(sharedOptions)
320320

321-
val scopedSources = value(crossSources.scopedSources(baseOptions))
321+
val scopedSources: ScopedSources = value(crossSources.scopedSources(baseOptions))
322322

323-
val mainSources =
323+
val mainSources: Sources =
324324
value(scopedSources.sources(Scope.Main, baseOptions, inputs.workspace, logger))
325325
val mainOptions = mainSources.buildOptions
326326

327-
val testSources =
327+
val testSources: Sources =
328328
value(scopedSources.sources(Scope.Test, baseOptions, inputs.workspace, logger))
329329
val testOptions = testSources.buildOptions
330330

@@ -370,9 +370,7 @@ object Build {
370370

371371
def testBuildOpt(doc: Boolean = false): Either[BuildException, Option[Build]] = either {
372372
if (buildTests) {
373-
val actualCompilerOpt =
374-
if (doc) docCompilerOpt
375-
else Some(compiler)
373+
val actualCompilerOpt = if doc then docCompilerOpt else Some(compiler)
376374
actualCompilerOpt match {
377375
case None => None
378376
case Some(actualCompiler) =>
@@ -676,10 +674,8 @@ object Build {
676674
): Either[BuildException, Unit] = {
677675
val (errors, otherDiagnostics) = options.validate.partition(_.severity == Severity.Error)
678676
logger.log(otherDiagnostics)
679-
if (errors.nonEmpty)
680-
Left(CompositeBuildException(errors.map(new ValidationException(_))))
681-
else
682-
Right(())
677+
if errors.nonEmpty then Left(CompositeBuildException(errors.map(new ValidationException(_))))
678+
else Right(())
683679
}
684680

685681
def watch(

0 commit comments

Comments
 (0)