-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #4066 ./bin/dotr -language:Scala2
fails
#4598
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
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.
Hello, and thank you for opening this PR! 🎉
All contributors have signed the CLA, thank you! ❤️
Have an awesome day! ☀️
I did sign the CLA. |
dist/bin/dotc
Outdated
@@ -95,8 +95,8 @@ case "$1" in | |||
# break out -D and -J options and add them to JAVA_OPTS as well | |||
# so they reach the JVM in time to do some good. The -D options | |||
# will be available as system properties. |
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 comment matches the old behavior ("add them to JAVA_OPTS as well [as to the Scala options]"), could you please update accordingly? I double-checked the code, but I agree with your change.
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 code dates back to scalac script, maybe we should keep it:
case "$1" in
-D*)
# pass to scala as well: otherwise we lose it sometimes when we
# need it, e.g. communicating with a server compiler.
java_args+=("$1")
scala_args+=("$1")
# respect user-supplied -Dscala.usejavacp
case "$1" in -Dscala.usejavacp*) OVERRIDE_USEJAVACP="";; esac
shift
;;
-J*)
# as with -D, pass to scala even though it will almost
# never be used.
java_args+=("${1:2}")
scala_args+=("$1")
shift
;;
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.
Thanks a lot for the contribution @newca12 👍
Once it's ready, we can test it on windows in the following project https://github.com/lampepfl/packtest
dist/bin/dotr
Outdated
# Little hack to check if all arguments are options | ||
all_params="$*" | ||
truncated_params="${*#-}" | ||
not_only_options=$(( ${#all_params} - ${#truncated_params} - $# )) |
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.
Maybe rename not_only_options
to num_of_options
?
dist/bin/dotr
Outdated
@@ -65,7 +74,8 @@ while [[ $# -gt 0 ]]; do | |||
shift | |||
;; | |||
-J*) | |||
addJvmOptions "-${1:2}" | |||
addJvmOptions "${1:2}" | |||
addRawJvmOptions "${1}" |
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.
Maybe rename to something like addJvmOptionsRun/addJvmOptionsRepl
or addJvmOptions/addDotcOptions
, which is more clear?
dist/bin/dotc
Outdated
@@ -95,8 +95,8 @@ case "$1" in | |||
# break out -D and -J options and add them to JAVA_OPTS as well | |||
# so they reach the JVM in time to do some good. The -D options | |||
# will be available as system properties. |
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 code dates back to scalac script, maybe we should keep it:
case "$1" in
-D*)
# pass to scala as well: otherwise we lose it sometimes when we
# need it, e.g. communicating with a server compiler.
java_args+=("$1")
scala_args+=("$1")
# respect user-supplied -Dscala.usejavacp
case "$1" in -Dscala.usejavacp*) OVERRIDE_USEJAVACP="";; esac
shift
;;
-J*)
# as with -D, pass to scala even though it will almost
# never be used.
java_args+=("${1:2}")
scala_args+=("$1")
shift
;;
@Blaisorblade, the real signification of "as well" come from a 8 years old paulp commit scala/scala@80b0d24#diff-eb4553171a4a79a0be4ea69f883e75b2R72 |
Right, that comment hints at |
OK, I agree with you, thanks for the clarification. |
Test succeeded on Linux/Windows/OSX lampepfl/packtest#14 |
Assigning to @liufengyun for merge if he has no further comments. |
Thanks a lot for the contribution @newca12 🎉 |
I was a bit surprise to find dotr and dotc in such bad shape.
The code was and still is a bit fishy but as far as I can see now work in every situation.