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 runfiles test: Macos runfiles are quite different #66

Merged
merged 2 commits into from
Feb 12, 2018

Conversation

acmcarther
Copy link
Collaborator

@acmcarther acmcarther commented Feb 2, 2018

Apparently runfiles under macos have an important difference from Unix (and I presume, windows): I believe they live directly in the working directory, not "$target_name.runfiles"

This is a sloppy fix that changes the mechanics of the test according to the target os.

Notice: @mfarrugi

EDIT: Fix silly mistake regarding runfiles explanation: "data" is the data file itself.

@acmcarther
Copy link
Collaborator Author

Adding mhlopko@ to see if there might be more context behind this discrepancy in the behavior of runfiles.

@mfarrugi
Copy link
Collaborator

mfarrugi commented Feb 2, 2018

data is our name for the dir, not a bazel path afaik. It looks like on osx the working dir is the runfiles root maybe? strange that this isn't the case on linux.

In any case, maybe it's better to keep the rule modifications without the example, if the actual location of runfiles is ill-defined.

Apparently "data" was not a quirk of macos, but rather the directory that the data file was in originally. I've moved that part of the pathbuilding accordingly.

I'm starting to suspect that the discrepancy isn't in how the runfiles dir is structure, but rather where "current_exe" points to.
@acmcarther
Copy link
Collaborator Author

Whoops, you're right. Updated description and fixed accordingly.

I don't have a strong opinion either way regarding the test but I do want to know why runfiles isn't consistent.

@acmcarther
Copy link
Collaborator Author

@mhlopko @davidzchen

@hlopko
Copy link
Member

hlopko commented Apr 5, 2018

Sorry for radio silence. Had hard time to find free evenings lately. In general I don't think you should hardcode runfiles location in your source code. Paths change depending on the platform (I'm not sure why there is a difference between mac and linux, I can find out if anybody cares :) but e.g. on windows we don't use symlinks at all and instead we provide runfiles.manifest that binary should read and use to find absolute paths.

@laszlocsomor did a ton of work on runfiles lately and provided libraries that your code can use to compute absolute runfile path in a reliable way. I'll try to find the documentation.

@acmcarther
Copy link
Collaborator Author

FTR: Source here:
https://github.com/bazelbuild/bazel/tree/master/src/tools/runfiles

We would want to add a zero-dependency rust library there that does something analogous to cpp.

@laszlocsomor
Copy link

laszlocsomor commented Apr 6, 2018

FYI, state of runfiles libraries:

  • Java is released with Bazel 0.11.0
  • Python is ready but not yet released, need to move it to @bazel_tools//tools/py/runfiles but otherwise it'll be ready
  • C++ and Bash are partially implemented
  • all runfiles libraries have to move to @bazel_tools//tools/<language>/runfiles (@lberki knows more why), the @bazel_tools//tools/runfiles location was the wrong idea

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

Successfully merging this pull request may close these issues.

5 participants