@@ -318,13 +318,13 @@ object Build {
318
318
319
319
val baseOptions = overrideOptions.orElse(sharedOptions)
320
320
321
- val scopedSources = value(crossSources.scopedSources(baseOptions))
321
+ val scopedSources : ScopedSources = value(crossSources.scopedSources(baseOptions))
322
322
323
- val mainSources =
323
+ val mainSources : Sources =
324
324
value(scopedSources.sources(Scope .Main , baseOptions, inputs.workspace, logger))
325
325
val mainOptions = mainSources.buildOptions
326
326
327
- val testSources =
327
+ val testSources : Sources =
328
328
value(scopedSources.sources(Scope .Test , baseOptions, inputs.workspace, logger))
329
329
val testOptions = testSources.buildOptions
330
330
@@ -370,9 +370,7 @@ object Build {
370
370
371
371
def testBuildOpt (doc : Boolean = false ): Either [BuildException , Option [Build ]] = either {
372
372
if (buildTests) {
373
- val actualCompilerOpt =
374
- if (doc) docCompilerOpt
375
- else Some (compiler)
373
+ val actualCompilerOpt = if doc then docCompilerOpt else Some (compiler)
376
374
actualCompilerOpt match {
377
375
case None => None
378
376
case Some (actualCompiler) =>
@@ -384,7 +382,14 @@ object Build {
384
382
extraClassPath = Seq (s.output)
385
383
)
386
384
)
387
- val testOptions0 = extraTestOptions.orElse(testOptions)
385
+ val testOptions0 = {
386
+ val testOrExtra = extraTestOptions.orElse(testOptions)
387
+ testOrExtra
388
+ .copy(scalaOptions =
389
+ // Scala options between scopes need to be compatible
390
+ mainOptions.scalaOptions.orElse(testOrExtra.scalaOptions)
391
+ )
392
+ }
388
393
val isScala2 =
389
394
value(testOptions0.scalaParams).exists(_.scalaVersion.startsWith(" 2." ))
390
395
val finalSources = if doc && isScala2 then
@@ -676,10 +681,8 @@ object Build {
676
681
): Either [BuildException , Unit ] = {
677
682
val (errors, otherDiagnostics) = options.validate.partition(_.severity == Severity .Error )
678
683
logger.log(otherDiagnostics)
679
- if (errors.nonEmpty)
680
- Left (CompositeBuildException (errors.map(new ValidationException (_))))
681
- else
682
- Right (())
684
+ if errors.nonEmpty then Left (CompositeBuildException (errors.map(new ValidationException (_))))
685
+ else Right (())
683
686
}
684
687
685
688
def watch (
0 commit comments