Commit Graph

2895 Commits

Author SHA1 Message Date
Eugene Yokota 4eb096de9c Unidoc 2020-10-04 22:49:08 -04:00
Eugene Yokota 081f437afc Banner URL
Fixes https://github.com/sbt/sbt/issues/5921
2020-10-04 00:10:30 -04:00
Eugene Yokota c11259ee2f Epoch directory src/main/{scala-2, scala-3}
Fixes https://github.com/sbt/sbt/issues/5895
2020-10-03 22:52:06 -04:00
Eugene Yokota 6662b2cf99 lm-coursier-shaded 2.0.0
Uses Coursier 2.0.0
2020-10-02 23:07:27 -04:00
Eugene Yokota 51466e7b84 Rename some sbt-dependency-graph keys
Fixes https://github.com/sbt/sbt/issues/5894
2020-10-01 09:28:44 -04:00
eugene yokota 34d1e62f27
Merge pull request #5908 from eatkins/scala-2.12-thin-client-console
Fix echo setting for scala 2.12 thin client console
2020-10-01 05:33:56 -04:00
Ethan Atkins 16bef0cfc8 Don't block sbt exit forever on bg service shutdown
Some of the sbt scripted tests somewhat frequently hang in CI. I added a
patch that printed a stack trace of the sbt process every 30 seconds. I
discovered that the main thread was stuck in DefaultBackgroundJobService
shutdown. To avoid the hangs, I updated the awaitTermination methods to
take a timeout parameter and we timeout shutdown if 10 seconds have
elapsed.
2020-09-29 11:48:51 -07:00
Ethan Atkins 7eaa46800a Fix echo setting for scala 2.12 thin client console
I noticed that when using the scala 2.12 console with the thin client
that there was weird behavior for the first few seconds of the session.
When prompted with 'scala> ' I would type a letter, say v, and the
output would be 'scala>v' instead of 'scala> v'. It turned out that this
was because the NetworkChannel was returning a stale value for
isEchoEnabled. This happened because NetworkChannel has a method
getProperties that is rate limited under the assumption that the
properties rarely change. This made sense for things like
isAnsiSupported or isSuperShellEnabled but not isEchoEnabled. It is
straightforward to fix this by actually getting the terminal attributes
and checking if the echo flag is set.
2020-09-29 10:21:44 -07:00
Ethan Atkins 3966d2fcb2 Catch interrupted exceptions in blockUntilNextExec
It is possible for an InterruptedException to be thrown here because of
logic in NetworkClient. This seemed to be the root cause of the fix I
tried in ca251eb7c8 so I'm reverting that
commit.

Revert "Catch interrupted exception in shell"

This reverts commit ca251eb7c8.
2020-09-28 07:28:24 -07:00
Ethan Atkins c2c2a26203 Don't throw on closed completion service
In 64c0f0acdd, I attempted to safely close
all of the completion services when the user inputs ctrl+c. I have
noticed though that sometimes sbt crashes in CI with the
RejectedExecutionException thrown by submit. To avoid throwing when
there was no cancellation, I slightly modified the shutdown logic to not
shutdown the completion service whil still shutting down the underlying
thread pool.
2020-09-28 07:03:27 -07:00
Ethan Atkins b85209be78 Add sbt.Terminal trait
It can be useful for plugin and build authors to have access to some of
the virtual terminal properties. For instance, when writing a task that
needs a password, the author may wish to put the terminal in raw mode
with echo disabled. This commit introduces a new Terminal trait at the
sbt level and a corresponding task, terminal, that provides a basic
terminal api. The Terminal returned by the terminal task will correspond
to the terminal that initiated the task so that it should work with sbtn
as well as in console mode.
2020-09-27 13:33:47 -07:00
Ethan Atkins 411c1365ef Fix getter and setter for virtual terminal attributes
Neither NetworkTerminal.getAttributes nor NetworkTerminal.setAttributes
worked correctly because they were sending the wrong json method name.
This wasn't noticeable because neither of these methods had previously
been used by sbt.
2020-09-27 12:17:34 -07:00
eugene yokota 073b3047af
Merge pull request #5901 from eatkins/interaction-service-fix
Fix interaction service for thin client
2020-09-26 15:47:23 -04:00
Ethan Atkins 6103444d5d Fix interaction service for thin client
The global SimpleReader hardwires Terminal.console so it won't work with
the ThinClient.
2020-09-26 11:51:42 -07:00
eugene yokota 71677cedca
Merge pull request #5889 from eatkins/supershell-perf-regression-fix
Fix minor supershell performance regression
2020-09-25 14:13:12 -04:00
eugene yokota c00196abf0
Merge pull request #5888 from adpi2/bsp-shutdown
reply to BSP shutdown request
2020-09-24 12:06:03 -04:00
Ethan Atkins d930cb1987 Don't do progress work on the main thread
I noticed that no-op compile was slower in
https://github.com/sbt/sbt/issues/5508 using 1.4.0-RC2 than 1.4.0-RC1.
It took around 400ms with 1.4.0-RC2 and 200-250ms on RC1. Git bisect
brought me to 41afe9fbdb which I
remembered I'd been slightly concerned about from a performance
perspective but didn't get around to testing. The problem is that we
were blocking the task from running while determing whether or not we
should force a progress report. We can do that work on the background
thread instead so the task can begin running immediately.
2020-09-24 09:02:05 -07:00
Ethan Atkins 4ec6339794 Fix logical bug in task report scheduling
The conditional for whether to make task progress events repeatable was
inverted. This wasn't actually noticeable because the function
doReport() was being schedule which had a guard to prevent it from
running more frequently than the report period.
2020-09-24 09:02:05 -07:00
Adrien Piquerez 591c2b13cd reply to BSP shutdown request 2020-09-23 18:06:56 +02:00
Adrien Piquerez 621e60ba13 Fix Test / semanticdbOptions 2020-09-23 17:38:07 +02: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 602cf392a6
Merge pull request #5880 from eed3si9n/wip/dependencygraph
in-sources sbt-dependency-graph
2020-09-21 22:56:10 -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 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 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 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
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
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
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 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
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 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 9f04358fce Add BSP buildTarget/run endpoint 2020-09-17 13:40:50 +02:00
Adrien Piquerez 92fb69f370 Add BSP buildTarget/scalaMainClasses endpoint 2020-09-17 13:32:30 +02:00
Adrien Piquerez 3c24e9d29d Report absolute paths by default 2020-09-16 11:12:12 +02:00
Ethan Atkins a946cbf702 Skip contents of symlinked directories in clean
The clean task was previously deleting the contents of directories that
were symlinked into the target directory. This was an oversight because
it never occurred to me that users might symlink a directory whose
contents they did not want deleted into the target directory.
2020-09-15 09:24:04 -07:00
eugene yokota 66308bae45
Merge pull request #5847 from eed3si9n/wip/promise_propagate
Cancel all promises if one fails
2020-09-14 22:33:18 -04:00
eugene yokota f033aa5ca1
Merge pull request #5844 from eed3si9n/wip/pipelining_adjustments
Fix mixed pipelining
2020-09-14 22:32:48 -04:00
Adrien Piquerez ac85117841 Add BSP workspace/reload 2020-09-14 13:10:11 +02:00
Eugene Yokota 55d2b0a3c6 Cancel all promises if one fails
Fixes https://github.com/sbt/sbt/issues/5822

Currently the entire shell gets stuck when there's a compilation error with pipelining.
This at least returns to sbt shell.
2020-09-14 01:04:10 -04:00
Eugene Yokota 350a6af6ef Demote [sig files written]
It gets ridiculous seeing the screen fill up with [sig files written] after a while.
Here's a quick hack to demote that stuff.
2020-09-13 17:54:36 -04:00
Eugene Yokota 2a8c184a51 Fix mixed pipelining
Together with https://github.com/sbt/zinc/pull/920 this fixes most of the mixed pipelining issues.

1. Previous values are carried from `compileScalaBackend` in `compileJavaTask`.
2. `compileJava / compileOptions ` now uses `compile / compileOptions` to avoid unintentional change of javac or scalac options.
3. Hooks up early compile analysis store.
2020-09-13 16:25:09 -04:00
Eugene Yokota d24cd2b3f7 Rename --close-io-streams to --detach-stdio 2020-09-12 14:19:37 -04:00