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
JLine 3: make sure it works with sbt console
as well as standalone
#678
Comments
at scala/scala#8036 (comment) @dwijnand mentioned "source-breakage of zinc's "console" abstraction of the REPL, which we'd have to address" — what does that mean? |
I'm pretty sure what I meant was "I'm only likely to complain if I see a source-breakage that impacts sbt's |
some further details in scala/scala#8036 (comment) |
I just tested again using scala/scala@2ef554a on Windows 7 VM, and it's still broken. It says "WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)". More importantly, the prompt doesn't accept "1" or enter key. Nothing shows up. Ctrl-C does work, to exit out. I checked to see Scala 2.13.1 REPL using the same setup and that works fine. |
Summarizing what we discussed on Friday JLine jars
2.13 jars
2.12 jars
It looks like the shaded jline was originally added in scala/scala#4563 (ant build) for 2.11.7. The sbt version of this is scala/scala@9debc84dcd. It seems that the repl would only use the shaded jline as a fallback if jline cannot be found on the classpath. I don't know what was the motivation, but it seems to have something to do with spark. |
I got a $160 laptop for Windows testing last November, and I finally set it up to do some testing today. On it, it has a recent Windows 10. Scala 2.13.1
Scala 2.13.2 (JLine 3 branch)
Dotty 0.23.0-RC1
I was hoping that Dotty can run |
Ref scala/scala-dev#678 https://github.com/jline/jline3#jansi-vs-jna says > On the Windows platform, relying on native calls is mandatory, so you need to have either Jansi or JNA library in your classpath along with the `jline-terminal-jansi` or `jline-terminal-jna` jar. When I tested on Windows 7 or Windows 10 using `sbt console` I got "WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)" and key input also didn't work. (This could be more to do with sbt). I am guessing that Jansi used by sbt itself maybe interfering with Jansi that gets loaded from the compiler. Normally these duplicates are resolved by creating a sandbox ClassLoader, but maybe it doesn't exactly work for native libraries loaded into the same process. When I switched to using JNA the console worked ok at least for sbt 1.3.8. ### notes To avoid the interference of dependencies between repl and sbt, maybe sbt needs to switch to forking to a fresh JVM for console, or at least provide an option to do so.
As I wrote on som-snytt/scala#5 I am guessing that Jansi used by sbt itself may be interfering with Jansi that gets loaded from the compiler. Normally these duplicates are resolved by creating a sandbox ClassLoader, but maybe it doesn't exactly work for native libraries loaded into the same process. I wondering if this would go away if we forked for |
Ref scala/scala-dev#678 https://github.com/jline/jline3#jansi-vs-jna says > On the Windows platform, relying on native calls is mandatory, so you need to have either Jansi or JNA library in your classpath along with the `jline-terminal-jansi` or `jline-terminal-jna` jar. When I tested on Windows 7 or Windows 10 using `sbt console` I got "WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)" and key input also didn't work. (This could be more to do with sbt). I am guessing that Jansi used by sbt itself maybe interfering with Jansi that gets loaded from the compiler. Normally these duplicates are resolved by creating a sandbox ClassLoader, but maybe it doesn't exactly work for native libraries loaded into the same process. When I switched to using JNA the console worked ok at least for sbt 1.3.8. To avoid the interference of dependencies between repl and sbt, maybe sbt needs to switch to forking to a fresh JVM for console, or at least provide an option to do so.
@eed3si9n changes on scala/scala#8036 LGTY? |
Goal: avoid conflicting with sbt's own Jansi version Ref scala/scala-dev#678 https://github.com/jline/jline3#jansi-vs-jna says > On the Windows platform, relying on native calls is mandatory, so > you need to have either Jansi or JNA library in your classpath along > with the `jline-terminal-jansi` or `jline-terminal-jna` jar. When I tested on Windows 7 or Windows 10 using `sbt console` I got "WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)" and key input also didn't work. (This could be more to do with sbt). I am guessing that Jansi used by sbt itself maybe interfering with Jansi that gets loaded from the compiler. Normally these duplicates are resolved by creating a sandbox ClassLoader, but maybe it doesn't exactly work for native libraries loaded into the same process. additional changes by Seth: * change Jansi -> JNA in legal info, Intellij config * make REPL's JNA & JLine dependencies optional. most users of scala-compiler.jar just want the compiler and aren't embedding the REPL, so there's no need to pull REPL stuff onto their classpath (and doing so might even cause a conflict. if someone is embedding the REPL and does want JNA, they can take care of adding the optional dependency themselves. Co-authored-by: Seth Tisue <seth@tisue.net>
Goal: avoid conflicting with sbt's own Jansi version Ref scala/scala-dev#678 https://github.com/jline/jline3#jansi-vs-jna says > On the Windows platform, relying on native calls is mandatory, so > you need to have either Jansi or JNA library in your classpath along > with the `jline-terminal-jansi` or `jline-terminal-jna` jar. When I tested on Windows 7 or Windows 10 using `sbt console` I got "WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)" and key input also didn't work. (This could be more to do with sbt). I am guessing that Jansi used by sbt itself maybe interfering with Jansi that gets loaded from the compiler. Normally these duplicates are resolved by creating a sandbox ClassLoader, but maybe it doesn't exactly work for native libraries loaded into the same process. additional changes by Seth: * change Jansi -> JNA in legal info, Intellij config * make REPL's JNA & JLine dependencies optional. most users of scala-compiler.jar just want the compiler and aren't embedding the REPL, so there's no need to pull REPL stuff onto their classpath (and doing so might even cause a conflict. if someone is embedding the REPL and does want JNA, they can take care of adding the optional dependency themselves. Co-authored-by: Seth Tisue <seth@tisue.net>
Goal: avoid conflicting with sbt's own Jansi version Ref scala/scala-dev#678 https://github.com/jline/jline3#jansi-vs-jna says > On the Windows platform, relying on native calls is mandatory, so > you need to have either Jansi or JNA library in your classpath along > with the `jline-terminal-jansi` or `jline-terminal-jna` jar. When I tested on Windows 7 or Windows 10 using `sbt console` I got "WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)" and key input also didn't work. (This could be more to do with sbt). I am guessing that Jansi used by sbt itself maybe interfering with Jansi that gets loaded from the compiler. Normally these duplicates are resolved by creating a sandbox ClassLoader, but maybe it doesn't exactly work for native libraries loaded into the same process. additional changes by Seth: * change Jansi -> JNA in legal info, Intellij config * make REPL's JNA & JLine dependencies optional. most users of scala-compiler.jar just want the compiler and aren't embedding the REPL, so there's no need to pull REPL stuff onto their classpath (and doing so might even cause a conflict. if someone is embedding the REPL and does want JNA, they can take care of adding the optional dependency themselves. Co-authored-by: Seth Tisue <seth@tisue.net>
Goal: avoid conflicting with sbt's own Jansi version Ref scala/scala-dev#678 https://github.com/jline/jline3#jansi-vs-jna says > On the Windows platform, relying on native calls is mandatory, so > you need to have either Jansi or JNA library in your classpath along > with the `jline-terminal-jansi` or `jline-terminal-jna` jar. When I tested on Windows 7 or Windows 10 using `sbt console` I got "WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)" and key input also didn't work. (This could be more to do with sbt). I am guessing that Jansi used by sbt itself maybe interfering with Jansi that gets loaded from the compiler. Normally these duplicates are resolved by creating a sandbox ClassLoader, but maybe it doesn't exactly work for native libraries loaded into the same process. additional changes by Seth: * change Jansi -> JNA in legal info, Intellij config Co-authored-by: Seth Tisue <seth@tisue.net>
@eed3si9n should we close this, or do you want to do some more testing first? |
I guess we can close it. |
sbt uses JLine 2, so it's not exactly difficult to imagine things going wrong
the primary testing should be against sbt 1, but we also shouldn't break sbt 0.13 unless it turns out to be a too-deep rabbithole
cc @eed3si9n
The text was updated successfully, but these errors were encountered: