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

How to build Java libraries/binaries? #394

Open
0xAda opened this issue Aug 19, 2023 · 6 comments
Open

How to build Java libraries/binaries? #394

0xAda opened this issue Aug 19, 2023 · 6 comments

Comments

@0xAda
Copy link

0xAda commented Aug 19, 2023

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?

@ndmitchell
Copy link
Contributor

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.

@oscarvarto
Copy link

@0xAda, @ndmitchell Any updates on this (Java builds)?

@heimashi
Copy link

@ndmitchell Any updates on java/jvm builds? Or any examples for Java?

@ndmitchell
Copy link
Contributor

Still not I'm afraid. CC @IanChilds who might have a better idea. It's still being worked on.

@qualeo
Copy link

qualeo commented Dec 9, 2023

Same question here as OP, @0xAda, as well as PHP, and many other languages. I'm having trouble finding clarification on the polyglot angle.

@ndmitchell
Copy link
Contributor

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.

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

5 participants