Skip to content
This repository has been archived by the owner on May 3, 2023. It is now read-only.

Illustrate Scala Issues with Dependencies #1

Closed
wants to merge 1 commit into from

Conversation

promiseofcake
Copy link
Owner

@promiseofcake promiseofcake commented Nov 9, 2017

When using java_proto_library targets from https://github.com/pubref/rules_protobuf @ v.0.7.1

In our java_binary target we need only to provide the path to the //proto:c dependency for compilation / runtime with --strict_java_deps=ERROR enabled.

For a scala_binary, I would expect to only need to do the same, but it seems the output of our //proto:c is providing jars in a way that java_library will pick them up as exports but scala_ will not.

Situation is the same as: promiseofcake/bazel-scala-test#2, (Issue: bazelbuild/rules_scala#235) except in this case we don't have control over the target to be able to export all the necessary dependencies.

@promiseofcake
Copy link
Owner Author

promiseofcake commented Nov 9, 2017

Example error:

$ bazel build --strict_java_deps=ERROR //src/main/scala/com/promiseofcake/sample:sample 
INFO: Analysed target //src/main/scala/com/promiseofcake/sample:sample.
INFO: Found 1 target...
ERROR: /Users/lucas/Workspace/repos/promiseofcake/pubref-java-proto-deps/src/main/scala/com/promiseofcake/sample/BUILD:3:1: scala //src/main/scala/com/promiseofcake/sample:sample failed (Exit 1): scalac failed: error executing command 
  (cd /private/var/tmp/_bazel_lucas/bc5a6721c7ab98ca01a2928cb6103bf1/execroot/__main__ && \
  exec env - \
  bazel-out/host/bin/external/io_bazel_rules_scala/src/java/io/bazel/rulesscala/scalac/scalac @bazel-out/darwin_x86_64-fastbuild/bin/src/main/scala/com/promiseofcake/sample/sample_worker_input)
error: Target 'Unknown label of file bazel-out/darwin_x86_64-fastbuild/bin/proto/libb-hjar.jar which came from //proto:c' is used but isn't explicitly declared, please add it to the deps.
You can use the following buildozer command:
buildozer 'add deps Unknown label of file bazel-out/darwin_x86_64-fastbuild/bin/proto/libb-hjar.jar which came from //proto:c' //src/main/scala/com/promiseofcake/sample:sample
error: Target 'Unknown label of file bazel-out/darwin_x86_64-fastbuild/genfiles/proto/_ijar/a_compile_imports/external/com_google_protobuf_protobuf_java/jar/protobuf-java-3.1.0-ijar.jar which came from //proto:c' is used but isn't explicitly declared, please add it to the deps.
You can use the following buildozer command:
buildozer 'add deps Unknown label of file bazel-out/darwin_x86_64-fastbuild/genfiles/proto/_ijar/a_compile_imports/external/com_google_protobuf_protobuf_java/jar/protobuf-java-3.1.0-ijar.jar which came from //proto:c' //src/main/scala/com/promiseofcake/sample:sample
error: Target 'Unknown label of file bazel-out/darwin_x86_64-fastbuild/bin/proto/liba-hjar.jar which came from //proto:c' is used but isn't explicitly declared, please add it to the deps.
You can use the following buildozer command:
buildozer 'add deps Unknown label of file bazel-out/darwin_x86_64-fastbuild/bin/proto/liba-hjar.jar which came from //proto:c' //src/main/scala/com/promiseofcake/sample:sample
three errors found
three errors found
java.lang.RuntimeException: Build failed
        at io.bazel.rulesscala.scalac.ScalacProcessor.compileScalaSources(ScalacProcessor.java:256)
        at io.bazel.rulesscala.scalac.ScalacProcessor.processRequest(ScalacProcessor.java:68)
        at io.bazel.rulesscala.worker.GenericWorker.run(GenericWorker.java:125)
        at io.bazel.rulesscala.scalac.ScalaCInvoker.main(ScalaCInvoker.java:41)
Target //src/main/scala/com/promiseofcake/sample:sample failed to build
INFO: Elapsed time: 3.344s, Critical Path: 3.17s
FAILED: Build did NOT complete successfully

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

Successfully merging this pull request may close these issues.

None yet

1 participant