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 importing compiler plugins #397

Open
TimWSpence opened this issue Oct 8, 2020 · 2 comments
Open

Support importing compiler plugins #397

TimWSpence opened this issue Oct 8, 2020 · 2 comments

Comments

@TimWSpence
Copy link

It would be super awesome if we could import compiler plugins. eg ammonite allows

import $plugin.$ivy.`org.spire-math::kind-projector:0.6.3`

I have no idea if this is feasible or not but it would be epic!

@olafurpg
Copy link
Member

olafurpg commented Oct 8, 2020

Thank you for reporting! You can enable compiler plugins with the $scalac magic import, see example here

|import $scalac.`-Wunused:imports -Xfatal-warnings`

You can try to fetch the jar locally first

❯ cs fetch --intransitive org.spire-math:kind-projector_2.12:0.9.10
/Users/lgeirsson/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/spire-math/kind-projector_2.12/0.9.10/kind-projector_2.12-0.9.10.jar

Then add it via -Xplugin:...

import $scalac.`-Xplugin:/Users/lgeirsson/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/spire-math/kind-projector_2.12/0.9.10/kind-projector_2.12-0.9.10.jar`

Can you confirm this works as expected? I'm open to add built-in support for a $plugin magic import

@tgodzik
Copy link
Contributor

tgodzik commented Oct 8, 2020

I think this doesn't work in worksheets as far as I tried, not sure exactly why.

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

No branches or pull requests

3 participants