Skip to content
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

Support --java-opt / -J for compile task under --server=false #2865

Open
lrytz opened this issue Apr 18, 2024 · 1 comment
Open

Support --java-opt / -J for compile task under --server=false #2865

lrytz opened this issue Apr 18, 2024 · 1 comment
Labels
enhancement New feature or request priority: low scalac compatibility Issues tied with compatibility with the scalac (compiler) command. UX

Comments

@lrytz
Copy link

lrytz commented Apr 18, 2024

It would be handy if scala-cli compile --server=false supported -J options, they would be passed to the JVM running the compiler.

Use case is opening a debugger port (scala-cli compile --server=false -J-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 Test.scala).

Workaround is to use --scalac-option -J-...

➜ sandbox scala-cli compile --server=false -S 2.13 T.scala -O -J-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005
Listening for transport dt_socket at address: 5005

That was added in https://github.com/VirtusLab/scala-cli/pull/2601/files, but it seems a bit strange. scalac -J... is supported by the old runner script, not by the compiler itself.

@lrytz lrytz added the enhancement New feature or request label Apr 18, 2024
@Gedochao Gedochao added scalac compatibility Issues tied with compatibility with the scalac (compiler) command. priority: low UX labels Apr 18, 2024
@Gedochao
Copy link
Contributor

Optimally, we should have a dedicated option for Java opts passed to the compiler alongside --server=false for better UX, similar to how we have --bloop-java-opt for Java opts passed to Bloop with --server=true (the default).
Probably something like --compiler-java-opt.

It is somewhat unexpected this feature is delivered via --scalac-option -J* (but it indeed works this way right now, as delivered by #2601).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority: low scalac compatibility Issues tied with compatibility with the scalac (compiler) command. UX
Projects
None yet
Development

No branches or pull requests

2 participants