-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create distributable cross-platform packages #329
base: master
Are you sure you want to change the base?
Conversation
Hey this one line has a very long history. We discussed it here at some point:
It seems we cannot find a version that works on all platforms, so why not generate platform specific versions? Or look into https://github.com/xerial/sbt-pack ? |
Oh, sorry for not noticing the history. I just tried a JAR wrapper from StackOverflow which seems to work (at least for me) and bypasses the I suppose an official solution like sbt-pack would be much cleaner. Edit: The |
Personally, I use something like: #! /usr/bin/env bash -e
# ... add node to PATH ...
exec long/full/path/to/bin/java -jar another/long/path/to/effekt.jar "$@" for my version of (automatically generated here: https://github.com/jiribenes/effekt-nix/blob/3147a32bce206520a6d562a2469638baa9048722/effekt.nix#L24-L27; just posting for archival reasons) However, I believe it may be wise to explore |
Maybe at some point we can also look into native image again (https://www.graalvm.org/latest/reference-manual/native-image) So far, I never went through the troubles to set it up in CI and have it automatically build binaries for the different platforms. |
I did some experiments with Since I'm still unfamiliar with sbt/scala I have some questions:
Am I missing something obvious? |
I am not sure whether Scala Native is in a state where we can just compile our compiler using it :( |
Small update: GraalVM native-image |
Cool! Can you try to use it with the vscode plugin as a language server? Ah, and the Repl of course |
One problem we need to solve is including the standard library in the native file. For now we need to manually specify it using I needed to add dynamic proxies for the server to run without runtime errors. Other than that the REPL works (as far as I can see) and |
The missing proxies are often the problem. I remember that there was a tool that would record a trace and then I needed to use as much of the language server as possible... Edit: https://www.graalvm.org/latest/reference-manual/native-image/metadata/AutomaticMetadataCollection/ |
Do the missing proxies show in the vscode log? |
run: sudo apt-get install chezscheme | ||
|
||
- name: Run tests and assemble jar file | ||
run: sbt clean deploy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jiribenes just told me MacOS minutes are much more expensive. Maybe we don't want to run the tests on all systems??? :)
I was now able to debug the server with stacktrace logs. It turns out we do still need reflection files for certain operations (especially lsp4j), so I added missing reflections to the existing config. With the final config I was not able to produce any reflection errors, but there may still be some. I'm not sure about the general approach of releasing native images, since the reflection fixing does not really seem stable. Also, saving files with the native build in vscode reports a |
Yeah, that was my feeling last time as well. I would feel better if there was an automated way to query the language server and reproduce scenarios so that we can regenerate reflection traces if necessary (like when updating the LSP4J dependency). Eventually, reimplementing LSP4J in Scala or replacing it with a Scala implementation that does not use reflection might be the best thing to do but is a LOT of work. |
Maybe writing a general test suite for the LSP server could be a good first step? In my efforts to find reflection bugs I wrote some tests using Haskell's lsp-test. I could start writing something similar (more minimal) in Scala. |
Just to make this clear: a test suite for LSP would be great. How would you run it with the graal binary? The tests are not deployed with the binary, no? |
In the case of |
I was now able to build the binary. However, just invoking
|
The native version reduces the startup significantly (for compiling and running Jar
Native
|
ee9d209
to
58c8510
Compare
Most operating systems (e.g. GNU/Linux, BSDs) treat all text after the first space as a single argument. When using env in a script it is thus not possible to specify multiple arguments.[1]
Without this change the invocation of
effekt
aftersbt install
results in the following error:MacOS/FreeBSD's
env
apparently behaves differently, so please verify that the resulting binary still works on them.[1]: GNU coreutils documentation