Commit Graph

400 Commits

Author SHA1 Message Date
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
Guillaume Martres 7f3ce50014 dotty-library is called scala3-library now
I though this would help with
https://github.com/lampepfl/dotty/issues/10558 but `sbt repl` still
hides the input after typing a line and pressing enter even after this
change.
2020-11-30 17:08:04 +01:00
Ethan Atkins d167dee7d2 Add --sbt-launch-jar command line arg to client
The intellij bsp integration launches sbt with the launcher and runs
-bsp. This doesn't work if sbt is not on intellij's path. To try and
work around this, we can add an option --sbt-launch-jar that is
recognized by the network client and will make it use the launch jar
rather than the sbt script to launch a new server if needed.
2020-11-27 12:21:21 -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
Ethan Atkins 3f3e219e0f Update ipcsocket
The new version provides an apple silicon arm64 jni implementation of
the ipcsocket api. It also adds a jni implementation for getting the max
socket length which is necessary because jna isn't supported on the
apple arm64 platform yet.
2020-11-25 07:34:11 -08:00
Ethan Atkins 5769f80cbe Use jni if required when running client from xMain
See https://github.com/sbt/sbt/issues/6162#issuecomment-733207878.
2020-11-24 12:35:53 -08:00