On Tue, 25 Jun 2013 14:58:51 -0400
Josh Suereth <
joshua....@gmail.com> wrote:
> So, for those who may not be aware, there's a conflation of Jline/Jansi
> versions out there that are causing issues for windows users. In
> particular, it seems solving these contraints all at the same time to be
> nigh impossible currently:
>
>
> - Autocomplete/jline features working in cygwin
> - Autocomplete/jline features working in cmd.exe
> - ANSI colors working in cygwin
> - ANSI colors working in cmd.exe
>
>
> SO far, it seems we can pick at best 3 of 4 here. IN particular, here's my
> findings after nearly going mad:
>
>
> - ANSI coloring in cmd.exe requires JANSI to install its hooks before
> any output. Due to the way classloading, native libraries + sbt reboot
> work, we need this to happen in a classloader *below* the sbt classloader
> (like the launcher) where we can instantiate jline (but only when running
> in cmd.exe), and ensure that anyone using jline has to use this version of
> JANSI (a potential dependency conflict that seems to not have arisen yet).
> - ANSI coloring anywhere else is broken if you ask JANSI to install its
> native hooks, for some reason.
> - While jline's unix terminal works for cygwin, you have to manually run
> STTY calls external to the JVM, because java.exe is unable to fork off
> cygwin processes, and does not see its PATH correctly.
> - Scala 2.10.x and previous "shade" the jline library, so that we cannot
> specify "unix" terminal to both the scala console *and* to the sbt 0.12.x
> (and previous) jline library at the same time. This means cygwin users
> need to either go without (why would you use cygwin if not for good
> terminal)? For sbt 0.13, we can just use -Djline.terminal=unix and
> everything is gravy.
So, it sounds like for 0.13:
* on non-cygwin Windows,
+ need to have JAnsi on the same classpath as sbt and not the launcher. The situation here is not clear to me.
+ need to call systemInstall. This changes System.out to something that supports ansi codes. Presumably, systemUninstall needs to be called before 'reboot'.
* due to JAnsi using a native library and presumably loading it in a non-standard way (not via System.loadLibrary), it is not possible to address issues arising from it being used in multiple locations, such as after a 'reboot'.
* on cygwin
+ need to wrap the call to 'java' in stty commands to properly set up the terminal. This can't be done in sbt itself because being a Java process, it can't launch cygwin commands and 'stty' is a cygwin command.
+ set -Djline.terminal=unix in order to configure both Scala (<2.11)'s JLine and normal JLine to use the right terminal, which is not properly auto-detected by jline
* on unix
+ no native libraries are involved
+ stty is on the standard path
So, unix is fine. cygwin has a plausible solution, although users will have to change their startup scripts and perhaps sbt should warn if jline.terminal=jline.UnixTerminal and/or possibly correct it.
non-cygwin Windows is the problem that requires further consideration. It seems to be independent of the others, though. There aren't tradeoffs that affect other platforms as long as cygwin can be detected. (From other discussions, detection might not be straightforward.). What I don't understand are the requirements surrounding JAnsi and its native libraries.
1. Where in the class loader hierarchy does JAnsi need to exist and why?
2. How does JAnsi load its native library?
3. Does JLine interact with JAnsi directly or does it just need JAnsi to wrap System.out?
4. If JLine interacts directly with JAnsi, how and why does it do so?
> For SBT 0.13 we'd like to find a way to get all the above features working
> without using too many custom script hacks. Right now sbt.msi is using a
> script hack so that when you call the .bat file, you're using an
> alternative launcher that helps JANSI work correctly in cmd.exe. I'm
> writing to elicit some conversation about possible alternatives here that
> could help us resolve the situation in 0.13.
>
> Thoughts welcome! I'm at the stage I feel we should just abandon coloring
> in cmd.exe until we find a better alternative.
I'm not there yet, probably because you've absorbed most of the madness (thanks!). I'll look into the questions I have before conceding. What is the status quo? Does 0.12 handle both coloring and tab completion for both sbt and Scala prompts on cmd.exe (independent of the quality of hacks that achieve this!)?
-Mark
> - Josh
>
> --
> You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
simple-build-t...@googlegroups.com.
> To post to this group, send email to
simple-b...@googlegroups.com.
> Visit this group at
http://groups.google.com/group/simple-build-tool.
> For more options, visit
https://groups.google.com/groups/opt_out.
>
>