scabbard
scabbard copied to clipboard
Any chance this works with Bazel?
Hoping to try this out in bazel - has anyone tried this before?
I think image generation should work fine when the annotation processor is added as java_plugin
. IDE integration probably needs work, let me investigate and add official samples.
Thank you! I am currently trying to get image generation working myself - not sure which processor should be set as the processor_class in the java_plugin though
I have it working with
java_plugin(
name = "scabbard",
visibility = ["//visibility:public"],
deps = ["@maven//:dev_arunkumar_scabbard_processor"], #rules_jvm_external usage
javacopts = ["-Ascabbard.failOnError=true"] # or whatever
)
and then running bazel build //path/to/your/java/library_or_binary --plugin //path/to/scabbard
The source code indicates that it is written to https://docs.oracle.com/javase/7/docs/api/javax/tools/StandardLocation.html#SOURCE_OUTPUT
which turns out to be bazel-bin/path/to/your/java/library_or_binary/library_or_binary-gensrc.jar
Unzipping that jar shows a scabbard
directory with all the output.
Obviously this means they would be included in the binary so I wouldn't run the production build with the scabbard plugin. Don't know enough bazel or scabbard to say if there's an alternate solution.
Since we're using rules_jvm_external, this also required using com.github.kittinunf.result 3.0.1 in maven.bzl
as hinted in another issue.
Thanks @theindexer
I am looking towards an official way to support this possibly with first party bazel rules. Experimented with a aspect here https://github.com/arunkumar9t2/bazel-playground/blob/main/tools/generated_sources_collector/generated_sources_collector.bzl that merges source jar for all transitive dependencies unzippping which will give you all the images.
I will continue investigating how IDE can use this information.