File tree Expand file tree Collapse file tree 3 files changed +18
-5
lines changed
modules/cli/src/main/scala/scala/cli Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 11package scala .cli
22
33import bloop .rifle .FailedToStartServerException
4+ import coursier .core .Version
45import sun .misc .{Signal , SignalHandler }
56
67import java .io .{ByteArrayOutputStream , File , PrintStream }
@@ -236,9 +237,13 @@ object ScalaCli {
236237 maybeLauncherOptions = Some (launcherOpts)
237238 launcherOpts.cliVersion.map(_.trim).filter(_.nonEmpty) match {
238239 case Some (ver) =>
239- val powerArgs = launcherOpts.powerOptions.toCliArgs
240- val scalaRunnerArgs = launcherOpts.scalaRunner.toCliArgs
241- val newArgs = powerArgs ++ scalaRunnerArgs ++ args0
240+ val powerArgs = launcherOpts.powerOptions.toCliArgs
241+ val initialScalaRunnerArgs = launcherOpts.scalaRunner
242+ val finalScalaRunnerArgs =
243+ // if the version was specified, it doesn't make sense to check for CLI updates
244+ (if Version (ver) < Version (" 1.4.0" ) then initialScalaRunnerArgs
245+ else initialScalaRunnerArgs.copy(skipCliUpdates = Some (true ))).toCliArgs
246+ val newArgs = powerArgs ++ finalScalaRunnerArgs ++ args0
242247 LauncherCli .runAndExit(ver, launcherOpts, newArgs)
243248 case _ if
244249 javaMajorVersion < 17
Original file line number Diff line number Diff line change @@ -37,7 +37,8 @@ object Version extends ScalaCommand[VersionOptions] {
3737 else if options.scalaVersion then println(defaultScalaVersion)
3838 else {
3939 println(versionInfo)
40- if ! options.offline then
40+ val skipCliUpdates = ScalaCli .launcherOptions.scalaRunner.skipCliUpdates.getOrElse(false )
41+ if ! options.offline && ! skipCliUpdates then
4142 maybeNewerScalaCliVersion.foreach { v =>
4243 logger.message(
4344 s """ Your $fullRunnerName version is outdated. The newest version is $v
Original file line number Diff line number Diff line change @@ -32,7 +32,14 @@ case class ScalaRunnerLauncherOptions(
3232 )
3333 @ Hidden
3434 @ Tag (tags.implementation)
35- progName : Option [String ] = None
35+ progName : Option [String ] = None ,
36+ @ Group (HelpGroup .Launcher .toString)
37+ @ HelpMessage (
38+ " This allows to skip checking for newest Scala CLI versions. --offline covers this scenario as well."
39+ )
40+ @ Hidden
41+ @ Tag (tags.implementation)
42+ skipCliUpdates : Option [Boolean ] = None
3643) {
3744 def toCliArgs : List [String ] =
3845 cliUserScalaVersion.toList.flatMap(v => List (" --cli-default-scala-version" , v)) ++
You can’t perform that action at this time.
0 commit comments