Commit Graph

11969 Commits

Author SHA1 Message Date
Ethan Atkins a0012bab75 Apply minimum task progress length threshold
To reduce the noise of supershell, this commit imposes a 10 millisecond
minimum duration before a task will appear in the supershell lines.
2020-05-01 12:35:43 -07:00
Ethan Atkins a449b1ff2d Move JLine apis into LineReader
It is better that sbt not expose the implementation detail that
LineReader is implemented by JLine. Other terminal related apis should
be handled by sbt.internal.util.Terminal.
2020-05-01 12:35:43 -07:00
Ethan Atkins 9218d3c087 Redraw command prompt after network command
Presently if a server command comes in while in the shell, the client
output can appear on the same line as the command prompt and the command
prompt will not appear again until the user hits enter. This is a
confusing ux. For example, if I start an sbt server and type
the partial command "comp" and then start up a client and run the clean
command followed by a compile, the output looks like:

[info] sbt server started at local:///Users/ethanatkins/.sbt/1.0/server/51cfad3281b3a8a1820a/sock
sbt:scala-compile> comp[info] new client connected: network-1
[success] Total time: 0 s, completed Dec 12, 2019, 7:23:24 PM
[success] Total time: 0 s, completed Dec 12, 2019, 7:23:27 PM
[success] Total time: 2 s, completed Dec 12, 2019, 7:23:31 PM

Now, if I type "ile\n", I get:
[info] sbt server started at local:///Users/ethanatkins/.sbt/1.0/server/51cfad3281b3a8a1820a/sock
ile
[success] Total time: 0 s, completed Dec 12, 2019, 7:23:34 PM
sbt:scala-compile>

Following the same set of inputs after this change, I get:
[info] sbt server started at local:///Users/ethanatkins/.sbt/1.0/server/51cfad3281b3a8a1820a/sock
sbt:scala-compile> comp
[info] new client connected: network-1
[success] Total time: 0 s, completed Dec 12, 2019, 7:25:58 PM
sbt:scala-compile> comp
[success] Total time: 0 s, completed Dec 12, 2019, 7:26:14 PM
sbt:scala-compile> comp
[success] Total time: 1 s, completed Dec 12, 2019, 7:26:17 PM
sbt:scala-compile> compile
[success] Total time: 0 s, completed Dec 12, 2019, 7:26:19 PM
sbt:scala-compile>

To implement this change, I added the redraw() method to LineReader
which is a wrapper around ConsoleReader.drawLine; ConsoleReader.flush().
We invoke LineReader.redraw whenever the ConsoleChannel receives a
ConsolePromptEvent and there is a running thread.

To prevent log lines from being appended to the prompt line, in the
CommandExchange we print a newline character whenever a new command is
received from the network or a network client connects and we believe
that there is an active prompt.
2020-05-01 12:35:43 -07:00
Ethan Atkins 08091d64c1 Log server commands
Prior to this change, if a network command came in, it would run in the
background with no real feedback in the server ui. Prior to this change,
running compile from the thin client would look like:

sbt:scala-compile>
[success] Total time: 1 s, completed Dec 12, 2019, 7:24:43 PM
sbt:scala-compile>

Now it looks like:
sbt:scala-compile>
[info] Running remote command: compile
[success] Total time: 1 s, completed Dec 12, 2019, 7:26:17 PM
sbt:scala-compile>
2020-05-01 12:35:43 -07:00
Ethan Atkins 5afc0f0fdf Don't require newline for load failed commands
It's a bit annoying to have to hit enter here.

Also, this should fix https://github.com/sbt/sbt/issues/5162 because if
there is no System.in attached, the read will return -1 which will cause
sbt to quit.
2020-05-01 12:35:43 -07:00
Ethan Atkins c7b52203a0 Don't require newlines for main classes
There typically are fewer than 10 main classes in a project so allow the
user to just input a single digit in those cases. Otherwise fallback to
a line reader.
2020-05-01 12:35:43 -07:00
Ethan Atkins 44ef718448 Improve run command warning
When the user inputs `run` or `runMain` we shouldn't print the warning
about multiple classes because in the case of run they already will be
prompted to select the classes and in the case of runMain, they are
already required to specify the class name.

Bonus:
 * improve punctuation
 * add clear screen to selector dialogue
 * print selector dialogue in one call to println -- this should prevent
   the possibility of messages from other threads being interlaced with
   the dialogue
2020-05-01 12:35:43 -07:00
Ethan Atkins 293e83ef9f Add Delete line to terminal prompt 2020-05-01 12:35:43 -07:00
Ethan Atkins 2e3a1e767d Don't poll System.in in ConsoleChannel
The ask user thread is a background thread so it's fine for it to block
on System.in. By blocking rather than polling, the cpu utilization of
sbt drops to 0 on idle. We have to explicitly handle <ctrl+d> if we
block though because the JLine console reader will return null both if
the input stream returns -1
2020-05-01 12:35:43 -07:00
Ethan Atkins 7902ec3b7d Add Terminal abstraction
This commit aims to centralize all of the terminal interactions
throughout sbt. It also seeks to hide the jline implementation details
and only expose the apis that sbt needs for interacting with the
terminal.

In general, we should be able to assume that the terminal is in
canonical (line buffered) mode with echo enabled. To switch to raw mode
or to enable/disable echo, there are apis: Terminal.withRawSystemIn and
Terminal.withEcho that take a thunk as parameter to ensure that the
terminal is reset back to the canonical mode afterwards.
2020-05-01 12:35:43 -07:00
Ethan Atkins cd65543d10 Deprecate unused ConsoleUnpromptEvent 2020-05-01 12:28:44 -07:00
Ethan Atkins 2f4c603be6 Stop continuous input thread if System.in is closed
The watch tests take forever on windows because wrapped.read() always
returns -1 during scripted.
2020-05-01 12:28:44 -07:00
eugene yokota 8f4d3f3f8e
Merge pull request #5522 from eatkins/jdk9-dummy-virtual-file
Fix DefinesClass implementation for jdk > 8
2020-05-01 13:01:52 -04:00
Ethan Atkins 7d07bbabbf Fix DefinesClass implementation for jdk > 8
When trying to use any jdk > 8 with the latest sbt, sbt will die in some
projects because it tries to call Locate.defineClass on rt.jar, which
is represented with a DummyVirtualFile and causes a crash.
2020-04-30 20:43:04 -07:00
Eugene Yokota d29bfbbb25 Zinc 1.4.0-M5 2020-04-28 14:57:13 -04:00
Eugene Yokota 5636532a05 Revert "Mark scala-js-macro pending"
This reverts commit 49d4a9aa33.
2020-04-28 14:56:05 -04:00
eugene yokota 924d8e75cf
Merge pull request #5417 from eed3si9n/wip/machine_vf
integrate with VirtualFile changes
2020-04-24 19:30:11 -04:00
Eugene Yokota 45e8dcc354 Mark nio/external-hooks as pending 2020-04-24 18:26:21 -04:00
Eugene Yokota 49d4a9aa33 Mark scala-js-macro pending
This requires workaround from Zinc
2020-04-24 17:49:17 -04:00
Eugene Yokota a65390a811 Mima 2020-04-24 17:44:15 -04:00
Eugene Yokota af746d269e Zinc 1.4.0-M3 2020-04-24 17:44:15 -04:00
Eugene Yokota 7c4b01d9f7 Comment out external hooks
Zinc now uses farm hash to invalidate the virtual paths. To use watch to detect initial changes, we need to revalidate using content hash.
2020-04-24 17:44:15 -04:00
Eugene Yokota da999f60aa Update source deps 2020-04-24 17:44:15 -04:00
Eugene Yokota 2396b449fe Contraband 0.4.6 2020-04-24 17:44:15 -04:00
Eugene Yokota d7b3a5d61b Mark Dotty as pending 2020-04-24 17:44:14 -04:00
Eugene Yokota 3ce4d22b84 integrate with VirtualFile changes
Ref https://github.com/sbt/zinc/pull/712
2020-04-24 17:44:14 -04:00
eugene yokota 04a0b10ac4
Merge pull request #5513 from bjaglin/jsonwriter
add context-bound-relaxed helpers for write-only Tracked
2020-04-24 12:05:49 -04:00
Brice Jaglin 33b09dc765 update scaladoc to reflect argument type of the overload 2020-04-24 16:54:48 +02:00
Brice Jaglin 6be10901de add context-bound-relaxed helpers for write-only Tracked 2020-04-24 16:54:48 +02:00
eugene yokota e65224c834
Merge pull request #5512 from eed3si9n/wip/cross-fix
cross building tests and fixes
2020-04-24 10:17:55 -04:00
Brice Jaglin 8429187ecb util has been merged-in the main repo
https://github.com/sbt/sbt/pull/5274
2020-04-24 12:00:12 +02:00
Eugene Yokota 0a5c2edddf Fix strict switch command so +task is fixed 2020-04-24 01:18:16 -04:00
Eugene Yokota 11a403251a Fix cross + input task 2020-04-24 01:08:21 -04:00
Eugene Yokota 063b32bbba Fix cross + scoped task 2020-04-24 01:06:18 -04:00
Eugene Yokota 588d01b2dd Fix switch command -v flag 2020-04-24 01:04:05 -04:00
Eugene Yokota 4c1c4e6710 cross build -v verbose flag
Ref https://github.com/sbt/sbt/issues/5506
2020-04-23 23:26:58 -04:00
Eugene Yokota 5ed54affff Add test for cross + scoped task 2020-04-23 23:11:42 -04:00
Eugene Yokota 2ad28974c6 Add test for cross + inputTask 2020-04-23 23:06:48 -04:00
Eugene Yokota 111fe3826e Add test for cross + task
Ref https://github.com/sbt/sbt/issues/5497
2020-04-23 23:02:53 -04:00
Eugene Yokota 7a39841ecc Add test for command crossing using ! 2020-04-23 22:42:26 -04:00
Eugene Yokota 6035bc02ef Update cross test 2020-04-23 22:15:09 -04:00
eugene yokota 56cf50ff23
Merge pull request #5488 from eed3si9n/wip/bumpjna
ipcsocket 1.0.1 that uses latest JNA
2020-03-30 13:42:38 -04:00
Eugene Yokota e95dd544fc ipcsocket 1.0.1 that uses latest JNA 2020-03-30 12:33:57 -04:00
eugene yokota ef2256d22f
Merge pull request #5487 from eed3si9n/wip/coursier
lm-coursier-shaded 2.0.0-RC6-2
2020-03-30 09:55:17 -04:00
Eugene Yokota 5dd5296bcf lm-coursier-shaded 2.0.0-RC6-2 2020-03-29 21:01:11 -04:00
eugene yokota 7770479b2d
Merge pull request #5481 from anilkumarmyla/update/semanticdb-4.3.7
Update semanticdb to work with scala 2.12.11
2020-03-22 17:14:26 -04:00
Anil Kumar Myla 41c3f433e6
Update semanticdb to work with scala 2.12.11 2020-03-20 16:12:07 -07:00
eugene yokota fb38e1933d
Merge pull request #5479 from jtjeferreira/patch-1
Fix TaskTimings scaladocs
2020-03-19 17:06:05 -04:00
João Ferreira 09b2113379
fix units 2020-03-19 15:20:22 +00:00
João Ferreira 030252b653
Fix TaskTimings scaladocs 2020-03-19 15:07:26 +00:00