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

Update Legacy Runfiles #778

Open
aryeh-looker opened this issue Jun 18, 2022 · 3 comments
Open

Update Legacy Runfiles #778

aryeh-looker opened this issue Jun 18, 2022 · 3 comments

Comments

@aryeh-looker
Copy link

aryeh-looker commented Jun 18, 2022

Repro:

  1. Apply this diff:
diff --git a/.bazelrc b/.bazelrc
index 6858b64..d7db834 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -2,3 +2,4 @@ build --strategy=KotlinCompile=worker
 build --test_output=all
 build --verbose_failures
 
+build --nolegacy_external_runfiles
  1. bazel run //src/test/data/jvm/basic:test_module_name_bin

Observed behavior:

Target fails to run:

 % bazel run //src/test/data/jvm/basic:test_module_name_bin
DEBUG: /usr/local/google/home/aryehh/.cache/bazel/_bazel_aryehh/8452aec00c6d558f60825d3f208d7152/external/bazel_toolchains/rules/rbe_repo/version_check.bzl:68:14: 
Current running Bazel is ahead of bazel-toolchains repo. Please update your pin to bazel-toolchains repo in your WORKSPACE file.
DEBUG: /usr/local/google/home/aryehh/.cache/bazel/_bazel_aryehh/8452aec00c6d558f60825d3f208d7152/external/bazel_toolchains/rules/rbe_repo/checked_in.bzl:125:14: buildkite_config not using checked in configs; Bazel version 5.2.0 was picked/selected but no checked in config was found in map {"0.20.0": ["8.0.0"], "0.21.0": ["8.0.0"], "0.22.0": ["8.0.0", "9.0.0"], "0.23.0": ["8.0.0", "9.0.0"], "0.23.1": ["8.0.0", "9.0.0"], "0.23.2": ["9.0.0"], "0.24.0": ["9.0.0"], "0.24.1": ["9.0.0"], "0.25.0": ["9.0.0"], "0.25.1": ["9.0.0"], "0.25.2": ["9.0.0"], "0.26.0": ["9.0.0"], "0.26.1": ["9.0.0"], "0.27.0": ["9.0.0"], "0.27.1": ["9.0.0"], "0.28.0": ["9.0.0"], "0.28.1": ["9.0.0"], "0.29.0": ["9.0.0"], "0.29.1": ["9.0.0", "10.0.0"], "1.0.0": ["9.0.0", "10.0.0"], "1.0.1": ["10.0.0"], "1.1.0": ["10.0.0"], "1.2.0": ["10.0.0"], "1.2.1": ["10.0.0"], "2.0.0": ["10.0.0"], "2.1.0": ["10.0.0"], "2.1.1": ["10.0.0", "11.0.0"], "2.2.0": ["11.0.0"], "3.0.0": ["11.0.0"], "3.1.0": ["11.0.0"], "3.2.0": ["11.0.0"], "3.3.0": ["11.0.0"], "3.3.1": ["11.0.0"], "3.4.1": ["11.0.0"], "3.5.0": ["11.0.0"], "3.5.1": ["11.0.0"], "3.6.0": ["11.0.0"], "3.7.0": ["11.0.0"], "3.7.1": ["11.0.0"], "3.7.2": ["11.0.0"], "4.0.0": ["11.0.0"]}
DEBUG: /usr/local/google/home/aryehh/Development/rules_kotlin/kotlin/internal/jvm/impl.bzl:68:10: !!!
DEBUG: /usr/local/google/home/aryehh/Development/rules_kotlin/kotlin/internal/jvm/impl.bzl:69:10: external/local_jdk/bin/java
INFO: Analyzed target //src/test/data/jvm/basic:test_module_name_bin (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //src/test/data/jvm/basic:test_module_name_bin up-to-date:
  bazel-bin/src/test/data/jvm/basic/test_module_name_bin.jar
  bazel-bin/src/test/data/jvm/basic/test_module_name_bin.jdeps
INFO: Elapsed time: 0.313s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
/usr/local/google/home/aryehh/.cache/bazel/_bazel_aryehh/8452aec00c6d558f60825d3f208d7152/execroot/dev_io_bazel_rules_kotlin/bazel-out/k8-fastbuild/bin/src/test/data/jvm/basic/test_module_name_bin: line 378: /usr/local/google/home/aryehh/.cache/bazel/_bazel_aryehh/8452aec00c6d558f60825d3f208d7152/execroot/dev_io_bazel_rules_kotlin/bazel-out/k8-fastbuild/bin/src/test/data/jvm/basic/test_module_name_bin.runfiles/dev_io_bazel_rules_kotlin/external/local_jdk/bin/java: No such file or directory

Expected behavior

Target runs successfully

@hades
Copy link

hades commented Jun 19, 2024

It looks like in

java_bin_path = java_runtime.java_executable_exec_path
you need to use java_executable_runfiles_path instead of java_executable_exec_path. See the fix in rules_scala: bazelbuild/rules_scala@e14f252

@hades
Copy link

hades commented Jun 19, 2024

The workaround is to use kt_jvm_library+java_binary instead of kt_jvm_binary.

@drmercer-lucid
Copy link

I believe this was just fixed - see #1242

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

No branches or pull requests

4 participants