rules_scala icon indicating copy to clipboard operation
rules_scala copied to clipboard

`scala_proto_library` build doesn't fail if `protoc` errors

Open luser opened this issue 6 years ago • 0 comments

I noticed this while trying to get a build working in my project, so I edited my test project to reproduce it in a smaller testcase: https://github.com/luser/bazel-scala-proto-test/tree/protoc-failure

I edited hello.proto to add an import of a proto file that does not exist. Building the :hello-proto target directly errors:

└─ $ ▶ bazel build :hello-proto
INFO: Analyzed target //:hello-proto (15 packages loaded, 561 targets configured).
INFO: Found 1 target...
ERROR: /Users/ted/bazel-scala-proto-test/BUILD:5:1: Generating Descriptor Set proto_library //:hello-proto failed (Exit 1) protoc failed: error executing command bazel-out/host/bin/external/com_google_protobuf/protoc '--descriptor_set_out=bazel-out/darwin-fastbuild/bin/hello-proto-descriptor-set.proto.bin' '-Ihello.proto=hello.proto' --direct_dependencies ... (remaining 3 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
foo.proto: File not found.
hello.proto:5:1: Import "foo.proto" was not found or had errors.
Target //:hello-proto failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 70.476s, Critical Path: 19.57s
INFO: 182 processes: 182 darwin-sandbox.
FAILED: Build did NOT complete successfully

But building :scala-proto-test (the scala_proto_library target) does not, even though protoc prints the same errors:

└─ $ ▶ bazel build :scala-proto-test
INFO: Analyzed target //:scala-proto-test (20 packages loaded, 613 targets configured).
INFO: Found 1 target...
INFO: From SkylarkAction external/rules_scala_annex/src/main/scala/higherkindness/rules_scala/common/worker/worker/classes.jar [for host]:
warning: there were two unchecked warnings; re-run with -unchecked for details
one warning found
INFO: From SkylarkAction external/rules_scala_annex/src/main/scala/compiler_bridge_2_12_8/classes.jar [for host]:
warning: there were three deprecation warnings (since 2.12.0); re-run with -deprecation for details
warning: there were three feature warnings; re-run with -feature for details
two warnings found
INFO: From ScalaProtoCompile tmp/scala_proto_test:
foo.proto: File not found.
hello.proto: Import "foo.proto" was not found or had errors.
protoc-jar: protoc version: 3.5.1, detected platform: osx-x86_64 (mac os x/x86_64)
protoc-jar: embedded: bin/3.5.1/protoc-3.5.1-osx-x86_64.exe
protoc-jar: executing: [/var/folders/4x/l8p9pv0j3m35h9vh7frs8b340000gp/T/protocjar9825690595322198977/bin/protoc.exe, --plugin=protoc-gen-scala=/var/folders/4x/l8p9pv0j3m35h9vh7frs8b340000gp/T/protocbridge2344614132569024880, --scala_out=bazel-out/darwin-fastbuild/bin/tmp/scala_proto_test, hello.proto]
Target //:scala-proto-test up-to-date:
  bazel-bin/scala-proto-test.srcjar
INFO: Elapsed time: 47.555s, Critical Path: 47.28s
INFO: 32 processes: 27 darwin-sandbox, 1 local, 4 worker.
INFO: Build completed successfully, 48 total actions

luser avatar Jun 13 '19 20:06 luser