@@ -84,7 +84,11 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
8484 jvmIdOpt = baseOptions.javaOptions.jvmIdOpt.orElse {
8585 runMode(options) match {
8686 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))
8892 case RunMode .Default => None
8993 }
9094 }
@@ -122,11 +126,14 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
122126 val shouldDefaultServerFalse =
123127 inputArgs.isEmpty && options0.shared.compilationServer.server.isEmpty &&
124128 ! 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+ )
128135 )
129- )
136+ }
130137 else options0
131138 val initialBuildOptions = {
132139 val buildOptions = buildOptionsOrExit(options)
@@ -170,15 +177,15 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
170177 else {
171178 val processOrCommand : Either [Seq [Seq [String ]], Seq [(Process , Option [() => Unit ])]] = value {
172179 maybeRunOnce(
173- builds,
174- programArgs,
175- logger,
180+ builds = builds ,
181+ args = programArgs,
182+ logger = logger ,
176183 allowExecve = allowTerminate,
177184 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 ,
182189 asJar = options.shared.asJar
183190 )
184191 }
@@ -219,13 +226,17 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
219226 }
220227
221228 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+ )
222233 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
229240 )
230241 if CommandUtils .shouldCheckUpdate then Update .checkUpdateSafe(logger)
231242
@@ -236,6 +247,8 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
236247 )
237248
238249 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..." )
239252 if options.sharedRun.watch.watchMode then {
240253
241254 /** 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 {
403416 .orElse(retainedMainClassesByScope.get(Scope .Test ))
404417 .get
405418 }
419+ logger.debug(s " Retained main class: $mainClass" )
406420 val verbosity = builds.head.options.internal.verbosity.getOrElse(0 ).toString
407421
408422 val (finalMainClass, finalArgs) =
409423 if (jvmRunner) (Constants .runnerMainClass, mainClass +: verbosity +: args)
410424 else (mainClass, args)
425+ logger.debug(s " Final main class: $finalMainClass" )
411426 val res = runOnce(
412427 builds,
413428 finalMainClass,
@@ -424,8 +439,7 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
424439
425440 def pythonPathEnv (dirs : os.Path * ): Map [String , String ] = {
426441 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
429443 }
430444 // Don't add unsafe directories to PYTHONPATH if PYTHONSAFEPATH is set,
431445 // see https://docs.python.org/3/using/cmdline.html#envvar-PYTHONSAFEPATH
@@ -454,12 +468,15 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
454468 scratchDirOpt : Option [os.Path ],
455469 asJar : Boolean
456470 ): 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
459478 .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}" )
463480 val build = builds.head
464481 either {
465482 build.options.platform.value match {
@@ -480,15 +497,15 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
480497 }
481498 val res =
482499 Package .linkJs(
483- builds,
484- jsDest,
485- Some (mainClass),
500+ builds = builds ,
501+ dest = jsDest,
502+ mainClassOpt = Some (mainClass),
486503 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
492509 ).map { outputPath =>
493510 val jsDom = build.options.scalaJsOptions.dom.getOrElse(false )
494511 if (showCommand)
@@ -572,9 +589,9 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
572589 )
573590 else {
574591 val proc = Runner .runNative(
575- launcher.toIO,
576- args,
577- logger,
592+ launcher = launcher .toIO,
593+ args = args ,
594+ logger = logger ,
578595 allowExecve = allowExecve,
579596 extraEnv = extraEnv
580597 )
@@ -634,12 +651,12 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
634651 }
635652 else {
636653 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 ,
643660 allowExecve = allowExecve,
644661 extraEnv = pythonExtraEnv,
645662 useManifest = build.options.notForBloopOptions.runWithManifest,
@@ -650,39 +667,39 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
650667 case mode : RunMode .SparkSubmit =>
651668 value {
652669 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
661678 )
662679 }
663680 case mode : RunMode .StandaloneSparkSubmit =>
664681 value {
665682 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
674691 )
675692 }
676693 case RunMode .HadoopJar =>
677694 value {
678695 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
686703 )
687704 }
688705 }
@@ -706,17 +723,15 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
706723 )(f : os.Path => T ): Either [BuildException , T ] = {
707724 val dest = os.temp(prefix = " main" , suffix = if (esModule) " .mjs" else " .js" )
708725 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))
720735 finally if (os.exists(dest)) os.remove(dest)
721736 }
722737
0 commit comments