@@ -84,7 +84,11 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
84
84
jvmIdOpt = baseOptions.javaOptions.jvmIdOpt.orElse {
85
85
runMode(options) match {
86
86
case _ : RunMode .Spark | RunMode .HadoopJar =>
87
- Some (Positioned .none(" 8" ))
87
+ val sparkOrHadoopDefaultJvm = " 8"
88
+ logger.message(
89
+ s " Defaulting the JVM to $sparkOrHadoopDefaultJvm for Spark/Hadoop runs. "
90
+ )
91
+ Some (Positioned .none(sparkOrHadoopDefaultJvm))
88
92
case RunMode .Default => None
89
93
}
90
94
}
@@ -122,11 +126,14 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
122
126
val shouldDefaultServerFalse =
123
127
inputArgs.isEmpty && options0.shared.compilationServer.server.isEmpty &&
124
128
! options0.shared.hasSnippets
125
- val options = if (shouldDefaultServerFalse) options0.copy(shared =
126
- options0.shared.copy(compilationServer =
127
- options0.shared.compilationServer.copy(server = Some (false ))
129
+ val options = if (shouldDefaultServerFalse) {
130
+ logger.debug(" No inputs provided, skipping the build server." )
131
+ options0.copy(shared =
132
+ options0.shared.copy(compilationServer =
133
+ options0.shared.compilationServer.copy(server = Some (false ))
134
+ )
128
135
)
129
- )
136
+ }
130
137
else options0
131
138
val initialBuildOptions = {
132
139
val buildOptions = buildOptionsOrExit(options)
@@ -170,15 +177,15 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
170
177
else {
171
178
val processOrCommand : Either [Seq [Seq [String ]], Seq [(Process , Option [() => Unit ])]] = value {
172
179
maybeRunOnce(
173
- builds,
174
- programArgs,
175
- logger,
180
+ builds = builds ,
181
+ args = programArgs,
182
+ logger = logger ,
176
183
allowExecve = allowTerminate,
177
184
jvmRunner = builds.exists(_.artifacts.hasJvmRunner),
178
- potentialMainClasses,
179
- runMode,
180
- showCommand,
181
- scratchDirOpt,
185
+ potentialMainClasses = potentialMainClasses ,
186
+ runMode = runMode ,
187
+ showCommand = showCommand ,
188
+ scratchDirOpt = scratchDirOpt ,
182
189
asJar = options.shared.asJar
183
190
)
184
191
}
@@ -219,13 +226,17 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
219
226
}
220
227
221
228
val cross = options.sharedRun.compileCross.cross.getOrElse(false )
229
+ if cross then
230
+ logger.log(
231
+ " Cross builds enabled, preparing all builds for all Scala versions and platforms..."
232
+ )
222
233
SetupIde .runSafe(
223
- options.shared,
224
- inputs,
225
- logger,
226
- initialBuildOptions,
227
- Some (name),
228
- inputArgs
234
+ options = options .shared,
235
+ inputs = inputs ,
236
+ logger = logger ,
237
+ buildOptions = initialBuildOptions,
238
+ previousCommandName = Some (name),
239
+ args = inputArgs
229
240
)
230
241
if CommandUtils .shouldCheckUpdate then Update .checkUpdateSafe(logger)
231
242
@@ -236,6 +247,8 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
236
247
)
237
248
238
249
val shouldBuildTestScope = options.shared.scope.test.getOrElse(false )
250
+ if shouldBuildTestScope then
251
+ logger.log(" Test scope enabled, including test scope inputs on the classpath..." )
239
252
if options.sharedRun.watch.watchMode then {
240
253
241
254
/** A handle to the Runner processes, used to kill the process if it's still alive when a
@@ -403,11 +416,13 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
403
416
.orElse(retainedMainClassesByScope.get(Scope .Test ))
404
417
.get
405
418
}
419
+ logger.debug(s " Retained main class: $mainClass" )
406
420
val verbosity = builds.head.options.internal.verbosity.getOrElse(0 ).toString
407
421
408
422
val (finalMainClass, finalArgs) =
409
423
if (jvmRunner) (Constants .runnerMainClass, mainClass +: verbosity +: args)
410
424
else (mainClass, args)
425
+ logger.debug(s " Final main class: $finalMainClass" )
411
426
val res = runOnce(
412
427
builds,
413
428
finalMainClass,
@@ -424,8 +439,7 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
424
439
425
440
def pythonPathEnv (dirs : os.Path * ): Map [String , String ] = {
426
441
val onlySafePaths = sys.env.exists {
427
- case (k, v) =>
428
- k.toLowerCase(Locale .ROOT ) == " pythonsafepath" && v.nonEmpty
442
+ case (k, v) => k.toLowerCase(Locale .ROOT ) == " pythonsafepath" && v.nonEmpty
429
443
}
430
444
// Don't add unsafe directories to PYTHONPATH if PYTHONSAFEPATH is set,
431
445
// see https://docs.python.org/3/using/cmdline.html#envvar-PYTHONSAFEPATH
@@ -454,12 +468,15 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
454
468
scratchDirOpt : Option [os.Path ],
455
469
asJar : Boolean
456
470
): Either [BuildException , Either [Seq [Seq [String ]], Seq [(Process , Option [() => Unit ])]]] = {
457
- allBuilds
458
- .groupedByCrossParams.toSeq
471
+ val crossBuilds = allBuilds.groupedByCrossParams.toSeq
472
+ val shouldLogCrossInfo = crossBuilds.size > 1
473
+ if shouldLogCrossInfo then
474
+ logger.log(
475
+ s " Running ${crossBuilds.size} cross builds, one for each Scala version and platform combination. "
476
+ )
477
+ crossBuilds
459
478
.map { (crossBuildParams, builds) =>
460
- logger.debug(
461
- s " Running build for Scala ' ${crossBuildParams.scalaVersion}' and platform ' ${crossBuildParams.platform}' "
462
- )
479
+ if shouldLogCrossInfo then logger.debug(s " Running build for ${crossBuildParams.asString}" )
463
480
val build = builds.head
464
481
either {
465
482
build.options.platform.value match {
@@ -480,15 +497,15 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
480
497
}
481
498
val res =
482
499
Package .linkJs(
483
- builds,
484
- jsDest,
485
- Some (mainClass),
500
+ builds = builds ,
501
+ dest = jsDest,
502
+ mainClassOpt = Some (mainClass),
486
503
addTestInitializer = false ,
487
- linkerConfig,
488
- value(build.options.scalaJsOptions.fullOpt),
489
- build.options.scalaJsOptions.noOpt.getOrElse(false ),
490
- logger,
491
- scratchDirOpt
504
+ config = linkerConfig,
505
+ fullOpt = value(build.options.scalaJsOptions.fullOpt),
506
+ noOpt = build.options.scalaJsOptions.noOpt.getOrElse(false ),
507
+ logger = logger ,
508
+ scratchDirOpt = scratchDirOpt
492
509
).map { outputPath =>
493
510
val jsDom = build.options.scalaJsOptions.dom.getOrElse(false )
494
511
if (showCommand)
@@ -572,9 +589,9 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
572
589
)
573
590
else {
574
591
val proc = Runner .runNative(
575
- launcher.toIO,
576
- args,
577
- logger,
592
+ launcher = launcher .toIO,
593
+ args = args ,
594
+ logger = logger ,
578
595
allowExecve = allowExecve,
579
596
extraEnv = extraEnv
580
597
)
@@ -634,12 +651,12 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
634
651
}
635
652
else {
636
653
val proc = Runner .runJvm(
637
- build.options.javaHome().value.javaCommand,
638
- allJavaOpts,
639
- builds.flatMap(_.fullClassPathMaybeAsJar(asJar)).distinct,
640
- mainClass,
641
- args,
642
- logger,
654
+ javaCommand = build.options.javaHome().value.javaCommand,
655
+ javaArgs = allJavaOpts,
656
+ classPath = builds.flatMap(_.fullClassPathMaybeAsJar(asJar)).distinct,
657
+ mainClass = mainClass ,
658
+ args = args ,
659
+ logger = logger ,
643
660
allowExecve = allowExecve,
644
661
extraEnv = pythonExtraEnv,
645
662
useManifest = build.options.notForBloopOptions.runWithManifest,
@@ -650,39 +667,39 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
650
667
case mode : RunMode .SparkSubmit =>
651
668
value {
652
669
RunSpark .run(
653
- builds,
654
- mainClass,
655
- args,
656
- mode.submitArgs,
657
- logger,
658
- allowExecve,
659
- showCommand,
660
- scratchDirOpt
670
+ builds = builds ,
671
+ mainClass = mainClass ,
672
+ args = args ,
673
+ submitArgs = mode.submitArgs,
674
+ logger = logger ,
675
+ allowExecve = allowExecve ,
676
+ showCommand = showCommand ,
677
+ scratchDirOpt = scratchDirOpt
661
678
)
662
679
}
663
680
case mode : RunMode .StandaloneSparkSubmit =>
664
681
value {
665
682
RunSpark .runStandalone(
666
- builds,
667
- mainClass,
668
- args,
669
- mode.submitArgs,
670
- logger,
671
- allowExecve,
672
- showCommand,
673
- scratchDirOpt
683
+ builds = builds ,
684
+ mainClass = mainClass ,
685
+ args = args ,
686
+ submitArgs = mode.submitArgs,
687
+ logger = logger ,
688
+ allowExecve = allowExecve ,
689
+ showCommand = showCommand ,
690
+ scratchDirOpt = scratchDirOpt
674
691
)
675
692
}
676
693
case RunMode .HadoopJar =>
677
694
value {
678
695
RunHadoop .run(
679
- builds,
680
- mainClass,
681
- args,
682
- logger,
683
- allowExecve,
684
- showCommand,
685
- scratchDirOpt
696
+ builds = builds ,
697
+ mainClass = mainClass ,
698
+ args = args ,
699
+ logger = logger ,
700
+ allowExecve = allowExecve ,
701
+ showCommand = showCommand ,
702
+ scratchDirOpt = scratchDirOpt
686
703
)
687
704
}
688
705
}
@@ -706,17 +723,15 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
706
723
)(f : os.Path => T ): Either [BuildException , T ] = {
707
724
val dest = os.temp(prefix = " main" , suffix = if (esModule) " .mjs" else " .js" )
708
725
try Package .linkJs(
709
- builds,
710
- dest,
711
- mainClassOpt,
712
- addTestInitializer,
713
- config,
714
- fullOpt,
715
- noOpt,
716
- logger
717
- ).map { outputPath =>
718
- f(outputPath)
719
- }
726
+ builds = builds,
727
+ dest = dest,
728
+ mainClassOpt = mainClassOpt,
729
+ addTestInitializer = addTestInitializer,
730
+ config = config,
731
+ fullOpt = fullOpt,
732
+ noOpt = noOpt,
733
+ logger = logger
734
+ ).map(outputPath => f(outputPath))
720
735
finally if (os.exists(dest)) os.remove(dest)
721
736
}
722
737
0 commit comments