Commit Graph

405 Commits

Author SHA1 Message Date
Eugene Yokota ff328a092d Improve sbtn a bit
1. Remove experimental warning.
2. Buffer the boot log so ANSI output is fixed for JVM client.
3. Remove timestamp.
2025-08-24 03:58:13 -04:00
Eugene Yokota 9d4cc80a80 Shortcut sbtn shutdown
**Problem**
WHen portfile is not found, sbtn will try to start the server
even when the desired command is shutdown.

**Solution**
When the command is just shutdown, don't start the server.
2025-03-05 02:27:46 -05:00
Eugene Yokota 67265638c6 Implement client-side run
**Problem**
`run` task blocks the server, but during the run the server is just
waiting for the built program to finish.

**Solution**
This implements client-side run where the server creates a sandbox
environment, and sends the information to the client,
and the client forks a new JVM to perform the run.
2025-03-02 20:45:04 -05:00
Eugene Yokota a75e847a08 refactor: Refactor response handler
**Problem**
The sbtn response handling code is relatively stragightforward,
but it's a bit messy.

**Solution**
This cleans it up a bit, similar to the style used by Unfiltered
back then (not sure how Unfiltered plans are written nowadays) by
expressing each event handling as a partial function, and composing them
together using `orElse`.
2025-02-09 18:17:02 -05:00
Josh Soref 2ee5eb7fa7 Make timing outputs consistently show hours and hint at time format
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2025-01-29 04:20:37 -05:00
friendseeker fae2bcc01b
Add documentation & deduplicate implementation 2024-10-29 21:40:51 -07:00
Friendseeker 92d4cfa690 Replace nnbsp with regular space 2024-10-29 17:43:33 -07:00
Friendseeker 828dc04808 Migrate all usages of `System.console == null` 2024-10-28 18:25:16 -07:00
Eugene Yokota 0b01ed4743 fix: Fixes BSP
**Problem**
Calling -bsp with --sbt-launch-jar causes "Unrecognized option: --server".
This is because --server is passed in twice since $7775

**Solution**
Since the server invocation by BSP client already passes in --server,
we can remove the extra --server append.
2024-10-24 01:44:49 -04:00
Friendseeker 0e85726858 Use JNI to replace deprecated Jansi & JNA 2024-10-22 13:05:20 -07:00
Eugene Yokota d9bc88ab8b Default to sbtn for sbt 2.x
This changes the runner script logic to default to sbtn when sbt version is 2.x.
2024-10-18 01:14:28 -04:00
Karl Yngve Lervåg dd1218ba12 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-15 15:39:34 -04: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
Matthew de Detrich 6611ccf94d
Set socket backlog to default size of 50 2022-12-08 11:21:43 +01: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
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
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
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
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
Samuel CLARENC 0be658d299
Merge branch 'develop' into bspStartTry 2021-07-26 09:30:28 +02:00
Samuel CLARENC 5cdec34beb Add a Try around process execution 2021-07-26 09:30:08 +02:00
Adrien Piquerez c31503cca2 Warn when using -sbt-launch-jar 2021-07-22 09:17:22 +02:00
Adrien Piquerez c9ca2d4afa Use `-Dsbt.script` to start sbt server
In order to start the sbt server we must use the sbt script because
it is the only way to load the .sbtopts and the .jvmopts file properly.

To do so the sbt script can pass a -Dsbt.script prop to the java server.
It is used in the NetworkClient to start the server, and it is replicated
in the BuildServerConnection file (.bsp/sbt.json).
2021-07-12 14:20:17 +02:00
Amina Adewusi f12b0baef0 make -client the same as --client
The problem was that -client was different from --client, which
makes for a confusing user experience. So, this change makes
them the same and re-names -client to --java-client. The value
of this is that hopefully -client and --client being the same
feels more logical to users.
2021-05-07 16:07:42 +01:00
Eugene Yokota d0f540aea1 Patch for unidoc 2021-03-08 22:41:19 -05:00
Ondra Pelech 81457e60ec
Give an explanation in case of ServerAlreadyBootingException (#6353)
Give and explanation in case of ServerAlreadyBootingException
2021-03-04 23:21:42 -05:00
Eugene Yokota 22d12f6618 Use nowarn annotation 2021-02-06 22:31:47 -05:00
Sam Halliday 88baafa034 nohup the server from GNU Emacs 2021-01-21 10:51:00 +00: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 58d4ef41be
Merge pull request #6181 from smarter/dotty-library-rename
dotty-library is called scala3-library now
2020-12-24 11:53:18 -05:00
João Ferreira 08eaa9fb3b regen contraband 2020-12-21 17:21:54 +00:00