bazel-contrib / bazel-contrib/rules_jvm_external

pin.sh doesn't work without enable_runfiles

Open
#547 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
373
Forks
301
Avg merge
7d 17h
Merged PRs (30d)
3

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pin.sh and the generated pin action, focusing on how jq is located when enable_runfiles is disabled. Review the linked commit and the maven_install.json location assumptions, then verify the behavior on Mac and Windows with and without enable_runfiles, including a non-root maven_install.json path.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.