How to build Java libraries/binaries?
I've been experimenting with buck2 but I've been struggling to find any information on building Java. A simple java_library rule fails to build
java_library(
name = 'main',
srcs = ['Main.java'],
)
Error running analysis for `root//:main (prelude//platforms:default#524f8da68ea2a374)`
Caused by:
0: Error looking up configured node root//:main (prelude//platforms:default#524f8da68ea2a374)
1: Error getting configuration node of `prelude//runtime/constraints:android-host-test` within the `prelude//platforms:default#524f8da68ea2a374` configuration
2: Error running analysis for `prelude//runtime/constraints:android-host-test (<unbound>)`
3: Error looking up configured node prelude//runtime/constraints:android-host-test (<unbound>)
4: looking up unconfigured target node `prelude//runtime/constraints:android-host-test`
5: Error loading targets in package `prelude//runtime/constraints` for target `prelude//runtime/constraints:android-host-test`
6: Error gathering package listing for `prelude//runtime/constraints`
7: The package is invalid
8: This error was caused by the end user
9: Error listing dir `prelude//runtime/constraints`
10: Error listing directory
11: read_dir(/tmp/buck2test/prelude/runtime/constraints)
12: No such file or directory (os error 2)
Build ID: fedd29e4-2e88-42b8-aa74-d133c81e21db
Jobs completed: 46. Time elapsed: 0.1s.
BUILD FAILED
I'm not 100% sure what this error is caused by, I assume I need to configure a java toolchain, but I can't find anything to reference on how to do this. Is there documentation on this or projects to reference?
We currently have Java working internally, but haven't yet got an example open source instance working. It might be only a few lines away, it might already work (but probably not given your notes) or it might be a huge amount of work. CC @IanChilds who might have a better idea how far away it is.
@0xAda, @ndmitchell Any updates on this (Java builds)?
@ndmitchell Any updates on java/jvm builds? Or any examples for Java?
Still not I'm afraid. CC @IanChilds who might have a better idea. It's still being worked on.
Same question here as OP, @0xAda, as well as PHP, and many other languages. I'm having trouble finding clarification on the polyglot angle.
Internally we support a lot of languages - you can see their code in the prelude directory - https://github.com/facebook/buck2/tree/main/prelude. We have made a number of them work externally - you can see the test cases in https://github.com/facebook/buck2/tree/main/examples/with_prelude (C++, Haskell, Python, Rust, OCaml). We are actively working on making a number of internally-only ones work open-source, such as Java, Android, Apple.
We have no rules for languages such as PHP. We wouldn't be averse to adding them one day, as a user contribution.