-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Two additions to batch files #13790
Two additions to batch files #13790
Conversation
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.
LGTM
@philwalk would you also take a look? I know you test a lot on Windows |
FWIW, I don't see any problems, although I rarely use these batch files, so I don't fully understand the context. Here's my first naive attempt to evaluate it, from a cygwin bash session: $ git clone [email protected]:michelou/dotty.git win-dotty
$ cd win-dotty
$ git checkout dotty-test-mrJar
$ sbt dist/pack
$ PATH="`pwd -P`/dist/target/pack/bin:$PATH"
$ which scala.bat
/home/philwalk/workspace/win-dotty/dist/target/pack/bin/scala.bat
$ scala.bat `cygpath -w /opt/ue/jsrc/scalacVersion.sc`
Error: Could not find or load main class C:\opt\ue\jsrc\scalacVersion.sc
Caused by: java.lang.ClassNotFoundException: C:\opt\ue\jsrc\scalacVersion.sc
The same test with the bash script went like this: $ bin/scala /opt/ue/jsrc/scalacVersion.sc
scalaHome: C:/Users/philwalk/workspace/win-dotty/dist/target/pack Here's my REPL test from a Windows CMD session: Microsoft Windows [Version 10.0.19042.1288]
(c) Microsoft Corporation. All rights reserved.
C:\Windows\system32>cd \Users\philwalk\workspace\win-dotty
C:\Users\philwalk\workspace\win-dotty>set PATH=c:\Users\philwalk\workspace\win-dotty\dist\target\pack\bin;%PATH%
C:\Users\philwalk\workspace\win-dotty>
C:\Users\philwalk\workspace\win-dotty>scala.bat
Welcome to Scala 3.1.2-RC1-bin-SNAPSHOT-git-387b0a7 (11.0.12, Java Java HotSpot(TM) 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
scala> sys.props("scala.home")
val res0: String = c:\Users\philwalk\workspace\win-dotty\dist\target\pack
scala> That looks correct, and I suspect the PR is good, because the changes are quite minimal, but will continue to experiment. Aha, I discovered the problem with my first experiment, the script name is required to have extension ".scala" in order to be recognized as a script. Here's my successful experiment: C:\Users\philwalk\workspace\win-dotty>scala.bat scalacVersion.scala
scalaHome: c:\Users\philwalk\workspace\win-dotty\dist\target\pack Here's my original cygwin experiment, with the renamed script: $ dist/target/pack/bin/scala.bat scalacVersion.scala
scalaHome: C:\Users\philwalk\workspace\win-dotty\dist\target\pack So everything looks good. |
@smarter Backport candidate to 3.1.1-RC2. |
Does this fix a regression from a previous scala 3 release? Otherwise it's unlikely to be backported. |
@smarter My reasoning is as follows :
In other words the feature "batch files support installation path containing spaces"
The final decision is yours. |
I'm not familiar with this code so I shouldn't decide really :). You can submit a backport and have @anatoliykmetyuk decide since he reviewed this PR already. |
These additions are follow-ups of the two merged pull requests :
dist/bin/scalac.bat
, see PR#13759.dist/bin/scaladoc.bat
, see PR#13577.The changes are Windows-specific and have no impact on the CI build.