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

fix running kotlin targets (at least under bzlmod?) #1130

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dmgd
Copy link

@dmgd dmgd commented Mar 13, 2024

I was just integrating rules_kotlin into an existing bazel project and run into some issues getting a simple kotlin app up and running. I was seeing the error

...<app>.runfiles/_main/external/rules_java~~toolchains~remotejdk21_macos_aarch64/bin/java: No such file or directory

I explored a little and saw that these two fields in the java toolchain differed and explained the problem (since exec is what's being used, but runfiles is what points to the actual file.)

java_executable_exec_path = external/rules_java~~toolchains~remotejdk21_macos_aarch64/bin/java
java_executable_runfiles_path = ../rules_java~~toolchains~remotejdk21_macos_aarch64/bin/java

Looking at the docs for these two fields (https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/java/JavaRuntimeInfoApi.java#L60 ) it looks to me like exec is for use while running java as part of the action, whereas runfiles is for use when using bazel run (but this is all a bit new to me so I might be wrong / perhaps there's some nuance -- e.g. I can see in (what looks to me like) the core java stuff, there's all sorts of complex stuff going on when they set javabin . . . -- https://github.com/bazelbuild/bazel/blob/master/src/main/starlark/builtins_bzl/bazel/java/bazel_java_binary.bzl#L203 )

env details

  • macos
  • bazel version: 7.1.0
  • rules_kotlin version: 1.9.1

[edit] forgot to mention, that I'm using this as a patch and bazel run <kotlin app target> is working fine now

Copy link

google-cla bot commented Mar 13, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@Bencodes Bencodes self-assigned this Mar 14, 2024
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

Successfully merging this pull request may close these issues.

2 participants