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

No way to determine runfiles tree including the workspace name #1124

Closed
damienmg opened this issue Apr 6, 2016 · 16 comments
Closed

No way to determine runfiles tree including the workspace name #1124

damienmg opened this issue Apr 6, 2016 · 16 comments
Labels
P2 We'll consider working on this in future. (Assignee optional) type: feature request

Comments

@damienmg
Copy link
Contributor

damienmg commented Apr 6, 2016

See #1116 for context. we should expose that information as an env variable

@damienmg damienmg added type: feature request P2 We'll consider working on this in future. (Assignee optional) External repositories labels Apr 6, 2016
@kchodorow
Copy link
Contributor

I don't think we should, that will encourage bad rule creation.

The plan is to have the runfiles tree like:

x.runfiles/
    main-repo/
        some-file
    another-repo/
        another-file

So if you're running in main-repo, you can get another-file via ../another-repo/another-file. If you're working on another-repo, you can still get another-file via ../another-repo/another-file.

@damienmg
Copy link
Contributor Author

damienmg commented Apr 6, 2016

Indeed, but right now the path is undecided, do you have a better idea for the transition?

@kchodorow
Copy link
Contributor

Well, I'm hoping to get a cl out this week, so no.

@damienmg
Copy link
Contributor Author

damienmg commented Apr 6, 2016

Ok let's close this one and just accept the breakage at HEAD for now

@damienmg damienmg closed this as completed Apr 6, 2016
@shahms
Copy link

shahms commented Apr 6, 2016

How will that work with runfiles found via //external?

@shahms
Copy link

shahms commented Apr 6, 2016

And, more generally, for data dependencies specified via $(location <target>)? At least based on #1116 and your discussion above, we'll have to hard code the repository when referencing those runfiles dependencies?

@kchodorow
Copy link
Contributor

How will that work with runfiles found via //external?

Do you mean targets that you've used bind() with? Those will still be available under external/targetname.

And, more generally, for data dependencies specified via $(location )?

This is a bit awkward at the moment. $(location ) will be different than runfiles, and should return the execution-root-relative path, which will still be exec-root/external/repo/path/to/target. However, we're planning to make this match runfiles soon (so it will also be ../repo/path/to/target). Unfortunately, changing this is blocked on an internal change that I'm hoping to get rolled out soon.

@RonnieAtOracle
Copy link

we'll have to hard code the repository when referencing those runfiles dependencies

That's what we are doing now and it's not ideal.

@kchodorow
Copy link
Contributor

Unfortunately, there isn't really a way to avoid that if you want your repo to have usable as runfiles by another repository.

@shahms
Copy link

shahms commented Apr 6, 2016

That's a pretty huge portability problem for us. We can't easily adjust all of the TEST_SRCDIR relative paths when importing into google3. Based on the discussion in #1116 it seems like PWD should be $TEST_SRCDIR/{workspace_name} (which would be fine) but is, instead, just TEST_SRCDIR.

@shahms
Copy link

shahms commented Apr 6, 2016

At least, if we want to actually specify a workspace name.

@shahms
Copy link

shahms commented Apr 6, 2016

Sigh; actually while it is a hurdle, we're already doing some shenanigans to work around it. Having to include the workspace name in those shouldn't be too additionally onerous.

@kchodorow
Copy link
Contributor

I think the TEST_SRCDIR thing is actually a bug, it should be TEST_SRCDIR/{workspace_name}.

@kchodorow
Copy link
Contributor

Actually, no, just checked it out and it and TEST_SRCDIR does not include the workspace name internally, so bazel shouldn't either. Sorry :-/

@shahms
Copy link

shahms commented Apr 6, 2016

Assuming "google3" is the internal workspace name (which it appears to be), PWD is documented as being "TEST_SRCDIR/google3". And my experiment shows that the documentation is correct.

@shahms
Copy link

shahms commented Apr 6, 2016

Actually, sorry for the confusion, there appears to be something else going on as a quick test in #1126 demonstrates that this is consistent with internal blaze and I'm not sure how our PWD is getting changed.

bazel-io pushed a commit that referenced this issue Apr 20, 2016
…directory

This also sets the Bazel workspace name to io_bazel_source.

Fixes #848.

Relevant to #1116, #1124,

RELNOTES[INC]: All repositories are now directly under the x.runfiles directory in the runfiles tree (previously, external repositories were at x.runfiles/main-repo/external/other-repo. This simplifies handling remote repository runfiles considerably, but will break existing references to external repository runfiles.
---
Furthermore, if a Bazel project does not provide a workspace name in the WORKSPACE file, Bazel will now default to using __main__ as the workspace name (instead of "", as previously). The repository's runfiles will appear under x.runfiles/__main__/.

--
MOS_MIGRATED_REVID=120224534
bazel-io pushed a commit that referenced this issue Apr 22, 2016
*** Reason for rollback ***

Broke non-Bazel projects on ci.bazel.io

Fixes #1168

*** Original change description ***

Move the runfiles for external repositories to under the x.runfiles/ directory

This also sets the Bazel workspace name to io_bazel_source.

Fixes #848.

Relevant to #1116, #1124,

RELNOTES[INC]: All repositories are now directly under the x.runfiles directory in the runfiles tree (previously, external repositories were at x.runfiles/main-repo/external/other-repo. This simplifies handling remote repository runfiles considerably, but will break existing references to external repository runfiles....

***

--
MOS_MIGRATED_REVID=120535721
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) type: feature request
Projects
None yet
Development

No branches or pull requests

4 participants