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

SBT Plugin Support #1704

Open
davidhoyt opened this issue Feb 24, 2025 · 2 comments
Open

SBT Plugin Support #1704

davidhoyt opened this issue Feb 24, 2025 · 2 comments

Comments

@davidhoyt
Copy link

I recognize the perhaps conflict of interest in this request but for me to migrate to Bazel, I'd need to be able to continue to build and release SBT plugins that other teams still rely on. Is this a possibility?

I'm still very new to Bazel so my ability to contribute is very limited.

Thanks for taking the time to consider this!

@srdo
Copy link

srdo commented Feb 24, 2025

It's almost certainly possible, but probably a bit of effort. You'll be trying to create a jar that "looks like" an sbt plugin jar, but since you don't have sbt to handle the scaffolding for you, you'll need to do this by hand.

I think an sbt plugin is mostly just a regular Scala library that depends on sbt, as you can see here https://repo1.maven.org/maven2/com/eed3si9n/sbt-assembly_2.8.1/sbt0.10.1_0.6/sbt-assembly_2.8.1-sbt0.10.1_0.6.pom, plus a metadata file as you can see if you open https://repo1.maven.org/maven2/com/eed3si9n/sbt-assembly_2.8.1/sbt0.10.1_0.6/sbt-assembly_2.8.1-sbt0.10.1_0.6.jar

Probably the way to get started is that you take one of your plugins and look at the jar sbt produces, then try to set up Bazel to create a similar jar, using scala_library and maybe a genrule to manually add in extra files if you need to.

Edit: Though before you invest time, consider if you can't migrate your build to Bazel and just cut out your plugins into separate sbt projects. That could easily be less effort.

@davidhoyt
Copy link
Author

In my situation, other teams depend on what we produce and their migration would have to be piecemeal over time.

SBT plugins have specific artifact names and maven/publishing layouts as well which is why I felt a rule around this would be best. Plus we'd have to consider cross-compiling (targeting multiple SBT versions).

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

2 participants