Skip to content

Conversation

eed3si9n
Copy link
Member

This changes the runner script logic to default to sbtn when sbt version is 2.x.

This changes the runner script logic to default to sbtn when sbt version is 2.x.
@eed3si9n eed3si9n requested review from adpi2 and BillyAutrey October 18, 2024 05:17
@eed3si9n eed3si9n merged commit d1a5862 into sbt:1.10.x Oct 18, 2024
10 checks passed
@eed3si9n eed3si9n deleted the wip/use_sbtn branch October 18, 2024 06:06
@@ -1127,6 +1127,7 @@ object NetworkClient {
sbtArguments += s"-Dsbt.script=$sbtScript"
}
}
if (!sbtArguments.contains("--server")) sbtArguments += "--server"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is causing Metals to stop working with the embedded launcher jar:

2024.10.21 14:06:01 INFO  BSP server: [info] server was not detected. starting an instance
2024.10.21 14:06:01 INFO  BSP server: [warn] server is started using sbt-launch jar directly
2024.10.21 14:06:01 INFO  BSP server: [warn] this is not the recommended way: .sbtopts and .jvmopts files are not loaded and SBT_OPTS is ignored
2024.10.21 14:06:01 INFO  BSP server: [warn] either upgrade sbt to its latest version or make sure it is accessible from $PATH, and run 'sbt bspConfig'
2024.10.21 14:06:01 INFO  BSP server: Unrecognized option: --server
2024.10.21 14:06:01 INFO  BSP server: Error: Could not create the Java Virtual Machine.
2024.10.21 14:06:01 INFO  BSP server: Error: A fatal exception has occurred. Program will exit.

should this happen now? I can't seem to figure out where --server is added. The other option is to use the scripts, but that's a bigger change and we were pretty happy with how things worked with the launcher jar

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this happen now?

No I only meant this to affect sbt shell script invoking either the sbtn or sbt server. I didn't intend BSP to break. How is Metals invoking Network client? @adpi2 Do you have suggestion on how we should proceed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We invoke whatever is in the sbt.json generated by bspConfig method:

{"name":"sbt","version":"1.10.3","bspVersion":"2.1.0-M1","languages":["scala"],"argv":["/usr/lib/jvm/openjdk21/bin/java","-Xms100m","-Xmx100m","-classpath","/home/tgodzik/Documents/metals/tests/slow/target/e2e/sbt-server/generate/.bsp/sbt-launch.jar","xsbt.boot.Boot","-bsp","--sbt-launch-jar=/home/tgodzik/Documents/metals/tests/slow/target/e2e/sbt-server/generate/.bsp/sbt-launch.jar"]}⏎

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Splitting this out as a bug - #7792

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to add some Metals & sbt integration test (on sbt or Metals repo) to automatically catch such issue?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're the one generating the BSP JSON, we should be running integration test of sbt vs sbt.

@Friendseeker
Copy link
Member

@eed3si9n Forgot to ask it back then but what is the behavior for Windows ARM? Does it default to x86_64 build of sbtn or does it default to the jar?

Just want to make sure we have special handling for this particular case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants