Commit Graph

3009 Commits

Author SHA1 Message Date
Naoki Takezoe 5ce3a174e8 Reset ZipEntry timestamps to 2010-01-01 in order to prevent negative value 2021-01-14 08:32:50 +09:00
Adrien Piquerez fdcfe87dbf
Merge branch 'develop' into client-launch-jar 2021-01-11 13:20:49 +01:00
Eugene Yokota 8f5759e48d Cross build to Scala 2.13 2021-01-10 20:24:05 -05:00
Eugene Yokota f8c158291d Work around Scala parallel collections situation
Ref https://github.com/scala/scala-parallel-collections/issues/22

Parallel collection got split off without source-compatible library, so apparently we need to roll our own compat hack, which causes import not used, so it needs to be paired with silencer.
2021-01-10 18:02:18 -05:00
Eugene Yokota ab402543d3 Replace the unicode arrows 2021-01-10 14:20:43 -05:00
Eugene Yokota 6d2a516df5 Port XMainConfiguration to Java
The bytecode generated by 2.13 compiler contains scala.runtime.BoxedUnit in the constant pool. To avoid referencing scala-library, port XMainConfiguration to Java.
2021-01-10 14:17:26 -05:00
Adrien Piquerez 8f5c222a0c Introduce tastyFiles task 2021-01-04 18:43:49 +01:00
Adrien Piquerez ab345e0a71 Adapt sources and scalacOptions for scala3doc 2021-01-04 10:01:34 +01:00
Adrien Piquerez 5f4197cf2e Use scala-doc-tool config for scala3doc 2021-01-04 10:01:34 +01:00
Adrien Piquerez 521e80b61b Fix semanticdb on Scala > 3.0.0-M3 2020-12-25 17:34:06 +01:00
Adrien Piquerez 166a421a26 Fix Scala 3 consoleProject and add scripted test 2020-12-23 21:21:54 +01:00
Adrien Piquerez 4b91541a69 Fix MetaBuildLoader on local snapshot deps 2020-12-23 21:20:59 +01:00
Adrien Piquerez 2d75cbd3b9 Manage .tasty files in Scala 3 2020-12-23 21:20:59 +01:00
Adrien Piquerez 08b83d6b31 Fetch Scala 3 compiler bridge binary module
Contrary to Scala 2, Scala 3 compiler bridges are tied to the compiler
version. There is one compiler bridge foreach compiler version.
Scala compiler bridges are pure java so they are binary compatible with
all Scala version. Consequently, we can fetch the binary module directly
without using the ZincCompilerBridgeProvider.
2020-12-23 21:20:59 +01:00
Adrien Piquerez c9478529e6 Manage Scala 3 instances 2020-12-23 21:20:24 +01:00
eugene yokota f9d8d8c45f
Merge pull request #6221 from eed3si9n/wip/eviction_error
Replace EvictionWarning with EvictionError
2020-12-23 13:03:30 -05:00
João Ferreira 08eaa9fb3b regen contraband 2020-12-21 17:21:54 +00:00
Eugene Yokota 1111ed09ad Replace EvictionWarning with EvictionError
Fixes https://github.com/sbt/sbt/issues/5976
Ref https://eed3si9n.com/enforcing-semver-with-sbt-strict-update

This removes the guess-based EvictionWarning, and runs EvictionError instead.
EvictionError uses the `ThisBuild / versionScheme` information supplied by the library authors in addition to `libraryDependencySchemes` that the build users could provide:

```scala
ThisBuild / libraryDependencySchemes += "com.example" %% "name" % "early-semver"
```

as the version scheme "early-semver", "semver-spec", "pvp", "strict", or "always" may be used.
Here's an example of `update` failure:

```
[error]  * org.typelevel:cats-effect_2.13:3.0.0-M4 (early-semver) is selected over {2.2.0, 2.0.0, 2.0.0, 2.2.0}
[error]      +- com.example:use2_2.13:0.1.0-SNAPSHOT               (depends on 3.0.0-M4)
[error]      +- org.http4s:http4s-core_2.13:0.21.11                (depends on 2.2.0)
[error]      +- io.chrisdavenport:vault_2.13:2.0.0                 (depends on 2.0.0)
[error]      +- io.chrisdavenport:unique_2.13:2.0.0                (depends on 2.0.0)
[error]      +- co.fs2:fs2-core_2.13:2.4.5                         (depends on 2.2.0)
[error]
[error]
[error] this can be overridden using libraryDependencySchemes or evictionErrorLevel
```

This catches the violation of cats-effect_2.13:3.0.0-M4 version scheme (early-semver) without user setting additional overrides. If the user wants to opt-out of this, the user can do so per module:

```scala
ThisBuild / libraryDependencySchemes += "org.typelevel" %% "cats-effect" % "always"
```

or globally as:

```
ThisBuild / evictionErrorLevel := Level.Info
```
2020-12-21 00:24:39 -05:00
Ethan Atkins 0a8e8a45d0 Catch RejectedExecutionException in MainLoop
sbt 1.4.x was printing a very verbose and annoying
RejectedExectionException when the user cancelled tasks with ctrl+c.

Fixes #6192
2020-12-18 16:57:27 -08:00
Adrien Piquerez f38a7272e7 Remove dotty tool dependencies 2020-12-17 10:24:07 +01:00
Adrien Piquerez c9ab2ee558 Put compiler-interface in the Scala Instance top loader 2020-12-11 11:47:08 +01:00
Matthias Kurz 0dc7622969
Use identity 2020-12-04 00:36:48 +01:00
Matthias Kurz 8e48630376
onLoad now runs with correct FileTreeRepository and CacheStoreFactory 2020-12-04 00:01:47 +01:00
Erlend Hamnaberg a554976ffb Update main/src/main/scala/sbt/internal/server/BuildServerProtocol.scala
Change from review

Co-authored-by: Adrien Piquerez <adrien.piquerez@gmail.com>
2020-11-29 16:36:38 +01:00
Ethan Atkins b70bdce683 Set the exit value when sbt is started with -client 2020-11-27 12:12:15 -08:00
Erlend Hamnaberg 341e09a07e Make it possible to not write the bsp connection file
Made the bspConfig task dependendant on the bspConfig value.
Changed the bspConfig setting to use a attributeKey so we can use it in the server as well.
2020-11-27 20:00:12 +01:00
João Ferreira e1d8f0cafd
Updates to Coursier 2.0.7 (#6120)
* Updates to Coursier 2.0.7

https://github.com/coursier/sbt-coursier/releases/tag/v2.0.4 which includes https://github.com/coursier/coursier/releases/tag/v2.0.7

> Memo-ize classes that can be created at a high rate

coursier.core.{Dependency, Module, Publication} are now memo-ized (using weak references). This can lower the amount of duplicate instances of these objects, and lower GC pressure.
2020-11-26 19:25:37 -05:00
Ethan Atkins 5c508e4275 Fix waitWatch failure handling
The waitWatch command is very similar to shell in that it should
override the onFailure command to be itself. It also enqueues itself to
remaining commands whenever it reads a new command which made it
unnecessary to append waitWatch to the runCommmand in Continuous.
2020-11-25 14:54:13 -08:00
eugene yokota 1051690d61
Merge pull request #5515 from jtjeferreira/better_file_input
introduce a new Input/Output: FileInput/FileOutput
2020-11-25 11:11:04 -05:00
João Ferreira dd411cac9f introduce a new new Input/Output: FileInput/FileOutput
* FileInput avoids the intermediate String parsing of PlainInput
* FileOuput also avoid the intermediate String representation of PlainOutput
2020-11-25 14:04:56 +00:00
Ethan Atkins c6ab4d843e Fix watch shell option
When a user returns to the shell with 's' in recent versions of sbt, the
prompt is not initially displayed. This ends up being because MainLoop
was incorrectly setting the terminal prompt to Prompt.Watch when it
exited watch. I realized in debugging the issue that it didn't make
sense to restort the terminal prompt to the initial value before task
evaluation. By removing that logic, the 's' option option started
working correctly again.
2020-11-23 14:25:11 -08:00
Ethan Atkins ab2875e837 Use jni implementation of ipcsocket apis on arm macs
There isn't yet a version of the jna available that works with the new
apple silicon using arm64. To workaround this, we can use the jni
implementation by default on arm64 macs. If the user wants to force the
jni implementation for any supported platform, they can opt in with the
`sbt.ipcsocket.jni` system property and/or by setting the serverUseJni
setting.
2020-11-23 12:31:15 -08:00
Ethan Atkins a9957e5d73 Make the thin client `cancel` command work reliably
When the sbt server is running a task, it presents all connected clients
with a message that instructs them that they cancel the running task.
Unfortunately, this often didn't work and the task would keep running
after cancel was entered. The reason for this was because the exec id
passed in to NetworkChannel did not necessarily match the exec id of the
running task. Because cancel in this case is not really exec specific,
this commit adds a flag to NetworkChannel.cancel that forces it to
cancel the running task regardless of what execID is passed in.
2020-11-23 10:05:47 -08:00
Eugene Yokota 00265bf912 Work around "a pure expression does nothing" warning, take 2
In https://github.com/sbt/sbt/pull/5981 I tried to work around the spruious post-macro "a pure expression does nothing" warning (https://github.com/scala/bug/issues/12112) by trying to remove some pure-looking expressions out of the tree.

This quickly backfired when it was reported that sbt 1.4.3 was not evaluating some code. This backs out the macro-level manipulation, and instead try to silence the warning at the reporter level. This feels safer, and it seems to work just as well.
2020-11-22 17:04:19 -05:00
Eugene Yokota bd7a2e05bf Use `Global / localCacheDirectory` for remote caching
Fixes https://github.com/sbt/sbt/issues/6102

https://github.com/sbt/sbt/pull/6026 changed the implementation of remote cache to NOT use dependency resolution (Coursier), and directly use Ivy resolver for efficiency. This was good, but when I made the change, I've changed the cache directory to be `crossTarget.value / "remote-cache"`. This was ok for local testing purpose, but not great for real usage since we don't want the cache to be wiped out either in the CI machines or on a local laptop.

This adds a new Global key called `localCacheDirectory`. Similar to Coursier cache, this is meant to be shared across all builds running on a machine. Also similar to Coursier cache this will try to follow the operating system specifc caching directory.

### localCacheDirectory location

- Environment variable: `SBT_LOCAL_CACHE`
- System property: `sbt.global.localcache`
- Windows: %LOCALAPPDATA%\sbt\v1
- macOS: $HOME/Library/Caches/sbt/v1
- Linux: $HOME/.cache/sbt/v1
2020-11-22 14:35:20 -05:00
eugene yokota f4f8b6a97e
Merge pull request #6151 from eatkins/scripted-batch-execution
Only set scriptedBatchExcution true for >= 1.4
2020-11-21 13:41:01 -05:00
Ethan Atkins d686bead0b Only set scriptedBatchExcution true for >= 1.4
In #6091, we updated the ScriptedPlugin to set scriptedBatchExecution :=
true for all 1.x versions but not 0.13. This commit further restricts
the setting so that it is only set for sbt >= 1.4, which seems necessary
based on the comments in #6094.
2020-11-21 08:31:49 -08:00
Adrien Piquerez 136d0ab297 Bump semanticdb version 2020-11-21 16:43:40 +01:00
Ethan Atkins 5448a16ba4 Prepend scala instance jars to sbt classpath
When using the launcher's classpath for the metabuild, the
scala-compiler jar can be missing. This is because the managedJars only
method returns the scala-library jar and not the rest of the scala
instance. To fix this, we can always prepend the scala instance jars to
the classpath.

In order to simulate the issue in scripted, I had to manually remove the
scala-compiler.jar from the scripted classpath or else the scripted test
that I added doesn't actually do anything because the scala-compiler.jar
would end up on the app.provider.mainClasspath.

Fixes #4452
2020-11-20 13:11:24 -08:00
Ethan Atkins 62ebe70e5c
Merge branch 'develop' into bsp-watch-fix 2020-11-20 07:51:26 -08:00
Ethan Atkins 8ee28d5693
Merge branch 'develop' into bsp-consolidate 2020-11-20 07:29:35 -08:00
Ethan Atkins 14dee32d6b Stop CI hangs in background job service shutdown
A periodic stacktrace showed that scripted tests were still hanging in ci
trying to shutdown the background job service (I had previously thought
that I'd fixed that in 16bef0cfc8). It
appears that there is a logical bug that prevents some jobs from being
removed from the jobSet even though they have finished. If that happens,
the shutdown will never exit. That is highly undesirable and can be
avoided by adding a timeout and also only trying to shutdown the job if
it is actually running.
2020-11-19 22:26:41 -08:00
Ethan Atkins 600628e8e9 Fix watch with metals sbt bsp implementation
I discovered that the metals bsp implementation worked very badly with
continuous builds. The problem was that metals is able to trigger a bsp
compile slightly before the continuous build would trigger. This would
cause the ui to get in a bad state. The worst case was that it would
actually cause sbt (or the thin client) to exit. A less catastrophic
issue was that it was possible for the wrong count to be printed by the
continuous message.

This commit fixes the issue by more carefully managing the prompt state
and only resetting the ui when the prompt is not in the Prompt.Watch
state.
2020-11-19 18:57:24 -08:00
Ethan Atkins 7a8a5e5dac Disable console ui for client launched server
If the sbt server is launched by the remote client, it should not have a
console ui thread because there is no way to even feed input to it once
the server has launched. Having the ui thread can cause the server to
exit unexpectedly if an EOF is read from the console input stream.
2020-11-19 16:10:03 -08:00
Ethan Atkins f3b3148c58 Use NetworkClient to implement `sbt -bsp`
Network client already supports the -bsp command (since
65ab7c94d0). This commit reworks the
BspClient.run method so that it delegates to the NetworkClient. The
advantage to doing it this way is that improvements to starting up the
sbt server by the thin client will automatically propagate to the -bsp
command. The way that it is implemented, all of the output generated
during server startup will be redirected to System.err which is useful
for debugging without messing up the bsp protocol, which relies on only
bsp messages being written to System.out.
2020-11-19 16:03:26 -08:00
eugene yokota f4921e3dd7
Merge pull request #6105 from eatkins/jline3-upgrade
JLine 3.17.1
2020-11-18 22:31:02 -05:00
eugene yokota 9985cb4b1c
Merge pull request #6115 from eatkins/thin-client-startup
Fix thin client sbt process startup output
2020-11-18 18:26:28 -05:00
Ethan Atkins 8137c80782 Fix thin client sbt process startup output
The boot server socket was not working correctly when the sbt server was
started by the thin client. This was because it is necessary for us to
create a ConsoleTerminal in order for System.out and System.err to be
properly forwarded to the clients connected over the boot server socket.
As a result, if you started a server instance of sbt with the thin
client, you wouldn't see any output util you connected to the server.
The fix is to just make sure that we create a console terminal if sbt is
run as a subprocess.
2020-11-18 12:38:44 -08:00
Ethan Atkins 39af464dfd Fix shutdown for thin client shell
When a user enters shutdown in the thin client console, it only exits
the thin client, it does not actually shutdown sbt. Running `sbtn
shutdown` did work to shutdown the server, however. It turned out that
this was because there was special handling for shutdown when processed
through jline. We would enqueue the shutdown command and also close the
client connection. Closing the client connection though removed all of
the enqueued commands for the client, which included the shutdown
command. To fix this, we just make sure that we don't remove the
shutdown command when clearing the client commands.
2020-11-18 12:20:48 -08:00
Ethan Atkins c34678e9db Upgrade jline 3
We no longer need to use the forked version of jline because they have
merged in our required changes. The latest version of jline does upgrade
jansi, however, and some of the apis we were relying on for windows were
removed so they had to be manually implemented. I verified that console
input still worked on my windows vm after this change.
2020-11-18 12:18:08 -08:00