Commit Graph

2928 Commits

Author SHA1 Message Date
Ethan Atkins 3aeede3774 Flush terminal output stream after readline
With the thin client, when running the command `exit`, it is often the
case that the log message `[info] disconnected` is printed on the same
line as the prompt. This is because there is a small flush delay on the
network client's output stream channel that causes the disconnected info
message to be logged before the the newline that jline 3 echoes to the
client has been printed. To fix this we can manually flush the terminal
output stream before exiting.
2020-10-24 15:49:02 -07:00
Ethan Atkins 69be879684 Reinstate watchBeforeCommand callback
A user reported that the watchBeforeCommand callback was not being
invoked in sbt 1.4.{0, 1}. This was an oversight that occurred when
refactoring watch for the thin client and there previously had been no
regression test for that callback.
2020-10-24 10:59:33 -07:00
eugene yokota 7a3ca0d9c2
Merge pull request #6011 from adpi2/fix-bsp-semanticdb-warning
Fix #5977: Fix semanticdb warning
2020-10-22 12:14:45 -04:00
eugene yokota 3536959c31
Merge pull request #6005 from eed3si9n/wip/prefixpaths
Fix earlyOutput and remoteCachePom paths
2020-10-22 11:36:49 -04:00
Adrien Piquerez 22e5308381 Fix BSP warning about semanticdb 2020-10-22 16:18:12 +02:00
Eugene Yokota 3d01d7fbbe Use different artifactPath for remoteCachePom
Fixes https://github.com/sbt/sbt/issues/6004

```
sbt:foo> remoteCachePom
[info] Wrote /private/tmp/foo/target/scala-2.13/remote-cache/foo_2.13-0.1.0-SNAPSHOT.pom

sbt:foo> makePom
[info] Wrote /private/tmp/foo/target/scala-2.13/foo_2.13-0.1.0-SNAPSHOT.pom
```
2020-10-22 00:07:46 -04:00
Eugene Yokota 88d7da5141 Fix earlyOutput paths
Fixes https://github.com/sbt/sbt/issues/5929
2020-10-22 00:03:48 -04:00
Ethan Atkins a0db985c36 Fix canonical input for network client
It is valid for the thin client input stream to return -1 as an EOF when
the user inputs ctrl+d in canonical mode.
2020-10-21 14:26:21 -07:00
Ethan Atkins 7ad20edbd3
Merge branch 'develop' into evaluate-task-memory-leak 2020-10-21 11:49:01 -07:00
eugene yokota f217b59868
Merge pull request #5996 from xuwei-k/remote-cache-extract-message
improve remote cache extract log message
2020-10-21 14:32:18 -04:00
Ethan Atkins d9acfed220 Fix EvaluateTask memory leak
EvaluateTask was holding references to SafeState that could be quite
large. This was reported as #5992. In that project, I ran the `ci` task
and observed the OOM as reported. I took a heap dump prior to OOM and
got the retained size graph from visualvm (which took hours to compute).
The lastEvaluatedState was holding a reference to SafeState that was
1.7GB. The project max heap size was set to 2GB. Instead of using the
lastEvaluatedState, we can just use StandardMain.exchange.withState.
The cached instances of state were used for task cancellation and
completions. While it is possible that early on in booting
StandardMain.exchange.withState could return a null state, in practice
this won't happen because it is set early on during the sbt boot
commands.

After this change, I successfully ran the `ci` task in the #5992 issue
project with the same memory parameters as their ci config.
2020-10-21 08:01:40 -07:00
Ethan Atkins 78620cd902 Manage ansi codes and color codes separately
The ConsoleAppender formatEnabledInEnv field was being used both as an
indicator that ansi codes were supported and that color codes are
enabled. There are cases in which general ansi codes are not supported
but color codes are and these use cases need to be handled separately.
To make things more explicit, this commit adds isColorEnabled and
isAnsiSupported to the Terminal companion object so that we can be more
specific about what the requirements are (general ansi escape codes or
just colors). There are a few cases in ConsoleAppender itself where
formatEnabledInEnv was used to set flags for both color and ansi codes.
When that is the case, we use Terminal.isAnsiSupported because when that
is true, colors should at least work but there are terminals that
support color but not general ansi escape codes.
2020-10-21 08:01:12 -07:00
xuwei-k 37fa5573f0 improve remote cache extract log message
build.sbt

```
lazy val common = Def.settings(
  scalaVersion := "2.12.12",
  pushRemoteCacheTo := Some(
    MavenCache("local-cache", (ThisBuild / baseDirectory).value / "remote-cache")
  ),
  remoteCacheId := "fixed-id",
  remoteCacheIdCandidates := Seq(remoteCacheId.value)
)

pushRemoteCache := {}
pullRemoteCache := {}

lazy val p1 = project.settings(common)
lazy val p2 = project.settings(common)
lazy val p3 = project.settings(common)
lazy val p4 = project.settings(common)
lazy val p5 = project.settings(common)
lazy val p6 = project.settings(common)
lazy val p7 = project.settings(common)
lazy val p8 = project.settings(common)
lazy val p9 = project.settings(common)
```

run: `sbt pushRemoteCache clean pullRemoteCache`

before

```
[info] remote cache artifact extracted for Some(cached-compile)
[info] remote cache artifact extracted for Some(cached-compile)
[info] remote cache artifact extracted for Some(cached-compile)
[info] remote cache artifact extracted for Some(cached-compile)
[info] remote cache artifact extracted for Some(cached-compile)
[info] remote cache artifact extracted for Some(cached-compile)
[info] remote cache artifact extracted for Some(cached-test)
[info] remote cache artifact extracted for Some(cached-test)
[info] remote cache artifact extracted for Some(cached-test)
[info] remote cache artifact extracted for Some(cached-test)
[info] remote cache artifact extracted for Some(cached-test)
[info] remote cache artifact extracted for Some(cached-test)
[info] remote cache artifact extracted for Some(cached-compile)
[info] remote cache artifact extracted for Some(cached-test)
[info] remote cache artifact extracted for Some(cached-compile)
[info] remote cache artifact extracted for Some(cached-test)
[info] remote cache artifact extracted for Some(cached-compile)
[info] remote cache artifact extracted for Some(cached-test)
```

after

```
[info] remote cache artifact extracted for p2:p2:0.0.0-fixed-id Some(cached-compile)
[info] remote cache artifact extracted for p9:p9:0.0.0-fixed-id Some(cached-compile)
[info] remote cache artifact extracted for p8:p8:0.0.0-fixed-id Some(cached-compile)
[info] remote cache artifact extracted for p7:p7:0.0.0-fixed-id Some(cached-compile)
[info] remote cache artifact extracted for p5:p5:0.0.0-fixed-id Some(cached-compile)
[info] remote cache artifact extracted for p1:p1:0.0.0-fixed-id Some(cached-compile)
[info] remote cache artifact extracted for p5:p5:0.0.0-fixed-id Some(cached-test)
[info] remote cache artifact extracted for p7:p7:0.0.0-fixed-id Some(cached-test)
[info] remote cache artifact extracted for p2:p2:0.0.0-fixed-id Some(cached-test)
[info] remote cache artifact extracted for p8:p8:0.0.0-fixed-id Some(cached-test)
[info] remote cache artifact extracted for p9:p9:0.0.0-fixed-id Some(cached-test)
[info] remote cache artifact extracted for p1:p1:0.0.0-fixed-id Some(cached-test)
[info] remote cache artifact extracted for p3:p3:0.0.0-fixed-id Some(cached-compile)
[info] remote cache artifact extracted for p3:p3:0.0.0-fixed-id Some(cached-test)
[info] remote cache artifact extracted for p4:p4:0.0.0-fixed-id Some(cached-compile)
[info] remote cache artifact extracted for p4:p4:0.0.0-fixed-id Some(cached-test)
[info] remote cache artifact extracted for p6:p6:0.0.0-fixed-id Some(cached-compile)
[info] remote cache artifact extracted for p6:p6:0.0.0-fixed-id Some(cached-test)
```
2020-10-20 23:13:33 +09:00
eugene yokota 9f7985a2d9
Merge pull request #5991 from eed3si9n/wip/release-lint
Exclude keys starting with some prefixes from linting
2020-10-19 15:36:33 -04:00
Eugene Yokota 5d876dc287 Exclude keys starting with some prefixes from linting
Fixes https://github.com/sbt/sbt/issues/5849
2020-10-19 13:31:30 -04:00
Guillaume Martres c44e2c63bc Properly log the ClassfileManager output 2020-10-19 12:57:45 -04:00
eugene yokota 28833db333
Merge pull request #5983 from xirc/issues/5955
Add `shellPrompt` into excludeLintKeys
2020-10-18 04:06:28 -04:00
xuwei-k bbdd11150b remove unused code 2020-10-18 15:11:41 +09:00
xuwei-k d582dfc4be Scala-2-dependsOn-Scala-3 feature with Scala.js
fix 5971
2020-10-18 15:11:41 +09:00
Taichi Yamakawa cb7a08dfe2 Add `shellPrompt` into excludeLintKeys
Resolve the issue https://github.com/sbt/sbt/issues/5955
2020-10-18 14:54:54 +09:00
eugene yokota d0b8cf0984
Merge pull request #5932 from aaabramov/feature/3212/new-plugins-view
Brings new `plugins` command output message as per #3212
2020-10-11 13:19:16 -04:00
eugene yokota f02edee1d5
Merge pull request #5956 from adpi2/improve-bsp-reporter
Fix #5950: Better BSP reporting
2020-10-11 13:16:30 -04:00
eugene yokota 21c73c5bd7
Merge pull request #5967 from naderghanbari/fix-5959-dep-html
Fix #5959: dependencyBrowseGraph fails with Couldn't load 'graph.html'
2020-10-11 13:15:08 -04:00
eugene yokota b806d3ed3d
Merge pull request #5964 from rdesgroppes/detect-adoptopenjdk-on-macos
Detect AdoptOpenJDK on macOS
2020-10-11 13:12:15 -04:00
eugene yokota 916498c0c2
Merge pull request #5948 from adpi2/fix-custom-reporter
Fix #5935: Introduce bspReporter key
2020-10-11 13:10:34 -04:00
Nader Ghanbari 75be157679 Use cdnjs and github instead of samsarin.com 2020-10-11 12:03:32 -04:00
Adrien Piquerez efb8bc4ec0 Use Zinc analysis in BuildServerReporter 2020-10-11 09:09:13 +02:00
Adrien Piquerez 93ad022dca Introduce bspReporter key 2020-10-11 09:08:12 +02:00
Nader Ghanbari 495118a297
Fix #5959 add missing html resources
- Add missing graph.html and tree.html resources from
https://github.com/sbt/sbt-dependency-graph
2020-10-10 23:00:20 -04:00
Regis Desgroppes 63b375aa0f Detect AdoptOpenJDK on macOS 2020-10-09 17:07:42 +02:00
xuwei-k e0e11c71d5 preserve semanticdb files in pullRemoteCache task 2020-10-09 17:54:35 +09:00
Andrii aae6493701
Merge branch 'develop' into feature/3212/new-plugins-view 2020-10-06 23:08:41 +03:00
Andrii Abramov 6061072937 Brings new `plugins` command output message as per #3212 2020-10-06 23:06:38 +03:00
Adrien Piquerez af4deaaab1 fix BSP on custom configs 2020-10-05 13:22:48 +02: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