Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java rules don't appear to be usable in OSS edition of buck2 #627

Open
zjturner opened this issue Apr 25, 2024 · 4 comments
Open

Java rules don't appear to be usable in OSS edition of buck2 #627

zjturner opened this issue Apr 25, 2024 · 4 comments

Comments

@zjturner
Copy link
Contributor

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.

args = [
java_toolchain.fat_jar[RunInfo],
"--jar_builder_tool",
cmd_args(java_toolchain.jar_builder, delimiter = " "),
"--output",
output.as_output(),
"--jars_file",
ctx.actions.write("jars_file", jars),
]

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?

@IanChilds
Copy link
Contributor

Yeah, that's correct. Java rules are not yet properly supported unfortunately

@zjturner
Copy link
Contributor Author

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?

@steveklabnik
Copy link
Contributor

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.

@zjturner
Copy link
Contributor Author

zjturner commented May 1, 2024

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?

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

No branches or pull requests

3 participants