bloop icon indicating copy to clipboard operation
bloop copied to clipboard

Automatically add -release flag to correctly compile Scala code

Open tgodzik opened this issue 2 years ago • 3 comments

Currently if we use a newer version of Java for Bloop and try to compile with an older JDK we will get proper bytecode generated for Java files as they fork the compilation, however the same will not happen for Scala code.

For that to work we should automatically add --release flag similar to how ScalaCLI does it for all bloop plugins:

  • [ ] maven
  • [ ] Gradle
  • [ ] sbt
  • [ ] mill

This also allow us to only run Bloop on JDK 17 and use the improved support from scala-cli/bloop-core (or even migrate to it)

tgodzik avatar Apr 06 '23 16:04 tgodzik

For that to work we should automatically add --release flag similar to how ScalaCLI does it for all bloop plugins:

Do you have a link handy to show where/how scala-cli does it?

ckipp01 avatar Apr 07 '23 06:04 ckipp01

For that to work we should automatically add --release flag similar to how ScalaCLI does it for all bloop plugins:

Do you have a link handy to show where/how scala-cli does it?

That is a good question, I can't find it quickly so I asked the team :sweat:

tgodzik avatar Apr 07 '23 07:04 tgodzik

It's here: https://github.com/VirtusLab/scala-cli/blob/1b765351838d5c7dccd4c1c60628a6d5c6f16fe4/modules/build/src/main/scala/scala/build/Build.scala#L918

tgodzik avatar Apr 07 '23 07:04 tgodzik

We actually, added that in the Bloop server itself.

tgodzik avatar Jul 08 '24 15:07 tgodzik