buck2
buck2 copied to clipboard
Java rules don't appear to be usable in OSS edition of buck2
I tried to use java_binary()
. I was pretty quickly hit with an error about one of my provider fields (JavaToolchainInfo.fat_jar
) being unset, so I looked into what it might be expecting, and found this.
https://github.com/facebook/buck2/blob/d458e16b57cf34853ff4b239cd609eabe235f257/prelude/java/java_binary.bzl#L40-L48
Whatever tool this is doesn't appear to be a standard JRE tool, and I suspect it's a Meta internal tool. Which means all of the Java rules don't work outside of Meta. Is my hunch correct about this, or is there a way to get this tool?
Yeah, that's correct. Java rules are not yet properly supported unfortunately
That’s too bad. Can you shed some light on why? What kind of use cases does meta have for which the jre alone isn’t sufficient to build everything you need to build?
Disclaimer: I don't work at meta, I don't actually know what goes on upstream.
My understanding is that the prelude shipping here is a subset of the actual prelude meta uses, with stuff that relies on their infra ripped out. If Java rules aren't working, I imagine the parts that are needed to make it work are meta-specific, and therefore, haven't ended up here.
It does mean that folks can make them work, and then send PRs to fix it, but it's not going to be a drop-in experience like with other languages.
Yea, I understand that. In this case, the first error I ran into is that there is a tool missing. The tool has command line arguments like --jar_builder
and presumably takes some inputs and produces a jar, if the name and command line options are any indication. So it would just be interesting to know, for example, what aspects of building a jar does the jre fall short in? If someone were to come along and want to make the java rules open-source friendly while also being compatible with meta internal stuff, is it impossible? What would need to be done? Is there any path forward to having a usable set of OSS java rules short of waiting for someone at Meta to do the work?
Just want to add my name to the list of people hoping for this. I'm representing Addepar, which is a long-time user / contributor to the original buck codebase. Would love to begin converting to buck2 😄