Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

scala_proto_library should respect strip_import_prefix #205

Open
kerinin opened this issue Aug 11, 2019 · 3 comments
Open

scala_proto_library should respect strip_import_prefix #205

kerinin opened this issue Aug 11, 2019 · 3 comments

Comments

@kerinin
Copy link
Contributor

kerinin commented Aug 11, 2019

Proto targets compiled with stripped prefixes are empty srcjars.

Minimal build file

proto_library(
    name = "example_proto",
    srcs = ["example.proto"],
    strip_import_prefix = "/prefix",
)

scala_proto_library(
    name = "example_scala_proto",
    deps = [":example_proto"],
)

Source proto:

# /prefix/example.proto
syntax = "proto3";
package foo
message Foo {}

Output:

$ bazel build prefix:example_scala_proto                                                                                                                                                                                                                                                                                               Sunday August 11 10:32:28 AM
INFO: Analyzed target //prefix:example_scala_proto (1 packages loaded, 3 targets configured).
INFO: Found 1 target...
INFO: From ScalaProtoCompile prefix/tmp/example_scala_proto:
protoc-jar: protoc version: 3.8.0, detected platform: osx-x86_64 (mac os x/x86_64)
protoc-jar: embedded: bin/3.8.0/protoc-3.8.0-osx-x86_64.exe
protoc-jar: executing: [/var/folders/t9/2yf73c553136pl7hzsrk8msm0000gn/T/protocjar10477993719091343746/bin/protoc.exe, --plugin=protoc-gen-scala=/var/folders/t9/2yf73c553136pl7hzsrk8msm0000gn/T/protocbridge3494382799574754229, --scala_out=bazel-out/darwin-fastbuild/bin/prefix/tmp/example_scala_proto, bazel-out/darwin-fastbuild/bin/prefix/_virtual_imports/example_proto/example.proto]
bazel-out/darwin-fastbuild/bin/prefix/_virtual_imports/example_proto/example.proto:3:1: Expected ";".
Target //prefix:example_scala_proto up-to-date:
  bazel-bin/prefix/example_scala_proto.srcjar
INFO: Elapsed time: 0.264s, Critical Path: 0.13s
INFO: 2 processes: 1 darwin-sandbox, 1 worker.
INFO: Build completed successfully, 4 total actions

The generated file (bazel-bin/prefix/example_scala_proto.srcjar) is empty.

@SrodriguezO
Copy link
Collaborator

Hey @kerinin, thanks for filing this issue.

I'd like to reproduce it on my machine. Which higherkindness/rules_scala commit are you currently using?

@jjudd
Copy link
Collaborator

jjudd commented Aug 12, 2019

Once we repro and fix adding a test for this would be awesome. Our proto test coverage at the moment is not great.

@kerinin
Copy link
Contributor Author

kerinin commented Aug 15, 2019

Sorry for the delay - that was using a0812a27e2367dce65dc6f40ccaa12e76282d1e6

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

No branches or pull requests

3 participants