Skip to content

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

@a1kemist

Description

@a1kemist

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions