Commit Graph

418 Commits

Author SHA1 Message Date
Eugene Yokota 56941dac04 refactor: Update Scala 3 syntax 2024-10-27 23:55:30 -04:00
Eugene Yokota 14f7d29afc Contraband 0.7.0 2024-10-27 16:21:18 -04:00
xuwei-k 6922915949 use extension instead of implicit class 2024-10-26 09:05:27 +09:00
xuwei-k ec70bae39a use extension instead of implicit class 2024-10-23 07:05:38 +09:00
xuwei-k 6406124aeb add `codecPackage` annotation to `state.contra` 2024-10-19 07:31:07 +09:00
xuwei-k 6bf5b8b30f Update contraband sources 2024-10-18 20:34:44 +09:00
xuwei-k cfb9ffea95 remove deprecated `[this]` qualifier
https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html
2024-10-03 21:16:48 +09:00
Eugene Yokota c37b7a1555 feat: Non-blocking run
**Problem**
`run` currently blocks all other commands, such as BSP commands.

**Solution**
`run` no longer blocks the command execution loop.
Instead it pauses the prompt on the current command channel.
2024-09-20 04:00:03 -04:00
Karl Yngve Lervåg 5387386c21 fix: serverIdleTimeOut -> serverIdleTimeout
Use consistent name for the option. The variable is named `serverIdleTimeout` and this also seems the proper camelcasing of the words.
2024-09-10 23:31:50 +02:00
Eugene Yokota c81d269ed2 Merge branch '1.10.x' into wip/merge-1.10.x 2024-05-07 04:39:25 -04:00
Adrien Piquerez 2e439cab1e [2.x] report cache errors
Report a cache error if the output file of a task is not cacheable
2024-04-24 10:41:56 +02:00
Adrien Piquerez 03ca5365f5 Fix BuildServerTest 2024-03-19 17:06:09 +01:00
Adrien Piquerez 0458e8063d Adapt -Wunused 2024-03-05 11:23:00 +01:00
Adrien Piquerez c15a4031a9 Fix or mute warnings 2024-03-05 10:39:00 +01:00
adpi2 64be877549
Merge pull request #7491 from adpi2/misc-cleanup
[2.x] Miscellaneous cleanup
2024-02-08 17:42:35 +01:00
eugene yokota ecca26175e
[sbt 2.x] remote cache (#7464)
For the details about this PR, please see the blog post https://eed3si9n.com/sbt-remote-cache/.

* Add cache basics
* Refactor Attributed to use StringAttributeMap, which is Map[StringAttributeKey, String]
* Implement disk cache
* Rename Package to Pkg
* Virtualize packageBin
* Use HashedVirtualFileRef for packageBin
* Virtualize compile task
2024-02-07 10:34:06 -05:00
Adrien Piquerez e18ddb1666 Fix resolution of * on String 2024-02-07 11:47:22 +01:00
adpi2 d53ccda9c4
Merge branch '1.10.x' into commands-progress 2023-10-04 09:49:05 +02:00
Matthew de Detrich 47344d264d
Remove invalid test 2023-09-13 22:34:41 +02:00
eugene yokota f7025eff6a
Merge pull request #7087 from mdedetrich/increase-socket-backlog-for-server-client
Set socket backlog to default size of 50
2023-09-13 11:07:44 -04:00
azdrojowa123 bc00cee4df
Add comment to https://github.com/sbt/sbt/pull/7358 (#7362)
comment for new condition in sbt.BasicCommands.runHelp
2023-08-28 10:48:06 -04:00
Iulian Dragos 86df6e0606
Deprecate overloaded process method 2023-08-28 11:49:29 +02:00
azdrojowa123 7c400081a1
Fix help command for shells (#7358)
* sbt-help-fix
* fix BasicCommands.scala formatting
2023-08-25 12:01:49 -04:00
Iulian Dragos 0f53349ce9
Add method overload to keep binary compatibility 2023-08-08 09:54:09 +02:00
Iulian Dragos 82ae293e3f
Add a new CommandProgress API.
In addition to ExecuteProgress, this new interface allows builds and plugins to receive events when commands start and finish, including the State before and after each command. It also makes cancellation visible to clients by making the Cancelled type top-level.
2023-08-07 17:09:30 +02:00
xuwei-k 6c032b8283 some trivial refactoring
- remove unused type params
- use `withFilter` if possible
- use `collectFirst` instead of `collect` and `headOption`
- use `length` instead of `size` if `Array` or `String`
- use `foreach` instead of `map`
2023-06-25 08:57:41 +09:00
xuwei-k 2edb4dcbb6 fix typo 2023-06-24 20:05:52 +09:00
Julien Richard-Foy 72bfb3f45a Transfer copyright to Scala Center 2023-06-20 16:39:07 +02:00
Eugene Yokota 731af0173c Add init as an alias to new 2023-05-07 14:17:26 -04:00
Eugene Yokota cba7a0efc3 Refactor to build mainProj 2023-01-15 23:48:11 -05:00
Eugene Yokota 4ff27d7ab7 Port commandProj 2023-01-15 23:43:15 -05:00
Matthew de Detrich 6611ccf94d
Set socket backlog to default size of 50 2022-12-08 11:21:43 +01:00
Eugene Yokota bbc91a4788 Merge branch '1.7.x' into fport/1.7.x 2022-08-10 21:53:50 -04:00
Eugene Yokota 87dc5da93a Fix sbt trying to delete /tmp on ARM Macs
Problem
-------
There's a bug in ipcsocket cleanup logic that effectively
tries to wipe out /tmp.

Workaround
----------
We should fix the underlying bug, but we can start by
explicitly configuring the temp directories ipcsocket uses.

Ref https://github.com/sbt/sbt/issues/6931
2022-06-25 18:58:19 -04:00
Eugene Yokota 060a85f0d5 Merge branch '1.7.x' into wip/merge-1.7.x 2022-06-13 02:27:30 -04:00
Alonso Montero 120014bd65 Use XDG_RUNTIME_DIR environment variable to choose the path used for the creation of sockets (#6887)
The `XDG_RUNTIME_DIR` environment variable will be used to choose the base directory in which the sockets will be created by **sbt**. This can help when issues such as #6777 appear. There are other related issues, such as #6101, [Metals issue #2235](https://github.com/scalameta/metals/issues/2235), [Che issue #18394](https://github.com/eclipse/che/issues/18394). Those are closed issues, but there are some cases in which the solution does not work (such as the case in #6777). Furthermore, the solution given seems more like a workaround than an actual fix.

**What causes this issue?**
At least in my case, the **ServerAlreadyBootingException** is thrown after **sbt** tries to create a Unix domain socket and fails. In my specific environment, I was not able to create the sockets in some directories because they were mounted on an NFS. This prevented me from using any automated sbt command on any of those directories (Metals uses sbt under the hood, and it was not able to start because of the ServerAlreadyBootingException), which in turn resulted in me not being able to use Metals on a project that was created on any of those directories. 

**How is the issue solved in this PR?**
If the `XDG_RUNTIME_DIR` environment variable is set, then sockets will be created in a folder with a hashed name, inside the directory `XDG_RUNTIME_DIR/.sbt/`. If this variable is not set, everything works exactly the same as always.

Let's see an example:

1. My environment variable `XDG_RUNTIME_DIR` is set to /home/alonso/.runtime-dir`
2. I create my project in `/home/alonso/workspace/hello-world`
3. I run `sbt compile`
4. The socket is created in `/home/alonso/.runtime-dir/.sbt/sbt-socket102030405060/sbt-load.sock`. The number **102030405060** is a hash that is computed from the base directory of the project (it is actually the same hash that is produced in order to create sockets in Windows) and it will be different depending on the location of the project
5. The sbt command executed correctly, which would not have happened if the socket had been created in the `home/alonso/workspace` directory or any of its subdirectories (in this example, `/home/BlackDiamond/workspace` corresponds to a network file share)

Co-authored-by: Alonso Montero <lumontero@mobilize.net>
2022-05-28 23:38:56 -04:00
Alonso Montero 86fd6dc058
Use XDG_RUNTIME_DIR environment variable to choose the path used for the creation of sockets (#6887)
The `XDG_RUNTIME_DIR` environment variable will be used to choose the base directory in which the sockets will be created by **sbt**. This can help when issues such as #6777 appear. There are other related issues, such as #6101, [Metals issue #2235](https://github.com/scalameta/metals/issues/2235), [Che issue #18394](https://github.com/eclipse/che/issues/18394). Those are closed issues, but there are some cases in which the solution does not work (such as the case in #6777). Furthermore, the solution given seems more like a workaround than an actual fix.

**What causes this issue?**
At least in my case, the **ServerAlreadyBootingException** is thrown after **sbt** tries to create a Unix domain socket and fails. In my specific environment, I was not able to create the sockets in some directories because they were mounted on an NFS. This prevented me from using any automated sbt command on any of those directories (Metals uses sbt under the hood, and it was not able to start because of the ServerAlreadyBootingException), which in turn resulted in me not being able to use Metals on a project that was created on any of those directories. 

**How is the issue solved in this PR?**
If the `XDG_RUNTIME_DIR` environment variable is set, then sockets will be created in a folder with a hashed name, inside the directory `XDG_RUNTIME_DIR/.sbt/`. If this variable is not set, everything works exactly the same as always.

Let's see an example:

1. My environment variable `XDG_RUNTIME_DIR` is set to /home/alonso/.runtime-dir`
2. I create my project in `/home/alonso/workspace/hello-world`
3. I run `sbt compile`
4. The socket is created in `/home/alonso/.runtime-dir/.sbt/sbt-socket102030405060/sbt-load.sock`. The number **102030405060** is a hash that is computed from the base directory of the project (it is actually the same hash that is produced in order to create sockets in Windows) and it will be different depending on the location of the project
5. The sbt command executed correctly, which would not have happened if the socket had been created in the `home/alonso/workspace` directory or any of its subdirectories (in this example, `/home/BlackDiamond/workspace` corresponds to a network file share)

Co-authored-by: Alonso Montero <lumontero@mobilize.net>
2022-05-26 23:10:41 -04:00
dmitrii.naumenko 9565e33ea8 "oldshell" command should use `OldShell` on failure instead of `Shell`
following up https://github.com/sbt/sbt/pull/3098
2022-05-23 19:58:41 +03:00
xuwei-k f6ff6996a5 fix typo 2022-05-23 07:37:34 +09:00
Philippus 11275f604c Fix typos 2022-04-17 18:32:38 -04:00
Philippus 20a9269e79 Add SBTN_AUTO_COMPLETE environment variable 2022-04-17 18:32:30 -04:00
Philippus 1d3b9143a4
Fix typos 2022-04-17 12:59:28 +02:00
Philippus cf976885f7
Add SBTN_AUTO_COMPLETE environment variable 2022-04-17 12:59:28 +02:00
David Francoeur a448b1caab
Load credentials from SBT_CREDENTIALS (#6724)
Load credentials from SBT_CREDENTIALS
Prefer sys.env to System.getenv
2021-11-27 02:44:49 -05:00
eugene yokota b3aae681bf
Merge pull request #6711 from xuwei-k/fix-scala-2-13-warn
fix Scala 2.13 warnings
2021-11-14 21:53:57 -05:00
xuwei-k 535b15b83e fix Scala 2.13 warnings 2021-11-14 22:59:34 +09:00
xuwei-k aa8b1141f8 Update scalatest 2021-11-14 22:03:59 +09:00
Adrien Piquerez 5d5edf2fdc Fix infinte loop when server fails to load with batch client
Shut down server when it is waiting for user input
but stdin has ended.
2021-11-11 22:35:18 +01:00
Samuel CLARENC e3f2371655
Merge branch 'develop' into bspStartTry 2021-07-26 16:12:41 +02:00
Samuel CLARENC 964c1cbaa4 Use java home to launch BSP server 2021-07-26 11:40:53 +02:00