Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log scala-cli version when --log-cli-version is enabled #3614

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

yadavan88
Copy link
Contributor

Implementation for #3598

@Gedochao Gedochao self-requested a review April 4, 2025 11:09
progress: Option[Boolean] = None,
@Group(HelpGroup.Logging.toString)
@Tag(tags.implementation)
@HelpMessage("Logs scala-cli version on project build")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@HelpMessage("Logs scala-cli version on project build")
@HelpMessage(s"Logs ${scala.cli.ScalaCli.fullRunnerName} version alongside JVM and Scala versions when the project gets recompiled by the server.")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it still feels hyper-granular to have a command line option just for that... wouldn't it be better to print this when verbosity is set to +1? (as in, just a single -v)
If we can live without this command line option, I guess I'd rather not have it.
tagging @tgodzik for second opinion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, probably too less info for a separate flag. I think it is alos fine with -v. Additionally, it might be good if the scala-cli version is also added to buildinfo, so that in cases such as mine, I can explicitly log this info using the buildinfo.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, adding it to BuildInfo is a good idea, I think.
Feel free to do it in a separate PR (or make a new issue).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me see if I can create a separate PR with adding this info in the buildinfo. Reg -v, let me know. It would still be nice to see this info without making any code change in the scripts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Gedochao I created a new PR
#3617

val params = value(options0.scalaParams)

val scopeParams =
if (scope == Scope.Main) Nil
else Seq(scope.name)

buildClient.setProjectParams(scopeParams ++ value(options0.projectParams))
val scalaCliVersionLog =
if options0.internal.logCliVersion then Seq(s"scala-cli ${Constants.version}") else Nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't use scala-cli here, as contextually it may be just scala. What you actually need is scala.cli.ScalaCli.fullRunnerName... which is unfortunate, since you log it in the build module.
You could maybe pass it via scala.build.input.ScalaCliInvokeData... See how it's passed around in the code elsewhere. I wonder if scala.build.input.ScalaCliInvokeData.progName would be enough...

I'm thinking this would look awkward:

Compiling project (Scala 3.7.0 JVM (17), scala 1.7.1)

We should have the full runner name, so:

Compiling project (Scala 3.7.0 JVM (17), Scala code runner  1.7.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants