Commit Graph

10070 Commits

Author SHA1 Message Date
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
eugene yokota 872fde1144
Merge pull request #5998 from eatkins/ansi-color-fixes
Fix more color/ansi issues
2020-10-21 14:31:31 -04:00
Ethan Atkins c46de920ab Enable color by default in ci builds
This channge should turn color on by default in ci builds (see
https://github.com/sbt/sbt/issues/5269). It can still be disabled with
-Dsbt.color=false.
2020-10-21 08:01:12 -07:00
Ethan Atkins a892a83681 Only disable virtual io automatically in ci
Disabling virtual io prevents the thin client from working. It is
possible that a user may manually start a server with -Dsbt.color=false
but still want to connect a thin client.
2020-10-21 08:01:12 -07:00
Ethan Atkins 6f63b2ccfa Don't ever use jline 3 dumb terminal
When using the DumbTerminal, no input is successfully read. I must not
have actually tested this when I added it.
2020-10-21 08:01:12 -07:00
Ethan Atkins 3d179cda75 Enable ansi codes if supershell is enabled
Running sbt with -Dsbt.supershell=true and -Dsbt.color=true doesn't work
well because the isAnsiSupported flag is set to false when
-Dsbt.color=false. This causes the processing that ensures that
supershell lines do not get interleaved with normal log lines to be
skipped. To fix this, we can enable ansi codes when supershell is
explicitly enabled.
2020-10-21 08:01:12 -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
Ethan Atkins 29d9c14edf Improve log formatting logic for ci use cases
It is currently the case that all tagged log messages going through a
ConsoleAppender have color codes added and then subsequently stripped
out. This didn't work well in combination with -Dsbt.color=true and
-Dsbt.ci=true because the -Dsbt.color=true was causing
ConsoleAppender.formatEnabledInEnv to be set to true which caused ansi
codes to be enabled. Travis CI supports color codes but not other ansi
escape sequences (this is also often true of embedded shells like in
intellij or jedit). This commit reworks the ConsoleAppender so that we
only add colors if useFormat is enable dand only add
ClearScreenAfterCursor if ansi codes are supported. It also reworks the
ConsoleAppender.write method so that if useFormat is true but
ansiCodesSupported is false that we only remove the non color related
ansi escape sequences so that colors remain.
2020-10-21 08:01:12 -07:00
eugene yokota d1ff067d54
Merge pull request #6000 from eatkins/canonical-ctrl-d
Handle ctrl+d in canonical mode
2020-10-20 22:58:50 -04:00
Ethan Atkins 82d6a050de Handle ctrl+d in canonical mode
In canonical mode, System.in will return -1 for ctrl+d on an empty line.
The result of this behavior was that if a user entered ctrl+d during run
in a task that was reading from System.in, sbt would end up exiting
whenever the task exited. This happened because the WriteableInputStream
would close itself when it read -1 from the input stream, which it
assumed meant that the underlying input stream itself had been closed.
When the jline reader tried to read from the closed
WriteableInputStream, it would throw an exception and if the line reader
was for the console channel, it would be interpreted as the user had
inputted ctrl+d in the sbt shell which is supposed to exit sbt. This
change fixes that behavior so that sbt can continue reading input after
the run task exits.
2020-10-20 16:57:17 -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 73ba82f390
Merge pull request #5990 from eed3si9n/wip/cfm-logger
Properly log the ClassfileManager output
2020-10-19 14:51:04 -04:00
eugene yokota cb796f6b0b
Merge pull request #5989 from eed3si9n/wip/bump
sjson-new 0.9.1
2020-10-19 14:05:59 -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 6b70a9425f sjson-new 0.9.1 2020-10-19 12:35:58 -04:00
eugene yokota 8bea523aea
Merge pull request #5981 from eed3si9n/wip/pure-expression
Work around "a pure expression does nothing" warning
2020-10-19 12:26:41 -04:00
eugene yokota 0ecf120008
Merge pull request #5987 from eed3si9n/wip/bump
Zinc 1.4.1
2020-10-19 09:56:43 -04:00
Eugene Yokota 8007d08158 Zinc 1.4.1 2020-10-19 01:47:11 -04:00
eugene yokota 2f7cc6e9e9
Merge pull request #5985 from xirc/use-lint-xxx-filter-in-test
Use lint***Filter instead of ***LintKeys for more reliable tests
2020-10-18 14:01:17 -04:00
Eugene Yokota b62ddaa4e9 setType to Block(...) 2020-10-18 13:56:01 -04:00
Taichi Yamakawa 1193f44be2 Use lint***Filter instead of ***LintKeys for more reliable test
Below functions pass lintIncludeFilter and lintExcludeFilter to lintUnusedinstead of includeLintKeys and excludeLintKeys respectively.
- sbt.internal.LintUnused#lintUnusedTask
- sbt.internal.LintUnused#lintUnusedFunc
Therefore, in the test, we had better to use lint***Filter instead of ***LintKeys.
2020-10-18 18:20:23 +09:00
eugene yokota 28833db333
Merge pull request #5983 from xirc/issues/5955
Add `shellPrompt` into excludeLintKeys
2020-10-18 04:06:28 -04:00
eugene yokota a9f62f8453
Merge pull request #5984 from xuwei-k/dotty-sandwich-scala-js
Scala-2-dependsOn-Scala-3 feature with Scala.js
2020-10-18 04:05:43 -04:00
Eugene Yokota a44aee9ac1 Strip out raw Ident(_) in blocks if it's synthetic 2020-10-18 03:15:10 -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 b5bd3b0211
Merge branch 'develop' into issues/5955 2020-10-18 15:00:48 +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
kenji yoshida 84b84ec58d
Update dotty versions in scripted tests (#5982) 2020-10-18 14:06:44 +09:00
Eugene Yokota 3a1463bb7d Try to workaround "a pure expression does nothing" warning
Ref https://github.com/scala/bug/issues/12112

Current app transformation macro creates a tree that looks like:

```scala
FullInstance.app[[T0[x]](T0[Int], T0[Int]), Unit](scala.Tuple2(task2, task1), (($p$macro$3: (Int, Int)) => {
  <synthetic> val $q$macro$2: Int = $p$macro$3._1;
  <synthetic> val $q$macro$1: Int = $p$macro$3._2;
  {
    ($q$macro$1: Int);
    ($q$macro$2: Int);
    ()
  }
}))(AList.tuple2[Int, Int])
```

Starting Scala 2.12.12 the compiler's "pure expression does nothing" has become more enthusiastic/accurate in its reach, and it started warning about the naked reference to `$q$macro$1` that appears to do nothing, even though in reality it would trigger the tasks and do something in the context of sbt. It's just _that_ particular line ends up macroed away into a pure expression.

A somewhat bizarre workaround is to make a fake call to a method just to satisfy this warning. I've chosen `scala.Predef.identity` here so it can be composed together with the existing expression nesting when they exist.
2020-10-17 20:03:09 -04:00
eugene yokota 3266d77862
Merge pull request #5979 from eed3si9n/wip/junit
bump JUnit
2020-10-17 05:00:02 -04:00
Eugene Yokota 7ba59dba9a bump JUnit
There's a security advisory on JUnit 4.
2020-10-17 04:11:33 -04:00
eugene yokota 2dc799b2bd
Merge pull request #5975 from eatkins/ctrl+d
Don't throw ClosedException on ctrl+d
2020-10-15 14:36:59 -04:00
Ethan Atkins 72991be702 Don't throw ClosedException on ctrl+d
Issue #5974 reported that ctrl+d was not working as expected in the
scala 2.13.{2,3} console. This was because we were throwing an exception
whenever ctrl+d was read instead of allowing the jline line reader to
handle it. I can't remember exactly why I added the throw here but I
validated that both the sbt shell and the scala console had the expected
behavior from the comments in #5974 after this change.
2020-10-14 20:25:31 -07:00
eugene yokota b4b688583e
Merge pull request #5973 from xuwei-k/jline-3-inputrc
load .inputrc file
2020-10-14 08:32:18 -04:00
xuwei-k 244784c78e load .inputrc file
I think jline2 automatically load ".inputrc" file. But jline3 changed behavior.
2020-10-14 17:13:53 +09:00
Ethan Atkins 8e4ec1697b
Merge pull request #5972 from eatkins/symlink-target
Check if target is directory before creating
2020-10-13 20:02:51 -07:00
Ethan Atkins efec7bce31 Check if target is directory before creating
When project/target is a symbolic link, sbt 1.4.0 crashes on startup
because Files.createDirectories will throw a FileAlreadyExistsException.
The fix is to first check if the target directory exists before trying
to create it.
2020-10-13 08:17:22 -07:00
eugene yokota ca8c1e704d
Merge pull request #5939 from eatkins/running-init
Initialize value before starting thread
2020-10-11 15:39:54 -04:00
Ethan Atkins f3f40d6442 Initialize value before starting thread
Depending on how quickly the thread starts up, this can cause an NPE
(see #5938).
2020-10-11 11:39:16 -07: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