I’ve been able to use other code generating plugins (Google auto value and protocol buffers) with bazel but I’m having trouble with dagger. Bazel seems to be unable to find generated sources/classes that are in a different java package than the one where they are used.
Please see this example repo: https://github.com/rmcloughlin/blaze-dagger-issue
bazel is able to successfully use the dagger plugin to generate and then compile a source file for the “module” package:
$ bazel build java/module
(succeeds)
$ jar -tf bazel-bin/java/module/libmodule.jar
META-INF/
META-INF/MANIFEST.MF
module/
module/MyModule.class
module/MyModule_ProvideDateFactory.class <- from generated source
but another package ("component") is unable to find that generated class, despite depending on //java/module:
$ bazel build java/component
bazel-out/local-fastbuild/bin/java/component/_javac/component/libcomponent_sourcegenfiles/component/DaggerMyComponent.java:7: error: cannot find symbol
import module.MyModule_ProvideDateFactory;
^
symbol: class MyModule_ProvideDateFactory
location: package module
Target //java/component:component failed to build
I assumed that //java/component would have access to everything inside libmodule.jar but apparently that’s not how things work. Can anyone explain how to fix this?
--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/4c62e2cd-6370-406e-b285-e4c315ce8783%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.