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

Allow multiple build targets for cross built project #2287

Open
tgodzik opened this issue Dec 1, 2020 · 6 comments
Open

Allow multiple build targets for cross built project #2287

tgodzik opened this issue Dec 1, 2020 · 6 comments
Labels
bloop Bloop related tickets

Comments

@tgodzik
Copy link
Contributor

tgodzik commented Dec 1, 2020

Describe the bug

Currently when a workspace is imported in sbt we only support one scala version, which might be problematic if we use different sources for each scala version. This becomes especially important for Scala 3, which can differ much from the Scala 2 code. In Metals we did a workaround by creating an additional non-publishable module. This however should not be needed.

We should be able to fix it possibly by:

  • adding scala version suffix to the target name in the Bloop sbt plugin - this is already being done in Mill
  • offer to run sbt +bloopInstall in case cross plugin is detected in the workspace (we could also make it an optional command)

To Reproduce

Steps to reproduce the behavior:

  1. Open scalameta/mdoc
  2. Import build
  3. Try navigating Scala 3 sources.

Expected behavior

Metals works in all sources in the workspace.

Installation:

  • Operating system: macOS/Windows/Linux
  • Editor: Visual Studio Code/Atom/Vim/Sublime/Emacs
  • Metals version: v0.9.6

Additional context

This came up as a follow up to scalacenter/scala-3-migration-guide#111

Search terms

cross build targets

@froth
Copy link

froth commented Jan 17, 2022

Is there any progress on this? Currently working on projects that use 2.X and 3.X macros (via cross compile) is reminding me of the old days when I used vim and gcc ;)

@tgodzik
Copy link
Contributor Author

tgodzik commented Jan 17, 2022

@froth no progress currently, but using project-matrix can work around it.

@froth
Copy link

froth commented Jan 17, 2022

Thanks, for the info. I will have a look if project-matrix makes my life easier :)

@SethTisue
Copy link
Contributor

Must I modify my build.sbt to have the scalaVersion I want to use in Metals, or can I switch on the fly somehow...? (I'm using sbt as my build server.)

@SethTisue
Copy link
Contributor

SethTisue commented Sep 8, 2022

I guess I can go to the Metals tab, click on "Terminal", then run sbt -client ++3.1.3 or whatever version I want, then click "Connect to build server"; that causes the Scala version shown in the Metals Doctor to update.

If there's a better way, lmk.

@tgodzik
Copy link
Contributor Author

tgodzik commented Sep 12, 2022

I guess I can go to the Metals tab, click on "Terminal", then run sbt -client ++3.1.3 or whatever version I want, then click "Connect to build server"; that causes the Scala version shown in the Metals Doctor to update.

If there's a better way, lmk.

For sbt that's probably the best way, we would need an additional endpoint for BSP to change it on the fly 🤔

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

No branches or pull requests

4 participants