Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
implement scalac script in Scala #15212
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
implement scalac script in Scala #15212
Changes from all commits
52a871f
be701d4
a117aff
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same confusion here. This did not use to be special in the old script. Why is it special now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is copied from the Scala script, I think there was the same Cygwin bug there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's related to cygwin; the code and comments appear to be inherited from the scala2 version of the script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these things that the cs runner would be able to pass to
MainGenericRunner
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CS can configure properties, but probably does not have a magic variable for the launch directory (-Dscala.home was copied from the Scala script for use in programs), I don't think it should be supported in CS because the directory structure is not equivalent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some scripts will fail if
-Dscala.home=$PROG_HOME
isn't defined.And there is no simple alternative to figuring out the path to the current runtime scala.
Different scripts can specify different versions of scala via the hashbang line, so environment variables can't be relied on. See #13758
It might not matter for non-script code, although it can be useful there as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've had a look and we can check if the property
coursier.mainJar
is set, which will be the path of the coursier launcher script - we can then use that to setscala.home
to the parent directory. - problem here is that using the native script then scala is ats"${sys.props("scala.home")}/bin/scala"
, but for coursier it iss"${sys.props("scala.home")}/scala"
(we could go one directory above to preserve/bin
but I think this won't work on a custom Coursier install dir. [edit: I checked and for windows the default it also in some/bin
directory])There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idea from @sjrd it could likely be much more useful to provide properties that have the classpath of the scala compiler and scala standard libraries, that can be provided as arguments to the java command, this is more uniform than a fragile directory structure that depends on the package manager.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this suggestion, it would then be possible to find the first scala3-library*.jar in the classpath, and two directories up would be
scala.home
.