-
-
Notifications
You must be signed in to change notification settings - Fork 109
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: determine the RUNFILES directory when running a js_binary in an sh_binary #286
Conversation
fe9bce7
to
72287ab
Compare
"""], | ||
) | ||
|
||
sh_binary( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this is a sh_binary
and not a sh_test
like we probably want. But the bug doesn't occur with sh_test
. Any idea why the bug wouldn't occur when testing?
I think if we leave it as sh_binary
then we need to add another rule (which I forget) to run it as a test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea, it is sh_binary specific since sh_test sets the TEST_SRCDIR env var so RUNFILES is determined that way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you run the sh_binary through a genrule it is not reproducible either as the environment is setup differently in that case. only bazel run
directly on the sh_binary
will reproduce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea, it is sh_binary specific since sh_test sets the TEST_SRCDIR env var so RUNFILES is determined that way
Not really related to this PR... but can RUNFILES be determined the same everywhere? Doing it different for tests seems odd 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that code could get simplified in the future. Tricky to do right now as we don't have great coverage for different platforms and all of the corner cases.
function normalize_windows_path { | ||
# Apply the followings paths transformations to normalize paths on Windows | ||
# -process driver letter | ||
# -convert path separator | ||
# -lowercase everything | ||
sed -e 's#^\(.\):#/\L\1#' -e 's#\\#/#g' -e 's/[A-Z]/\L&/g' <<< "$1" | ||
sed -e 's#^\(.\):#/\L\1#' -e 's#\\#/#g' <<< "$1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did windows capitalization come into play with this issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The replacement of /MANIFEST
is simpler if we don't lowercase it. Not sure why it was there in the first place; that code came from rules_nodejs
# runfiles directory and named my_binary.runfiles_manifest | ||
RUNFILES=${NORMALIZED_RUNFILES_MANIFEST_FILE%_manifest} | ||
elif [[ "${NORMALIZED_RUNFILES_MANIFEST_FILE}" == */MANIFEST ]]; then | ||
# Older versions of Bazel put the manifest file named MANIFEST in the runfiles directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know what version switched it? Can we put a comment so we can potentially remove the elif
in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure and doesn't seem worthwhile to do a binary search for this one
72287ab
to
b48471d
Compare
b48471d
to
ff50492
Compare
Fixes #285
Without the fix commit,
with the commit