File tree 3 files changed +18
-5
lines changed
modules/cli/src/main/scala/scala/cli
3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 1
1
package scala .cli
2
2
3
3
import bloop .rifle .FailedToStartServerException
4
+ import coursier .core .Version
4
5
import sun .misc .{Signal , SignalHandler }
5
6
6
7
import java .io .{ByteArrayOutputStream , File , PrintStream }
@@ -236,9 +237,13 @@ object ScalaCli {
236
237
maybeLauncherOptions = Some (launcherOpts)
237
238
launcherOpts.cliVersion.map(_.trim).filter(_.nonEmpty) match {
238
239
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
242
247
LauncherCli .runAndExit(ver, launcherOpts, newArgs)
243
248
case _ if
244
249
javaMajorVersion < 17
Original file line number Diff line number Diff line change @@ -37,7 +37,8 @@ object Version extends ScalaCommand[VersionOptions] {
37
37
else if options.scalaVersion then println(defaultScalaVersion)
38
38
else {
39
39
println(versionInfo)
40
- if ! options.offline then
40
+ val skipCliUpdates = ScalaCli .launcherOptions.scalaRunner.skipCliUpdates.getOrElse(false )
41
+ if ! options.offline && ! skipCliUpdates then
41
42
maybeNewerScalaCliVersion.foreach { v =>
42
43
logger.message(
43
44
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(
32
32
)
33
33
@ Hidden
34
34
@ 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
36
43
) {
37
44
def toCliArgs : List [String ] =
38
45
cliUserScalaVersion.toList.flatMap(v => List (" --cli-default-scala-version" , v)) ++
You can’t perform that action at this time.
0 commit comments