rules_jvm_external icon indicating copy to clipboard operation
rules_jvm_external copied to clipboard

pin.sh doesn't work without enable_runfiles

Open khogeland opened this issue 3 years ago • 0 comments

This option is off by default on Windows and breaks assumptions about the working directory in pin.sh. You'll end up with some totally confusing output like this:

+ set -euo pipefail
+ readonly maven_install_json_loc=C:/users/khogeland/lhome/maestro/maven_install.json
+ maven_install_json_loc=C:/users/khogeland/lhome/maestro/maven_install.json
+++ dirname C:/users/khogeland/lhome/maestro/maven_install.json
++ cd C:/users/khogeland/lhome/maestro
++ bazel info execution_root
Starting local Bazel server and connecting to it...
+ readonly execution_root=C:/msys64/home/khogeland/_bazel_khogeland/otr6yf3z/execroot/__main__
+ execution_root=C:/msys64/home/khogeland/_bazel_khogeland/otr6yf3z/execroot/__main__
++ basename C:/msys64/home/khogeland/_bazel_khogeland/otr6yf3z/execroot/__main__
+ readonly workspace_name=__main__
+ workspace_name=__main__
+ pwd
/c/users/khogel~1/_bazel~1/otr6yf3z/execroot/__main__/bazel-~1/x64_wi~1/bin/external/unpinn~1/pinexe~2.run
+ readonly jq=../unpinned_maven/jq
+ jq=../unpinned_maven/jq
+ cat
+ ../unpinned_maven/jq --sort-keys --indent 4 . -
C:\Users\khogeland\_bazel_khogeland\otr6yf3z\execroot\__main__\bazel-out\x64_windows-fastbuild\bin\external\unpinned_maven\pin: line 19: ../unpinned_maven/jq: No such file or directory

I think the correct way to do this would be to use execpath to find jq relative to the workspace root. I made that change here, but I can't create a PR as-is because it assumes maven_install.json is in the root. FWIW I did test the change works on Mac and Windows with and without enable_runfiles.

khogeland avatar Apr 08 '21 22:04 khogeland