Commit Graph

195 Commits

Author SHA1 Message Date
Diego E. Alonso-Blas 3657910063 ConsoleAppender: reuse/recycle StringBuilder storage.
A StringBuilder is a mutable data structure to create a String.
When the String is created, the new String does not share any
storage with the StringBuilder. Thus, we can keep a same
StringBuilder, and reuse its internal storage between different
iterations.
2019-10-22 23:30:09 +02:00
Ethan Atkins 43f25520a0 Don't include DeleteLine in progress length
I incorrectly included the DeleteLine in the progress line length and
this could cause certain progress lines to be incorrectly reported as
multi line when they actually fit on a single terminal line.
2019-10-07 09:30:41 -07:00
Ethan Atkins 9c2dd05b6a Avoid possible divide by zero
On the off chance that in some configurations the terminal width is set
to zero, avoid an exception by returning 0 for terminal lines. It is
likely that supershell will not work well if terminal width is zero, but
that's better than a potential crash (I think the crash would be in the
progress background thread, so I'm not sure how bad it would be, but
still its good to avoid).
2019-09-24 16:35:03 -07:00
Ethan Atkins 5cfab4c9a9 Cleanup implementation of progress report
It was a bit cleaner to consolidate `extra` and
(previousLines|info).length into prevLength and currentLength.
2019-09-24 16:33:42 -07:00
Ethan Atkins 7597cdb19b Take terminal width into account in supershell
Sometimes if the progress lines are wider than the terminal width,
the supershell blank zone can expand indefinitely because be do not move
the cursor far enough up to properly re-fill the blank zone.
2019-09-24 10:59:53 -07:00
eugene yokota 3f20cc1583
Merge pull request #221 from eatkins/lazy-success-event-tag
Load SuccessEventTag lazily
2019-09-18 22:14:28 -04:00
Ethan Atkins b3165b5c8c Load SuccessEventTag lazily
It takes about a second to load scala.reflect.runtime.universe. If we
lazy load here, we can load scala.relect.runtime.universe in the
background to speed up the sbt start up time. See
0ebb7a5662.
2019-09-18 15:33:42 -07:00
Ethan Atkins f20b275045 Fix supershell position bug
The previous implementation of supershell log line interlacing with
regular line interlacing relied on state in a global object. A somewhat
better approach is for each appender to hold a reference to a state
object. Every time tasks run, new appenders are created, so the state
should always reflect the current progress state.
2019-09-03 13:07:51 -07:00
Ethan Atkins 635316902d Allow supershell to work in no color mode
Supershell actually works quite well in no color mode. On the sbt side,
we still want to disable supershell automatically if the output is not a
terminal or no color is set, but this commit allows the user to force
supershell through -Dsbt.supershell or the useSuperShell setting even
when no color is set.
2019-09-02 11:10:42 -07:00
Ethan Atkins a5666e97b6 Manage progress padding
With this commit, I improved the padding management so that padding is
now added above the progress report. Whenever a line is logged at the
info or greater level, we can reduce the padding level by one since that
line has effectively filled in the padding.
2019-09-01 22:26:57 -07:00
Ethan Atkins d9fe5540f5 Interlace log lines with task progress
With the current supershell implementation, the progress display
flickers when there is heavy console logging during task evaluation.
This is because the console appender clears out the task progress and it
isn't restored until the next periodic super shell report (which
runs every 100ms by default). To remove the flickering, I reworked the
implementation to interlace the log lines with progress reports. In
order to ensure that the log lines remained contiguous, I had to apply
padding at the bottom of the supershell region whenever the new report
contained fewer lines than the old report. The report shifts down as new
log lines are appended. This isn't optimal, but I think removing
the flickering while preserving contiguous log lines is worth it.
2019-09-01 21:06:48 -07:00
Eugene Yokota 39fdf70c21 reimplement stacktrace suppression
Ref https://github.com/sbt/sbt/issues/4964
2019-08-20 12:35:13 -04:00
Eugene Yokota 7de45416fa Scala 2.13.0 2019-07-14 12:47:43 -04:00
Eugene Yokota e28e052b5b move super shell rendering to ConsoleAppender
Ref https://github.com/sbt/sbt/issues/4583
This moves the super shell rendering to ConsoleAppender with several improvements.

Instead of scrolling up, supershell is now changed to normal scrolling down, with more traditional cursor position. Before printing out the logs, last known progress reports are wiped out. In addition, there's now 5 lines of blank lines to accomodate for `println(...)` by tasks.
2019-04-21 03:59:19 -04:00
Eugene Yokota 98ec0075f4 apply formatting 2019-04-20 23:23:13 -04:00
Eugene Yokota d496a5dff5 Make showProgress configurable 2019-03-07 16:49:54 -05:00
Eugene Yokota 8215026bc3 Account for log line longer than the terminal width
widthHolder will hold on to the terminal width if supplied by sbt.
This avoids adding dependencies to JLine.
2019-03-07 16:42:10 -05:00
Eugene Yokota 8c85744d67 Use IO.Newline for stack trace 2019-03-07 16:39:47 -05:00
Eugene Yokota 3a6aa57747 log4j 2.11.2 2019-02-23 14:21:07 -05:00
Eugene Yokota 9f202397e4 expose ANSI control sequences 2018-11-16 23:03:25 -08:00
eugene yokota f16997d3a9
Merge pull request #184 from eed3si9n/wip/progress
Adds sbt.color flag and sbt.progress flag
2018-10-02 08:58:38 -04:00
Eugene Yokota efe04c1cde Cleaning up code 2018-10-02 08:51:17 -04:00
Eugene Yokota 9bb244314d implement sbt.progress
This implements a logger that grows upward, instead towards bottom.
2018-10-01 05:50:35 -04:00
Eugene Yokota 53c9b84858 add sbt.color flag
This implements a new sbt.color flag that takes always/auto/never/true/false value as a replacement of current sbt.log.format=true/false flag.

When neither flags are set, the default behavior is to enable color when the terminal supports ANSI and it detects an stdout console (as opposed to redirects).

Fixes https://github.com/sbt/sbt/issues/4284
2018-09-30 21:00:09 -04:00
Eugene Yokota ab674321dc Scala 2.12.7 2018-09-28 02:27:45 -04:00
Eugene Yokota e121d969c4 openjdk11 2018-09-22 00:55:00 -04:00
Eugene Yokota 9f876009c8 Fix 2.10 build
Fixes #179
2018-09-22 00:35:20 -04:00
Eugene Yokota cf0467609d -Xfatal-warnings 2018-09-19 22:46:38 -04:00
Eugene Yokota 9beff33152 SIP-18 import
Adds SIP-18 import for unidoc purpose.
2018-09-19 22:03:32 -04:00
eugene yokota 965de89c64
Merge pull request #176 from sbt/1.2.x
Merge 1.2.x
2018-08-29 03:27:16 -04:00
Guillaume Martres 15522a0cbe Add Problem#rendered to customize how problems are shown
Dotty has its own logic for displaying problems with the proper file
path, position, and caret, but if we store this information in
Problem#message we end up with duplicated information in the output
since Zinc will prepend/append similar things (see
sbt.internal.inc.ProblemStringFormats). So far, we worked around this in
Dotty by using an empty position in the sbt bridge reporter, but this
means that crucial semantic information that could be used by a Build
Server Protocol implementation and other tools is lost. This commit
allows us to avoid by adding an optional `rendered` field to `Problem`:
when this field is set, its value controls what the user sees, otherwise
we fallback to the default behavior (the logic to do this will be added to
Zinc after this PR is merged and a new release of sbt-util is made).
2018-08-28 03:58:15 +09:00
Guillaume Martres e905b44a33 Follow-up to the fields added in #173
It turns out that there is more boilerplate to fill that I missed.

Also add deprecation notices.
2018-08-28 02:04:10 +09:00
Eugene Yokota 494f384c49 Formatting 2018-08-16 16:36:41 -04:00
Guillaume Martres 5e3a102606 xsbti.Position: Also add {start,end}{Line,Column}
Positions in the Language Server Protocol and Build Server Protocol are
line/column-based instead of offset-based, so this is more convenient.
Computing the line/column from the offset is possible but requires
reading the source file.
2018-08-14 02:04:55 +09:00
Guillaume Martres 78834527df xsbti.Position: add startOffset and endOffset
A position now has a start, an end, and a point (the existing `offset`),
just like it does in the Scala compiler. This information is especially
useful for displaying squiggly lines in an IDE.

This commit and the next one are required for https://github.com/sbt/zinc/pull/571
2018-08-14 02:04:43 +09:00
Dale Wijnand b1d02bee30
Make checkTypeTag lenient on "scala." type prefix 2018-08-02 07:52:13 +01:00
Eugene Yokota 434e294f28 Fixes the stacktrace trimming
Ref https://github.com/sbt/sbt/issues/4121
Ref https://github.com/sbt/sbt/pull/4232
2018-06-27 06:37:36 -04:00
Eugene Yokota 2b52c7dea0 Merge branch '1.1.x' into wip/merge-1.1.x 2018-06-14 01:11:49 -04:00
xuwei-k 5ca377cd59 use foldLeft instead of /:
1c56f0af6d/src/library/scala/collection/IterableOnce.scala (L465)
2018-05-01 20:20:00 +09:00
Eugene Yokota d2e59fa165 Scala 2.12.6 and other dependencies
sbt 1.1.4
Scala 2.12.6
ScalaCheck 1.14.0
ScalaTest 3.0.5
Contraband 0.4.0
2018-04-28 03:52:33 -04:00
Dale Wijnand 029952895b
Enforce invariant in StringTypeTag optimisation
Or, put differently, "Add a test for sbt/util#153".
2018-04-05 09:43:22 +01:00
Eugene Yokota 0c26b55882 Merge branch '1.1.x' into wip/merge-1.1.x 2018-03-26 22:46:04 -04:00
Dale Wijnand 44a2f1d92c
Kill utilTesting
No need for a 1-line, 1-class jar
2018-02-23 18:16:30 +00:00
Jason Zaugg d9b130d519 Optimize ConsoleAppender.appendLog 2018-02-23 14:52:45 +10:00
Johannes Rudolph 0ebb7a5662
In initStringCodecs avoid reflect universe initialization
This showed up in profiling. It's known that TypeTags are expensive. Even
more so if the reflect universe is accessed during startup when the
class loading and JIT compiler are busy enough with other stuff.
2018-02-19 09:19:31 +01:00
Jason Zaugg b68071a488 Cache evidence params for hot method 2018-02-17 14:59:36 +10:00
Dale Wijnand b0baf7de6d
Merge pull request #146 from dwijnand/SourcePosition
Give SourcePosition a macro instance creator
2018-02-09 12:38:47 +00:00
Dale Wijnand ada2a8aafa
Give SourcePosition a macro instance creator 2018-02-08 13:11:34 +00:00
Seth Tisue ba5b60300d fix typo in AbstractLogger.scala filename 2018-01-30 16:19:09 -08:00
Dale Wijnand df74f78300
Merge pull request #141 from sbt/1.1.x
Merge 1.1.x into 1.x
2018-01-10 14:14:57 +00:00