Commit Graph

10062 Commits

Author SHA1 Message Date
Ethan Atkins 1bd8665ccc Refactor color settings
A user of 1.4.0-RC1 reported that colors were not being displayed on
fedora 32. I'm not sure if this will fix the issue with fedora, but I
found it confusing how formatEnabledInEnv was set so I refactored things
in a way that I found more clear. I verified that things worked as
expected with -Dsbt.color={true,false} and with -Dsbt.log.format and
-Dsbt.log.noformat.
2020-09-10 16:44:19 -07:00
Ethan Atkins 3d6d847947 Use null ConsoleOut for RelayAppender
The RelayAppender should not log directly to console out since it is
supposed to be relaying json log messages to connected clients. This was
manifesting as double printing on some success messages.
2020-09-10 16:40:47 -07:00
Ethan Atkins 5d7485eaff Increase length of truncated command
When the server is running a command with a long name on behalf of a
client, we truncate the command if it exceeds the length of the
terminal. This is because some of the bsp commands are very long.
Nevertheless, only taking 10 characters was a bit too aggressive.
2020-09-10 16:40:15 -07:00
Ethan Atkins b610ce9298 Restore terminal when exiting Terminal.withStreams
There was a reddit comment that the user's tty was messed up after they
exited sbt:
https://www.reddit.com/r/scala/comments/io3z2p/sbt_140rc1_released/.
This attempts to fix that issue by restoring the terminal before
exiting. In order to ensure the tty is restored, it's necessary to move
the work off of a background thread and delay sbt exit. This does take
about 150ms on my machine but I figure that isn't a huge deal in the
scheme of things.
2020-09-10 15:37:15 -07:00
eugene yokota 67f6df0bdb
Merge pull request #5831 from eatkins/boot-fix
Fix output when starting sbt from thin client
2020-09-10 17:25:09 -04:00
eugene yokota 1514f96492
Merge pull request #5832 from eatkins/tcp-socket
Catch SocketException on server shutdown
2020-09-10 17:21:07 -04:00
Ethan Atkins 31f36eeff3 Add serverConnectionType to excludeLintKeys 2020-09-10 11:56:42 -07:00
Ethan Atkins 828aac8fe5 Catch SocketException on server shutdown
Fixes #5829
2020-09-10 11:55:01 -07:00
Ethan Atkins 1ec2cd85cd Fix output when starting sbt from thin client
When starting sbt via the thin client with 1.4.0-RC1, there is no output
until sbt finishes booting up which is poor ux. The reason is that sbt
only uses virtual io when sbt.io.virtual == true or formatEnabledInEnv
== true and not ci. The default value for formatEnabledInEnv is set
based on whether color is enabled in the environment. This had copied
old logic that turned on color if ansi was enabled but it makes more
sense to check the color property (which is set by the thin client via
an environment variable when it launches sbt) and fall back to whether
or not java.lang.System.console is defined. We also can explicitly set
"-Dsbt.io.virtual=true" when the thin client launches sbt since the thin
client relies on this behavior. By doing it in both places, the sbtn
for 1.4.0-RC1 will display boot output for newer versions of sbt.

Bonus: don't call ConsoleAppender.formatEnabledInEnv which just calls
back to Terminal.formatEnabledInEnv
2020-09-10 10:00:14 -07:00
eugene yokota 771ac51cb2
Merge pull request #5824 from eatkins/gc-monitor-fixes
Set initial collection time in gc monitor
2020-09-08 23:10:32 -04:00
Ethan Atkins f23aecfdbf Suggest using alternate gc implementation
Running publishLocal in the zinc project can cause gc thrashing with the
default parallelgc collector using jdk8 on my laptop. If I switch to
G1GC, it does not thrash even if I leave the heap the same size.
2020-09-08 11:12:13 -07:00
Ethan Atkins 4e3d351e71 Set initial collection time in gc monitor
The java GarbageCollectorMXBean.getCollectionTime returns the cumulative
amount of time the collector has run during the jvm session. The GC
monitor is tracking how much time has been spent in garbage collection
during each task evaluation run. In order for this calculation to work
correctly, it is necessary to set the initial elapsed time to the bean's
current collection time when we create the gc monitor. Without doing
this, we can get completely incorrect results that are reporting based
on the total gc time for the entire process, not just in the last 10
seconds.

Should fix https://github.com/sbt/sbt/issues/5818
2020-09-08 11:07:30 -07:00
Ethan Atkins a34181b078
Merge pull request #5820 from eatkins/sbt-version-bump
Bump sbt version
2020-09-08 11:03:07 -07:00
Ethan Atkins 2921dfa005 Bump sbt version 2020-09-07 09:49:43 -07:00
eugene yokota f0f14f9c49
Merge pull request #5799 from eatkins/doc-fail-repro
Reproduce scaladoc failures
2020-09-07 04:55:42 -04:00
Ethan Atkins dc3bccc57f Add scripted verification that doc works
In 1.4.0-RC2, doc did not actually generate html files for the project
clases. This was fixed in zinc and this commit updates the actions/doc
scripted test to verify that doc actually generates output for the
project classes.
2020-09-06 16:30:58 -07:00
eugene yokota d1e7b2c35c
Merge pull request #5815 from eed3si9n/wip/bump
Zinc 1.4.0-M12
2020-09-06 17:16:46 -04:00
Eugene Yokota 47842f51f8 Zinc 1.4.0-M12 2020-09-06 16:04:47 -04:00
eugene yokota c684a73e34
Merge pull request #5814 from eed3si9n/wip/bump
IO 1.4.0-M8, Zinc 1.4.0-M11
2020-09-06 06:10:40 -04:00
eugene yokota b0d89ed59f
Merge pull request #5812 from eatkins/gc-monitor
Add gc monitor to warn users about excessive gc
2020-09-06 04:54:16 -04:00
Eugene Yokota 1bd842856f IO 1.4.0-M8, Zinc 1.4.0-M11 2020-09-06 04:50:52 -04:00
Ethan Atkins fdce1eb7e6 Add gc monitor to warn users about excessive gc
It is not uncommon in large projects for the jvm to silently be running
frequent full gcs in the background. This can slow progress to a crawl.
Usually the fix is to bump the -Xmx parameter but if the users do not
realize that their tasks are slow because of gc thrashing, they may not
think to do that. This PR adds a monitor that hooks into the jvm's event
notification system to keep track of how much time is spent in GC. If
the ratio of the amount of time in gc to the total elapsed time exceeds
some threshold, we emit a warning.

I was motivated to do this because publishLocal can take forever in the
zinc project because a 1G heap isn't big enough.
2020-09-05 13:47:39 -07:00
eugene yokota 45ebebda5d
Merge pull request #5810 from eatkins/progress-format
Improve progress display with limit + 1 tasks
2020-09-03 09:25:40 -04:00
eugene yokota 172177a207
Merge pull request #5811 from eatkins/pipelining-progress
Hide compileEarly and pickleProducts from progress
2020-09-03 09:24:53 -04:00
Ethan Atkins 4f734ebeaa Hide compileEarly and pickleProducts from progress
These tasks show up during task progress and they clutter up the
display. Since my understanding is that both of these tasks are more or
less just waiting for other work to complete, I don't think they are
helpful for debugging.
2020-09-02 22:06:38 -07:00
Ethan Atkins d85f600229 Improve progress display with limit + 1 tasks
When the number of tasks running exceeds the limit for the number of
progress tasks to display by 1. Say the limit is 2 and there are three
tasks running, then we display

  | ... (1 other tasks)
  | => foo 2s
  | => bar 3s

This looks bad considering we could just display what the task actually is.
2020-09-02 21:34:54 -07:00
eugene yokota 32c1f0c90a
Merge pull request #5807 from eatkins/logger-appender-source-compat
Restore bindLoggerAppenders source compatibility
2020-09-02 20:42:23 -04:00
eugene yokota 460a6f2291
Merge pull request #5806 from eatkins/zinc-sandwich-fix
Allow incompatible mixed scala versions
2020-09-02 19:51:17 -04:00
eugene yokota 090f48fea8
Merge pull request #5809 from eatkins/sanitize-bsp-id
Sanitize builder server protocol uri
2020-09-02 19:49:44 -04:00
Ethan Atkins 443ebcd3d7 Sanitize builder server protocol uri
The lift-json project couldn't load in the community build because the
generated uri contained two # identifiers.
2020-09-02 15:58:19 -07:00
Ethan Atkins fb840cb806 Restore bindLoggerAppenders source compatibility
The akka-http project doesn't load because it gets an Appender with
MainAppender.defaultBacked which returns an sbt Appender rather than a
log4j appender now. It then passes that appender into
bindLoggerAppenders which doesn't work because bindLoggerAppenders was
expecting a log4j appender rather than an sbt Appender..
2020-09-02 13:25:45 -07:00
Ethan Atkins c6021ecdf6 Allow incompatible mixed scala versions
The zinc scripted project depends on all of the compiler bridges. As a
result the introduction of the strict scala binary version check in
f8139da192 broke zinc scripted. This
commit reverts to the old behavior in the non scala sandwich case.

I also switched to a for comprehension instead of a pattern match
because this is a rare case where I think it made the code significantly
more readable.
2020-09-02 11:49:05 -07:00
eugene yokota debc9a28a4
Merge pull request #5804 from eatkins/watch-cancel
Change ctrl+c behavior in ~
2020-09-01 09:10:14 -04:00
Ethan Atkins c931b005ab Change ctrl+c behavior in ~
While in a continuous build, when the user enters ctrl+c into the sbt
server console (not a thin client connection) when sbt has been launched
in interactive mode, the server exits.  This commit makes it so that
instead we just cancel the watch. As a result, if sbt was started in
batch mode, e.g. `sbt ~compile`, ctrl+c will still exit sbt but in
interactive mode ctrl+c will take the user back to the shell.
2020-08-31 11:41:08 -07:00
Ethan Atkins afac5e5067 Block watch until threads spin up
I occassionally end up in a state where watch input does not seem to be
read. To rule out the possibility that the background thread that reads
input has not successfully started, this commit makes it so that we
block until the thread signals that it has started via a CountDownLatch.

The diff is superficially big because of an indentation change at the
bottom.
2020-08-31 11:36:39 -07:00
eugene yokota 1b99049fbc
Merge pull request #5782 from adpi2/feature/bsp-enabled
Add bspEnabled setting
2020-08-27 10:55:48 -04:00
Martin Duhem fbcd18de25
Merge pull request #5800 from Duhemm/test-agent-duplicate-tasks
Filter out duplicate `TaskDef`s in test agent
2020-08-27 11:55:36 +02:00
Adrien Piquerez 23c8889e26 Add bspEnabled setting 2020-08-27 09:11:52 +02:00
Martin Duhem 5cce0e9d5d
Fix #5801: Remove duplicate TaskDefs in test agent
When forking, a test could be run as many times as its `TestDef` matched
`Fingerprint`s. When forking is disabled, sbt correctly runs the tests
only once.
2020-08-26 17:19:35 +02:00
eugene yokota 788fd4aa28
Merge pull request #5793 from eatkins/kill-processes
Kill external processes on sigint
2020-08-26 11:07:52 -04:00
eugene yokota 68f1999774
Merge pull request #5794 from eatkins/dumb-terminal
Use dumb terminal when specified by property
2020-08-26 11:07:13 -04:00
eugene yokota 9bd1089cb0
Merge pull request #5796 from eatkins/network-channel-memory
Reduce sbt memory utilization
2020-08-24 15:23:09 -04:00
Ethan Atkins 1c21f13b99 Reduce sbt memory utilization
The sbt Server is initialized with a callback onIncomingSocket. That
callback was created in CommandExchange and held references to a build
structure and a state. Neither the state nor structure would ever go out
of scope so they effectively leaked. It is possible for each
NetworkChannel to access a recent instance of state through the
CommandExchange.withState method. Using this, we can eliminate the
references to state and build structure in the onIncomingSocket
callback. In the sbt project, this reduced the memory utilization by
about 50mb on startup.
2020-08-24 10:30:43 -07:00
Ethan Atkins 7e0fbb9be5 Use dumb terminal when specified by property
Intellij invokes sbt with "-Djline.terminal=jline.UnsupportedTerminal"
which Terminal rewrites to the value none. When that property is set, we
should be using a jline dumb terminal. While
https://github.com/sbt/sbt/pull/5788 did fix the import functionality,
jline 3 was still emitting some ansi characters to the intellij console.
When we feed a dumb terminal to the jline 3 line reader, the ansi
control characters go away.
2020-08-23 11:12:53 -07:00
Ethan Atkins d3f8cc8161 Kill external processes on sigint
On linux and mac, entering ctrl+c will automatically kill any forked
processes that were created by the sbt server because sigint is
automatically forwarded to the child process. This is not the case on
windows where it is necessary to forcibly kill these processes.
2020-08-23 10:15:07 -07:00
eugene yokota 8fe7e33a31
Merge pull request #5792 from eatkins/windows-ctrl-c
Allow windows console users to exit with ctrl+c
2020-08-23 13:13:07 -04:00
eugene yokota 573bd8af04
Merge pull request #5788 from eatkins/intellij-import
Fix intellij import for 1.4.x
2020-08-23 13:12:11 -04:00
Ethan Atkins af761da811 Allow windows console users to exit with ctrl+c
On windows with jline3, inputting ctrl+c in the sbt console just causes
the input stream to return -3 unlike mac and linux where ctrl+c always
signals.

Fixes https://github.com/sbt/sbt/issues/5791
2020-08-23 09:12:52 -07:00
Ethan Atkins 41c33ba92f Fix intellij import with 1.4.x
The intellij import currentlly works by forking an sbt process and
writing command input through the process input stream. To make this
work, we need the SimpleTerminal (which is used when sbt is run with
-Dsbt.log.noformat=true) to be able to read input.

Attaching the input to the simple terminal caused watch tests to fail on
windows. This can be fixed by checking if the byte read from the input
stream is -1 and ignoring it if so.
2020-08-23 08:59:08 -07:00
Ethan Atkins 02366fdf49 Honor formatEnabledInEnv at the Terminal level
The sbt.log.noformat parameter should be treated very similarly to
sbt.io.virtual. When it is true, we should just use the raw io streams
for the process. This came up because of
https://github.com/sbt/sbt/issues/5784 which reported that intellij
imports were not working and that ansi control characters were being
written to the output.
2020-08-23 08:51:55 -07:00