You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I'm trying to run some J2CL builds on a Bazel 6 project, but I encounter the following error:
INFO: Invocation ID: a1fff5c4-4b69-439d-a75f-e730e8c490f7
ERROR: /private/var/tmp/_bazel_sam/89d3dd8c1880937e8b55a8dc2c815fe0/external/bazel_tools/tools/jdk/BUILD:124:6: no such target '@rules_java~6.2.2~toolchains~local_jdk//:jar': target 'jar' not declared in package '' defined by /private/var/tmp/_bazel_sam/89d3dd8c1880937e8b55a8dc2c815fe0/external/rules_java~6.2.2~toolchains~local_jdk/BUILD.bazel (Tip: use `query "@@rules_java~6.2.2~toolchains~local_jdk//:*"` to see all the targets in that package) and referenced by '@bazel_tools//tools/jdk:jar'
I'm using bzlmod with rules_java, which seems to be doing something creative with local_jdk. Is there any way I can fix this?
To Reproduce
It's a brand new Bazel 6 project with J2CL added via the standard directions. I can provide a reproducer if needed.
Bazel version
Please include version of Bazel that you are running J2CL with:
I wonder if the J2CL command line transpiler might be an option instead? Is WASM supported through that? I was able to get it to build so long as Java was set to 11. We need 17 for some other targets, although we aren't using any syntax from 17 that makes it into the J2CL target.
re. Bazel 6 support:
Thanks for reporting. We haven't looked into running with Bazel 6. We should address this but we are quite busy with other stuff at the moment so it may take some time.
re. command line tool for Wasm:
We should support wasm on the command line tool after we stabilize the transpiler. Currently for Wasm we are doing a monolithic compile (compile all sources in one shot) and we are in the process of rebuilding it to be "modular" similar to J2CL/JS or javac. However being said that with modular compilation the pipeline will be more complicated to use from the command line (again similar to J2CL/JS).
@gkdn modularization sounds nice, looks like it allows us to perform incremental recompilation in maven multi-module project with the j2cl-maven-plugin. Cool
@gkdn we're in bazel downstream so cli access is only a way to get access to J2CL before bazel 6 support. thank you for this response, we'll keep an eye out.
@sgammon I think command line runner has all the flags available to run. The contract will change after the modularization but you can probably make it work for today.
In that file you'll see j2cl is pulled from ../j2cl, that's a local clone based on commit 39754f53dc1f4b4fd869e769b5486182c3e43dda with the following patch applied to pull rules_kotlin forward.
Activity
sgammon commentedon Jul 17, 2023
I wonder if the J2CL command line transpiler might be an option instead? Is WASM supported through that? I was able to get it to build so long as Java was set to 11. We need 17 for some other targets, although we aren't using any syntax from 17 that makes it into the J2CL target.
gkdn commentedon Jul 18, 2023
re. Bazel 6 support:
Thanks for reporting. We haven't looked into running with Bazel 6. We should address this but we are quite busy with other stuff at the moment so it may take some time.
re. command line tool for Wasm:
We should support wasm on the command line tool after we stabilize the transpiler. Currently for Wasm we are doing a monolithic compile (compile all sources in one shot) and we are in the process of rebuilding it to be "modular" similar to J2CL/JS or
javac. However being said that with modular compilation the pipeline will be more complicated to use from the command line (again similar to J2CL/JS).treblereel commentedon Jul 18, 2023
@gkdn modularization sounds nice, looks like it allows us to perform incremental recompilation in maven multi-module project with the j2cl-maven-plugin. Cool
sgammon commentedon Jul 20, 2023
@gkdn we're in bazel downstream so cli access is only a way to get access to J2CL before bazel 6 support. thank you for this response, we'll keep an eye out.
gkdn commentedon Jul 21, 2023
@sgammon I think command line runner has all the flags available to run. The contract will change after the modularization but you can probably make it work for today.
aschleck commentedon Sep 5, 2023
@sgammon not sure what the exact difference is but j2cl works for me with Bazel 6. I don't want to spend the time to minify my project but my guess is maybe something to do with using the Nix JDK instead of the default JDK? https://github.com/aschleck/trailcatalog/blob/main/WORKSPACE.bzlmod#L23 .
In that file you'll see j2cl is pulled from
../j2cl, that's a local clone based on commit39754f53dc1f4b4fd869e769b5486182c3e43ddawith the following patch applied to pull rules_kotlin forward.