Commit Graph

9995 Commits

Author SHA1 Message Date
Eugene Yokota 7956528f25 Publish sbt-dependency-tree Maven style 2020-09-23 00:42:14 -04:00
Ethan Atkins bfc154e7dd
Merge pull request #5883 from eed3si9n/wip/mini_dependencygraph
Split to MiniDependencyTreePlugin
2020-09-22 19:21:59 -07:00
Eugene Yokota 8d52db3bfe Mima 2020-09-22 21:47:38 -04:00
Eugene Yokota 4fe2f8eff1 Split to MiniDependencyTreePlugin
Ref https://github.com/sbt/sbt/pull/5880

This split the dependency-graph plugin into MiniDependencyTreePlugin and DependencyTreePlugin.
2020-09-22 21:21:01 -04:00
eugene yokota 54747b88bb
Merge pull request #5881 from eed3si9n/wip/bump
lm 1.4.0-M12, Zinc 1.4.0-M13, launcher 1.1.5
2020-09-22 08:34:20 -04:00
Eugene Yokota eb8498a026 launcher 1.1.5 2020-09-21 23:52:48 -04:00
Eugene Yokota e1b64f7e5b lm 1.4.0-M12, Zinc 1.4.0-M13 2020-09-21 23:47:34 -04:00
eugene yokota 602cf392a6
Merge pull request #5880 from eed3si9n/wip/dependencygraph
in-sources sbt-dependency-graph
2020-09-21 22:56:10 -04:00
eugene yokota 23fd24c838
Merge pull request #5874 from eatkins/terminal-fixes
Fix a number of terminal io bugs
2020-09-21 22:19:39 -04:00
eugene yokota c2e81a23a0
Merge pull request #5876 from eed3si9n/wip/bat
sbt.cmd -> sbt.bat and --sbt-script update
2020-09-21 22:18:33 -04:00
Eugene Yokota 17b75453b5 In-source sbt-dependency-graph
Ref https://github.com/sbt/sbt-dependency-graph/issues/178

This in-sources sbt-dependency-graph.
2020-09-21 21:43:16 -04:00
Ethan Atkins 54f8ef8352 Catch io errors in (enter|exit)RawMode
In a continuous build with rapid triggers, it's possible for the input
thread to be interrupted before it has completed the transition into raw
mode. This isn't a big deal because it will be reset when we enter the
next build or when we re-enter the shell.
2020-09-21 16:03:19 -07:00
Ethan Atkins 025aff625b Use jansi terminal if available
The jansi terminal is a little nicer than the jna terminal in windows in
my opinion. In the jna terminal, tab completions use overscores instead
of inverting the colors for the highlighted completion string.
2020-09-21 13:45:36 -07:00
Ethan Atkins 036fef3383 Fix end, delete and insert keys on windows
The ansi.caps file doesn't contain any bindings for delete, end or
insert keys. To work around that, we specifiy the defaults in the
WindowsInputStream and override the terminal's getStringCapability
method in the wrapped jline 3 terminal that we pass to the jline 3 line
reader.
2020-09-21 13:45:36 -07:00
Ethan Atkins 7391e9ccae Fix windows special key bindings
The keyState variable that I had taken from the jline 3
AbstractWindowsTerminal was not correctly set which caused the jline
reader to interpret a number of system key events as random strings
rather than escape codes. The arrow keys, for example, did not work.
After setting the keyState variable
2020-09-21 13:42:04 -07:00
Ethan Atkins ddb626a9be Allow users to configure standard input setting
Certain tasks may prefer to have the input set to raw mode and/or have
echo off. The specific use case is that it is difficult to get the
ammonite console to work correctly with the thin client. The problem is
that the ammonite console runs some tty commands. These commands will
only work on the tty of the thin client when the thin client itself has
launched the sbt server session (since they share the same tty). Once
the thin client that launched the server exits, the ammonite console
will never work again with that server session. A workaround is to
launch sbt separately and leave that server session open. Then, if the
run task is configured with canonical input set to false and echo
disabled, the thin client will work. In the future, it's possible that
ammonite could be updated to not rely on calling stty commands and then
the thin client could work with the ammonite console even after the
initial thin client session has exited provided canonical input and echo
are disabled.
2020-09-21 13:42:04 -07:00
Ethan Atkins 0427e5f9c5 Add timeouts for completion prompts
CI hung in the server test that checks completions because I broke
reading from the System.in. It occurred to me that we probably shouldn't
prompt indefinitely when the user is running tab completions anyway so I
set a timeout of 5 seconds for the user to respond to input. If they
decline to start a server within the timeout, we will just exit. If they
decline to run compilation within the timeout we just skip the
compilation step (so test or main class names will not be provided for
completions).
2020-09-21 13:42:03 -07:00
Ethan Atkins bb8b9a1c99 Fix switching between raw and canonical input
There were a number of issues with swithcing between raw and canonical
issues that affected both the server and the thin client. These were
reported in #5863 and #5856. In both cases, there were issues with
reading input or having the input be displayed. Debugging those issues
revealed a number of issues with how we were using the jline 3 system
terminal and the hybrid interaction with the jline 2 terminal. This
commit eliminates all of our internal jline 2 usage. The only remaining
jline 2 usage is that we create and override the global terminal for the
scala console for scala versions < 2.13. By moving away from jline 2, I
was also able to fix #5828, which reported that the home, end and delete
keys were not working.

One of the big issues that this commit addresses is that the
NetworkClient was always performing blocking reads on System.in. This
was problematic because it turns out that you can't switch between raw
and canonical modes when there is a read present. To fix this, the
server now sends a message to the client when it wants to read bytes and
only then does the client create a background thread to read a single
byte.

I also figured out how to set the terminal type properly for the thin
client on windows where we had been manually setting the capabilities to
ansi, which only worked for some keys. This fix required switching to
the WindowsInputStream that I introduced in a prior commit. Before we
were using the jline 2 wrapped input stream which was converting some
system events, like home and end, to the wrong escape sequence mappings.

The remainder of the commit is mostly just converting from jline 2 apis
to jline 3 apis.

I verified that tab completions, the scala console, the ammonite console
and a run task that read from System.in all work with both the server
and the thin client on mac, linux and windows after these changes.

Fixes #5828, #5863, #5856
2020-09-21 13:42:03 -07:00
Ethan Atkins 410a8dd4b1 Use jline-terminal-jna for sbt server
The old sbt launcher uses jansi 1.11, which is incompatible with jline3.
To work around this, we can use the jna terminal implementation for the
jline system terminal. This commit also switches to using the jline
TerminalBuilder for all system terminals except for the windows system
terminal with the thin client. The jline terminal builder uses
reflection that is difficult to make work with the thin client and it is
much easier to just manually construct the thin client. This is only
necessary for windows because on posix the thin client will fall back to
an implementation that shells out for stty commands.
2020-09-21 13:42:03 -07:00
Ethan Atkins 09599e4863 Add WindowsInputStream
Reading directly from System.in in windows when in raw mode does not
report special key events like arrows. Previously these keys had worked
because we had been using jline.Terminal.wrapInputIfNeed(System.in).
That jline 2 api unfortunately translated some windows control
characters to the wrong ansi escape sequences which made some keys, like
home and end, not work. This commit introduces a new class
WindowsInputStream that has similar functionality to the
wrapInputIfNeedeed jline api. I initially copied the implementation from
jline.WindowsTerminal and then I copied the escape sequence handling
from AbstractWindowsTerminal in jline3. With this input stream, all of
the keys work as expected on my windows vm and canonical input works as
well.
2020-09-21 13:42:03 -07:00
Ethan Atkins f4c49a09d2 Filter out DashDashServer for command arguments
sbt exits abruptly when run with --server.
2020-09-21 13:42:03 -07:00
Ethan Atkins 4cea09937c Set isSuccessEnabled in network channel consistently
The thin client needs to do its own success reporting because in batch
mode it's possible for the task to exit before success is logged by the
server. If the server also prints success, there can be double printing.
Unfortunately, the Prompt.Batch check is not reliable because MainLoop
will change the prompt to Running during task evaluation. The
interactive flag is set in the NetworkChannel when the client explicitly
registers itself as an interactive session, so this should be more
reliable.
2020-09-21 13:42:03 -07:00
Ethan Atkins 52743051eb Remove Terminal.withCanonicalIn
This was implemented as a no-op so we may as well get rid of it.
2020-09-21 13:42:03 -07:00
Ethan Atkins c291348d6a Use proxyInputStream instead of wrappedSystemIn
I'm not sure why the scala.Console.withIn was using proxyInputStream
while the other input streams were set to wrapedSystemIn. At any rate,
using the wrappedSystemIn would likely prevent reading input from
working with the thin client.
2020-09-21 13:42:03 -07:00
Ethan Atkins 70cf18d874 Implement proxyInputStream array read methods 2020-09-21 13:42:03 -07:00
Ethan Atkins 1b1690bec1 Make proxyErrorStream an object
This is useful for debugging
2020-09-21 13:42:03 -07:00
Eugene Yokota 894d005f12 Merge branch 'wip/prep' of sbt-dependency-graph into wip/dependencygraph 2020-09-21 15:14:18 -04:00
Eugene Yokota 167a10bbad Move to sbt-dependency-graph/. 2020-09-21 15:01:07 -04:00
eugene yokota 6e181ac843
Merge pull request #5879 from eatkins/windows-access-denied
Abort thin client on access denied exception
2020-09-21 14:29:07 -04:00
eugene yokota eaf74e462c
Merge pull request #5878 from adpi2/bsp-test
[BSP] Add support for `buildTarget/test`
2020-09-21 14:23:11 -04:00
eugene yokota 8f1bbcc0c6
Merge pull request #5865 from adpi2/bsp-run
[BSP] Add buildTarget/scalaMainClasses and buildTarget/run endpoints
2020-09-21 14:22:02 -04:00
Ethan Atkins 6247362725 Abort thin client on access denied exception
There are situations in windows where it is possible that a client
attempts to connect to a portfile that it did not have access to. This
can happen if, for example, the server is started in administrator mode
but the client is started as a regular user. When this happens, the
client would try to remove the portfile and start a new server. This new
server would not actually be able to start a server though becuase it
would not be able to open the named point because the other server had
it open. As a result, the client would just hang. The fix is to just
abort the thin client if it gets an access denied exception.
2020-09-21 10:58:57 -07:00
eugene yokota 56cca22baf
Merge pull request #5877 from eatkins/shutdown-interrupt
Catch interrupted exception in shell
2020-09-21 12:21:05 -04:00
Adrien Piquerez f5753f763c Add BSP buildTarget/test endpoint 2020-09-21 12:17:20 +02:00
Adrien Piquerez 50cf74cc67 Add BSP `buildTarget/scalaTestClasses` endpoint 2020-09-21 12:17:20 +02:00
Adrien Piquerez cfaede2bf6 Increase buildTarget/scalaMainClasses test timeout 2020-09-21 09:18:07 +02:00
Ethan Atkins ca251eb7c8 Catch interrupted exception in shell
I noticed in CI that sometimes the client tests exit with an interrupted
exception printed. I tracked it down the exception to the call to
getExec, which delegateds to CommandExchange.blockUntilNextExec.
2020-09-20 21:34:27 -07:00
Eugene Yokota b631dffed6 Support whitespace after --sbt-script
`=` gets treated as a whitespace in batch, so it would be good to support whitespace.
2020-09-20 22:07:08 -04:00
eugene yokota 350f5497c6
Merge pull request #5875 from eatkins/watch-bad-input
Don't stop watch input thread on bad input
2020-09-20 22:00:52 -04:00
Eugene Yokota 6ebbbe5e0a sbt.cmd -> sbt.bat 2020-09-20 21:31:55 -04:00
eugene yokota 923ae57c1c
Merge pull request #5873 from eatkins/supershell-batch-fix
Don't display progress in skip tasks in batch mode
2020-09-20 19:52:34 -04:00
Ethan Atkins 1e448bb403 Don't stop watch input thread on bad input
In a continuous build in sbt 1.4.0-RC1, if the user enters an invalid
option, it causes the input thread to exit which means the watch would
no longer accept input commands (including <enter> to exit). This fixes
that behavior.
2020-09-20 16:31:27 -07:00
Ethan Atkins 41afe9fbdb Don't display progress in skip tasks in batch mode
In sbt 1.4.0-RC1, if a user ran `sbt console`, the progress lines would
be printed after they had entered the console. This was because the
prompt state was incorrect. To get the prompt in the correct state, we
initialize the prompt to batch and then switch to pending when either
sbt enters the shell or the network client attaches in interactive mode.
We also will now immediately print progress as soon as we enter a skip
task to clear out the progress lines and display the warning about a
running task if there is another client connected while the task is
running.
2020-09-20 15:36:42 -07:00
eugene yokota cc0445db4e
Merge pull request #5871 from eed3si9n/wip/build_improvements
Some new modules need to be cross published
2020-09-20 17:15:47 -04:00
Eugene Yokota 0ba3a03495 Some new modules need to be cross published 2020-09-20 15:02:09 -04:00
eugene yokota 870be12f41
Merge pull request #5862 from eatkins/success
Set isSuccessEnabled on SimpleTerminal
2020-09-19 01:13:09 -04:00
eugene yokota 908371ff5c
Merge pull request #5857 from adpi2/issue/full-paths
Report absolute paths by default during compilation
2020-09-19 01:12:26 -04:00
Adrien Piquerez 8b8745cb0b Fix completion 2020-09-17 14:23:28 +02:00
Adrien Piquerez 759392aaf0 Add BSP `buildTarget/run` test 2020-09-17 14:23:07 +02:00
Adrien Piquerez 9f04358fce Add BSP buildTarget/run endpoint 2020-09-17 13:40:50 +02:00