scala-cli icon indicating copy to clipboard operation
scala-cli copied to clipboard

Additional logging of the scala/java/scala-cli versions

Open yadavan88 opened this issue 9 months ago • 4 comments

Is your feature request related to a problem? Please describe. When a scala-cli project is compiled for the first time(or recompiled after change), it shows the scala version and the jdk version. If there is no change in the code, on the next runs, it doesn't log this info. Furthermore, this doesn't show the scala-cli version in the log. Attaching the screenshot of the output I get when I run a file

Image

Describe the solution you'd like It would be nice if there is an option or a directive or something like it that could show these info all the time(since the default behaviour is not to have too many logs and lose focus for most people). When working with multiple JDKs and Scala Versions, it would be beneficial to always see which scala and jdk is used to run the program just as a reminder. Also, unless someone remembers to update the scala-cli version, one might use the older version of scala-cli without realizing. For example, I was using 1.5.x in one of my laptops when the current version is 1.7.x. Seeing an info about the versions used might give an hint to check if these are the expected/intereted versions.

Describe alternatives you've considered Clean compile and manually checking the scal-cli version once in a while

Additional context In discord, the suggestion is to have less logs as the preferred method, but an option to have additional important logs might be nice.

yadavan88 avatar Mar 31 '25 08:03 yadavan88

What I think we could do:

  • at increased verbosity (behing a single -v flag), log Scala / JVM versions even when no re-compilation happens
    • we currently only do it with Bloop; we probably could also log the information with --server=false
  • we could have a dedicated verbosity flag (--log-cli-version?) and/or global config (log-cli-version) for logging the CLI version as well (or, alternatively, also do it at increased verbosity, perhaps at -v -v)

Gedochao avatar Mar 31 '25 08:03 Gedochao

Is this verbocity flag be added as a directive? I mean in some of my scripts, I want to ensure that this info is always logged. I prefer to keep all as directives in the file (even commented out, so that i can enable it later if needed and don't need to remember the flags or search in internet to find out)

yadavan88 avatar Mar 31 '25 08:03 yadavan88

Is this verbocity flag be added as a directive? I mean in some of my scripts, I want to ensure that this info is always logged.

As a rule, verbosity can't (and shouldn't) be configured by directives.

@yadavan88 In that case, for your use case, perhaps you'd like to print the information you need yourself and control it in the script. Then it doesn't have to be controlled by verbosity (which many want to keep at a minimum). You can use BuildInfo to get the build data you need, as per https://scala-cli.virtuslab.org/docs/reference/build-info

I think the CLI version is missing from the BuildInfo object. If that would fit your use case, feel free to raise an issue for that, separately.

Gedochao avatar Mar 31 '25 08:03 Gedochao

Sure, reg the full verbocity, I will try to add it using buildInfo. I guess scala-cli version and scala/java is still be nice to be added as part of -v

yadavan88 avatar Mar 31 '25 08:03 yadavan88