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

Compile / PB.targets seems to be required to generate Test scoped protos #1750

Open
a1kemist opened this issue Oct 11, 2024 · 0 comments
Open

Comments

@a1kemist
Copy link

First off I would just like to say thank you to all the contributors of scalapb for the fine work that has been done on this project. 🙇

While working on some integration tests, I needed to create some protos that were only going to be used for testing. To my surprise, it appears that Compile / PB.targets needs to be defined in order for Test / PB.targets to evaluate. (The sources under test have no protos themselves)

I have created a branch that adds two examples under examples/* to reproduce the issue (examples/testOnly and examples/testPlusCompile).

The testPlusCompile example build.sbt looks like the following and builds correctly:

scalaVersion := "2.13.8"

Compile / PB.targets := Seq(
  scalapb.gen() -> (Compile / sourceManaged).value / "scalapb"
)

Test / PB.targets := Seq(
  scalapb.gen() -> (Test / sourceManaged).value / "scalapb"
)

I would expect that a user would be able to do the following in order to generate protos that are only used for testing:

scalaVersion := "2.13.8"

Test / PB.targets := Seq(
  scalapb.gen() -> (Test / sourceManaged).value / "scalapb"
)

Please let me know if I can provide any additional information and I would be happy to help.

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

1 participant