Commit Graph

174 Commits

Author SHA1 Message Date
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 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
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
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
Seth Tisue ba5b60300d fix typo in AbstractLogger.scala filename 2018-01-30 16:19:09 -08:00
Dale Wijnand 5ed25cbc56
Make EscHelpers.removeEscapeSequences handle partial escape sequences
Fixes #67
2017-12-21 17:09:30 +00:00
Eugene Yokota 1388f4e52c Merge branch '1.0.x' into wip/bump_scala 2017-11-28 23:05:33 -05:00
Leonard Ehrenfried 3cc56ad0ba
Add performance test 2017-11-08 21:36:11 +01:00
Leonard Ehrenfried 48f9cf3be6
Disable calculation of log4j caller location information 2017-11-08 21:36:11 +01:00
Dale Wijnand f4eadfc259 Merge pull request #129 from sbt/1.0.x
Merge 1.0.x
2017-10-02 10:23:02 +01:00
Eugene Yokota ddb6a13feb Provide JValue pass-through 2017-09-24 06:36:18 -04:00
eugene yokota cba6f83447 Merge pull request #122 from tom-walford/1.x
Cleaned up the deprecation messages to point to the correct classes.
2017-08-28 11:43:29 -04:00
tom.walford 83433d40e6 Cleaned up the deprecation messages to point to the correct classes. 2017-08-25 20:47:36 +01:00
Eugene Yokota b2be0f766a Attempt to solve the logger NPE issue
Fixes sbt/util#119

1. perform the string codec registration once.
2. add retries.
2017-08-25 12:01:34 -04:00
Eugene Yokota f74e3e66f1 Trying to reproduce sbt/util#119 2017-08-24 17:51:50 -04:00
Dale Wijnand d31b9c5093
Add, configure & enable Scalafmt 2017-08-10 11:44:24 +01:00
Eugene Yokota 930489eba3 Fix ConsoleAppender to show full stack trace
This is modification of crash log event logging that was added in sbt/util#85.

Instead of using the hardcoded 0 as the default value, this introduces `setTrace(..)` to `ConsoleAppender` like `BasicLogger`. Also the default value is set to `Int.MaxValue` that will display the full stack trace.

Fixes sbt/sbt#3343
2017-07-26 00:03:07 -04:00
Eugene Yokota 5183f7ef81 Use event logging to send success
Fixes sbt/sbt#3213
2017-07-25 16:16:21 -04:00
Eugene Yokota d796084ff4 Filter out color in CosoleAppender only
Fixes sbt/sbt#3348
Ref #101

The new logger, based on log4j separates the concern of the log producer (Logger) and the handlers that takes actions (Appender, e.g for displaying on Console). As such filtering of color should be performed only in the ConsoleAppender.
2017-07-24 23:54:25 -04:00
Eugene Yokota f6370063f4 Deprecate ansiCodesSupported from the logger 2017-07-24 23:20:05 -04:00
Olli Helenius a38d3d6c69 Delegate ansiCodesSupported to ConsoleAppender
Fixes sbt/sbt#3336.
2017-07-18 19:57:57 +03:00
Martin Duhem ddcc909195 Re-fix ConsoleAppender
It turns out that calling `print` on `ConsoleOut` doesn't flush the
output. Remove `writeLine` and let `write` directly use `println`.
2017-07-17 14:36:03 +02:00
Dale Wijnand 81277cbf62 Merge pull request #99 from dwijnand/prereset
Add a RESET at the front of the appendLog line
2017-07-17 10:55:39 +01:00
Dale Wijnand e744985b6b
Add a RESET at the front of the appendLog line 2017-07-17 10:42:39 +01:00
Martin Duhem 28ab7ac79d
Fix logger printing too many newlines 2017-07-17 10:05:58 +02:00
eugene yokota 72f823c80b Merge pull request #91 from Duhemm/wip/cleanup-consoleappender
Cleanup `ConsoleAppender`
2017-07-15 13:17:02 -04:00
Eugene Yokota 8b5210f84d Bump to latest Contraband 2017-07-15 10:36:03 -04:00
eugene yokota 0e6e3a0a2c Merge branch '1.0' into wip/cleanup-consoleappender 2017-07-14 13:07:29 -04:00
jvican 18a73db57d
Remove unnecessary F0, F1 and Maybe
`F0`, `F1` and `Maybe` have become useless since Java 8 introduced
`Supplier`, `Function` and `Optional` in the default Java 8 standard
library.

Therefore, they are not necessary anymore. This change is required to
change some Zinc's and sbt APIs. They are not widely used, so the
changes will be small.
2017-07-14 15:56:34 +02:00
Eugene Yokota 19b3e47972 Fix casting error during initialization
While running scripted, you see

```
ERROR StatusLogger Unable to create custom ContextSelector. Falling back to default.
 java.lang.ClassCastException: Cannot cast org.apache.logging.log4j.core.async.AsyncLoggerContextSelector to org.apache.logging.log4j.core.selector.ContextSelector
	at java.lang.Class.cast(Class.java:3369)
	at org.apache.logging.log4j.util.LoaderUtil.newCheckedInstanceOf(LoaderUtil.java:201)
	at org.apache.logging.log4j.util.LoaderUtil.newCheckedInstanceOfProperty(LoaderUtil.java:226)
	at org.apache.logging.log4j.core.impl.Log4jContextFactory.createContextSelector(Log4jContextFactory.java:97)
	at org.apache.logging.log4j.core.impl.Log4jContextFactory.<init>(Log4jContextFactory.java:58)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at java.lang.Class.newInstance(Class.java:442)
	at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:94)
	at org.apache.logging.log4j.spi.ThreadContextMapFactory.createThreadContextMap(ThreadContextMapFactory.java:73)
	at org.apache.logging.log4j.ThreadContext.init(ThreadContext.java:223)
	at org.apache.logging.log4j.ThreadContext.<clinit>(ThreadContext.java:202)
	at org.apache.logging.log4j.core.impl.ContextDataInjectorFactory.createDefaultInjector(ContextDataInjectorFactory.java:83)
	at org.apache.logging.log4j.core.impl.ContextDataInjectorFactory.createInjector(ContextDataInjectorFactory.java:67)
	at org.apache.logging.log4j.core.lookup.ContextMapLookup.<init>(ContextMapLookup.java:34)
	at org.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:117)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.<init>(AbstractConfiguration.java:125)
	at org.apache.logging.log4j.core.config.DefaultConfiguration.<init>(DefaultConfiguration.java:46)
	at org.apache.logging.log4j.core.layout.PatternLayout$Builder.build(PatternLayout.java:650)
	at org.apache.logging.log4j.core.layout.PatternLayout.createDefaultLayout(PatternLayout.java:487)
	at sbt.internal.util.ConsoleAppender.<init>(ConsoleAppender.scala:245)
```

This aims to workaround the casting error during PatternLayout.createDefaultLayout()
that was originally used for ConsoleAppender.
The stacktrace shows it's having issue initializing default DefaultConfiguration.
Since we currently do not use Layout inside ConsoleAppender, the actual pattern is not relevant.
2017-07-14 07:39:05 -04:00
Martin Duhem f55a509fdd
Cleanup `ConsoleAppender` 2017-07-11 16:08:58 +02:00
Dale Wijnand 84180ec402
Move Showlines to logging to drop logging->collection dep 2017-07-03 12:04:45 +01:00
Eugene Yokota 2d777a85ee clean up warnings 2017-07-01 07:47:39 -04:00
Eugene Yokota 4e01a35917 Contraband update 2017-07-01 07:47:19 -04:00
Eugene Yokota 32d6bf38cf send TraceEvent on crash
Fixes sbt/sbt#3234
2017-06-28 02:18:03 -04:00
Eugene Yokota f2cc5ee775 convert log4j async LogEvent to an immutable one
This fixes the buffered log not showing up for tests.

Ref sbt/sbt#3198
2017-05-18 00:36:24 -04:00
Eugene Yokota feeb6291cd Add toString for ObjectEvent 2017-05-18 00:34:41 -04:00
Dale Wijnand d088d16d78
Drop (out-X) from the log output
Fixes sbt/sbt#3056
2017-04-04 14:15:01 +01:00
Eugene Yokota 1dab826ffd Store JValue into ObjectEvent 2017-04-03 03:22:33 -04:00
Eugene Yokota e21c78ebb0 Move JValue format here 2017-04-03 03:22:04 -04:00
Eugene Yokota 94a2e6cb12 Fix directory name 2017-04-03 03:21:14 -04:00
Eugene Yokota a12045ed42 some change for Scala 2.10 2017-02-15 18:52:04 -05:00
Eugene Yokota a9377ce4a6 Implements registerStringCodec
Uses TypeTag to recover the full name of type parameter, which is calculated by StringTypeTag. This is sent along in ObjectEvent.
On the other end, we can lookup typeclass instances using the tag key.
2017-02-08 05:35:49 -05:00
Eugene Yokota 6e2f77f852 ProblemFormats 2017-01-25 23:25:24 -05:00
Eugene Yokota 1320c96953 Rename log events 2017-01-25 23:15:31 -05:00
Eugene Yokota f76e3aa2bb use java.util.Optional in Position 2017-01-25 20:58:37 -05:00
Eugene Yokota 51f9f91038 Adds BufferedAppender 2017-01-24 21:13:38 -05:00
Eugene Yokota 56b51df66b Avoid default params 2017-01-24 20:29:35 -05:00
Eugene Yokota 08e9ce9526 Implement basic event logging 2017-01-23 16:38:14 -05:00
Eugene Yokota ca6a0be602 Handle ReusableObjectMessage
When log4j2 is not using async logging, it sends the ObjectMessage using ReusableObjectMessage.
2017-01-18 06:54:15 -05:00
Eugene Yokota 36eeb4578d Reimplement multi-logger using log4j2
This introduces ManagedLogger, which is a wrapper around Log4j2's async logging.
Log4j2 separates the notion of logger (the code that collects events) and appender (the code that acts on events). The old code is kept around intentionally to minimize breakage during transition.
2017-01-13 02:49:12 -05:00
Dale Wijnand 033adfe4ea
Remove deprecated methods 2016-11-15 17:14:10 +00:00
Dale Wijnand 121e7f5d9e Add -Ywarn-unused & -Ywarn-unused-import, & fix warnings 2016-06-19 11:42:31 +01:00
Eugene Yokota 299484cee6 Remove some warnings 2016-04-01 15:27:37 -04:00
Eugene Yokota 277cbd12ef Adds concrete classes 2015-12-17 00:57:24 -05:00
Eugene Yokota 70b49e9a4b Comment on SI-8450 2015-09-07 01:45:39 -04:00
Eugene Yokota dc0fd2d48b move sbt.internal.util.Logger into sbt.util 2015-09-07 01:31:17 -04:00
Eugene Yokota 0a2d39673c sbt.util.internal -> sbt.internal.util package 2015-09-05 00:51:58 -04:00
Eugene Yokota bc54e035ef Move util into sbt.util.internal package 2015-09-04 12:54:38 -04:00
Martin Duhem 6175d92338 Add recommended compiler flags, fix most of the warnings 2015-08-31 15:25:10 +02:00
Eugene Yokota 871b4f4eef move modules around. 2015-08-20 00:59:57 -04:00